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

@theokit/plugin-db-drizzle

v0.1.0

Published

Standalone DB plugin for TheoKit — wraps drizzle-kit + @theokit/orm with a plugin-shape factory, 7-verb theokit db CLI, drizzle-kit studio passthrough, and optional devtools tab integration. Form 4 Hybrid per plan p5-plugin-db-drizzle v1.0.

Readme

@theokit/plugin-db-drizzle

Standalone DB plugin for TheoKit — wraps drizzle-kit and @theokit/orm behind a single plugin-shape factory.

Status: v0.1.0 initial publish on the @next tag. Promote to @latest is calendar-gated alongside the Onda 2 cohort.

What you get

  • One drizzleDb(opts) call wires drizzle into your TheoKit app.
  • Seven theokit db <verb> CLI subcommands: generate / migrate / push / studio / reset / seed / check.
  • Drizzle-kit studio passthrough (no custom UI baggage).
  • Opt-in devtools tab that IFRAMEs the studio when the TheoKit devtools overlay is loaded.

@theokit/orm is a required peer — this plugin wraps it, never duplicates. Your Repository, @InjectRepository, @Transactional, and OrmModule keep working unchanged.

Install

pnpm add @theokit/plugin-db-drizzle@next @theokit/orm@next drizzle-orm reflect-metadata
# Optional — only needed for the CLI verbs (generate/migrate/studio/...)
pnpm add -D drizzle-kit

Wire it into theo.config.ts

import { drizzleDb } from "@theokit/plugin-db-drizzle";
import { defineConfig } from "theokit";

export default defineConfig({
  plugins: [
    drizzleDb({
      driver: "postgres",
      url: process.env.DATABASE_URL,
      schemaPath: "./db/schema.ts",
      migrationsPath: "./db/migrations",
    }),
  ],
});

Options reference

| Option | Type | Default | Notes | |---|---|---|---| | driver | 'sqlite' \| 'postgres' \| 'mysql' | (required) | Canonical drizzle-kit driver names | | url | string | (caller-provided) | Connection URL — pass process.env.DATABASE_URL | | schemaPath | string | './db/schema.ts' | Path to your drizzle schema file | | migrationsPath | string | './db/migrations' | Directory for generated migration files | | devtoolsTab | boolean | true | Register a devtools-overlay tab when present |

CLI verbs

theokit db generate    # Generate migration from schema diff
theokit db migrate     # Apply pending migrations
theokit db push        # Push schema directly (dev-only)
theokit db studio      # Open drizzle-kit studio (visual DB explorer)
theokit db reset --force  # Drop tables + re-apply all migrations
theokit db seed        # Run the user-provided seed script
theokit db check       # Check schema drift

All verbs shell out to drizzle-kit via Node child_process. If you don't install drizzle-kit, your runtime app still works — only the CLI verbs error out with an actionable message.

Devtools tab (opt-in)

When the TheoKit devtools overlay (G4) is loaded, the plugin registers a "Database" tab that IFRAMEs http://localhost:4983 (drizzle-kit's default studio port). Run theokit db studio in another terminal to populate it.

Opt out via drizzleDb({ devtoolsTab: false, ... }).

Production note: the devtools overlay is dev-only. Production builds tree-shake the tab module — no IFRAME is emitted to your shipped bundle.

RLS / auth integration

The plugin re-uses @theokit/orm's withAgentContext AsyncLocalStorage. Wrap session-scoped queries the same way you do with orm direct:

import { withAgentContext } from "@theokit/orm";

await withAgentContext({ userId: session.userId }, async () => {
  return await users.findMany();
});

For native RLS policy generation, drizzle-kit's RLS support is the canonical path — this plugin does not add a layer on top.

Migration from @theokit/orm direct usage

If you currently wire orm directly:

// Before
import { OrmModule } from "@theokit/orm";
defineConfig({
  modules: [OrmModule.forRoot({ connector: "postgres", url: process.env.DATABASE_URL })],
});

// After
import { drizzleDb } from "@theokit/plugin-db-drizzle";
defineConfig({
  plugins: [drizzleDb({ driver: "postgres", url: process.env.DATABASE_URL })],
});

Your Repository / decorator usage stays identical — the plugin re-exports orm's surface.

License

MIT