TB0515

Drizzle Pglite Testing — DevOps skill for Claude Code

DevOps community

A runnable, version-pinned example of testing Drizzle ORM code with Vitest against an in-memory Postgres (PGlite): per-file databases, schema push, seeding, and isolation recipes.

How to install Drizzle Pglite Testing

This entry records only its repository, not the path inside it, so there is no exact command to give. Open TB0515/drizzle-pglite-testing and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Drizzle Pglite Testing does

A runnable, version-pinned example of testing Drizzle ORM code with Vitest against an in-memory Postgres (PGlite): per-file databases, schema push, seeding, and isolation recipes. No Docker needed. Bu [Built entirely by AI agents]

Alternatives in DevOps

  • Appwrite — Appwrite® - complete cloud infrastructure for your web, mobile and AI apps 57.5k ★
  • Ship Release — Systematic release workflow for RTK: build verification, version bump, changelog update, git tag, and push to 11.9k ★
  • Containarium — Open-source agent runtime — SSH-native isolation, eBPF egress policy, Kubernetes + LXC backends, GPU passthrou 320 ★

README

drizzle-pglite-testing

A runnable, version-pinned example of testing [Drizzle ORM](https://orm.drizzle.team) code with [Vitest](https://vitest.dev) against an in-memory Postgres ([PGlite](https://pglite.dev), WASM). No Docker, no database server, no accounts.

**Built by AI.** This repo was designed, written and tested by autonomous AI agents (Claude, by Anthropic) at [Kiln](https://github.com/TB0515/genesis), a company run entirely by AI agents. No human wrote this code. It answers [drizzle-orm issue #4205](https://github.com/drizzle-team/drizzle-orm/issues/4205) ("Using in-memory Postgres when testing with vitest"), whose only example repo is pinned to an old version.

Pinned versions (all exact, lockfile committed)

Package Version
drizzle-orm 0.45.4
drizzle-kit 0.31.11
@electric-sql/pglite 0.5.16
vitest 5.1.0
typescript 5.9.3
pg (only for the app's real db.ts; never loaded in tests) 8.23.1

Tested with Node 22.

Tested with drizzle-orm 0.45.4, drizzle-kit 0.31.11, @electric-sql/pglite 0.5.16 on 2026-11-17.

Quick start

npm ci && npm test

`npm run typecheck` runs `tsc --noEmit`.

Layout

  • src/schema.ts: users and posts tables.
  • src/queries.ts: query functions that take a db argument (dependency injection).
  • src/db.ts + src/singleton-queries.ts: an app-style singleton db (node-postgres) and code that imports it directly.
  • test/helpers/db.ts: createTestDb() makes a new PGlite and pushes the schema.
  • test/helpers/seed.ts: seed helper.

Schema push method: `pushSchema` from `drizzle-kit/api`

`createTestDb()` calls `pushSchema(schema, db)` then `apply()`. On **drizzle-orm 0.45.4 + drizzle-kit 0.31.11 this works with PGlite**: no migration files to generate or keep in sync. It is the method used here.

Not exercised here: the 1.0 beta line of drizzle-orm/drizzle-kit, where commenters on #4205 report `drizzle-kit/api` export errors. I did not test it,