npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

shopify-app-session-storage-kysely

v0.1.0

Published

Kysely-backed session storage adapter for Shopify apps, implementing @shopify/shopify-app-session-storage's SessionStorage interface.

Downloads

150

Readme

shopify-app-session-storage-kysely

A Kysely-backed implementation of Shopify's SessionStorage interface, for Shopify apps that already use Kysely as their query builder.

Works with any database Kysely supports (Postgres, MySQL, SQLite). Like the official prisma/drizzle adapters, you own the schema — this package ships a Kysely migration to create the table, but doesn't create it implicitly.

Install

npm install shopify-app-session-storage-kysely

Peer dependencies (you almost certainly already have these):

npm install @shopify/shopify-api @shopify/shopify-app-session-storage kysely

1. Create the Session table

The package exports a standard Kysely Migration. The migration uses Kysely's dialect-aware schema builder, so it's designed to run on Postgres, MySQL, and SQLite (only Postgres is covered by this package's tests).

Run it through Kysely's own Migrator (recommended — versioned, tracked):

import { Migrator } from "kysely";
import { migrations } from "shopify-app-session-storage-kysely";

const migrator = new Migrator({
  db,
  provider: { getMigrations: async () => migrations },
});

await migrator.migrateToLatest();

…or, if you manage schema elsewhere (Atlas, raw SQL, an existing table), apply it once directly:

import { sessionTableMigration } from "shopify-app-session-storage-kysely";

await sessionTableMigration.up(db);

2. Tell Kysely about the table

Your Kysely database type needs a Session table. If you generate types from a database where the migration has run (e.g. kysely-codegen), you get this for free. Otherwise, compose the exported SessionTable into your database type:

import { Kysely } from "kysely";
import type { SessionTable } from "shopify-app-session-storage-kysely";

interface Database {
  Session: SessionTable;
  // ...your other tables
}

const db = new Kysely<Database>({ dialect: /* ... */ });

3. Use it

import { shopifyApp } from "@shopify/shopify-app-react-router/server";
import { KyselySessionStorage } from "shopify-app-session-storage-kysely";

const shopify = shopifyApp({
  // ...
  sessionStorage: new KyselySessionStorage(db),
});

KyselySessionStorage accepts any Kysely instance whose database type includes a Session table — the column types only need to be compatible at runtime, so a codegen'd type using Generated<…> / ColumnType<…> wrappers is accepted just the same as a plain SessionTable.

Schema

The table follows the Shopify Remix/Prisma template's Session model — broken-out associated-user columns plus refreshToken/refreshTokenExpires for the token-exchange flow. (The official SQL adapters instead serialize online-access data into an onlineAccessInfo column and name the table shopify_sessions; this adapter uses the template's column-per-field shape.)

| Column | Type | Notes | | --------------------- | ----------- | -------------------------------------- | | id | text (PK) | | | shop | text | | | state | text | | | isOnline | boolean | default false | | scope | varchar(1024) | | | expires | timestamp | nullable | | accessToken | text | | | refreshToken | text | nullable | | refreshTokenExpires | timestamp | nullable | | userId | bigint | online sessions; stored as a string | | firstName | text | online sessions | | lastName | text | online sessions | | email | text | online sessions | | accountOwner | boolean | default false | | locale | text | online sessions | | collaborator | boolean | nullable | | emailVerified | boolean | nullable |

The table is named Session and is indexed on (shop, isOnline).

License

MIT