Guide
drizzle-seed vs snaplet/seed vs Prisma Seed 2026



Compare drizzle-seed, @snaplet/seed, and Prisma's seeding patterns in 2026. Type-safe database seeding, fake data generation, and CI pipeline integration.
Contents
Contents
TL;DR
Use drizzle-seed to generate reproducible test rows from an existing Drizzle schema. Keep Prisma’s seed runner when you want to define the records and relationships in code. Evaluate @snaplet/seed on a disposable database when you want a typed seed client generated from the database schema.
Key Takeaways
- Drizzle Seed generates rows from Drizzle tables. Use refinements when tests need specific values.
- Snaplet Seed generates a typed client and uses Copycat for deterministic values. Generating text examples with a model is optional.
- Prisma runs a seed command you configure. The script controls the data and can use Prisma Client or SQL.
Why Database Seeding Matters in 2026
Modern development workflows demand realistic seed data in multiple contexts:
- Unit and integration tests that need database records to assert against
- Preview environments (Vercel, Railway, Render) that auto-deploy PRs with empty databases
- E2E testing (Playwright, Cypress) that expects specific data states
- Local development where every new clone needs a working dataset
- Demo environments for sales and marketing that look credible
For a seed script that inserts users and orders, insert the users first and make the orders refer to those rows. If an automated seeder handles the relationships, check the resulting row counts and foreign keys on a fresh test database.
drizzle-seed
drizzle-seed generates synthetic rows from Drizzle table definitions. Use explicit generators for values your tests depend on.
Installation and Basic Usage
npm install drizzle-seed
// seed.ts
import { seed } from 'drizzle-seed'
import { db } from './db'
import * as schema from './schema'
async function main() {
await seed(db, schema)
}
main()
The seeder chooses generators from the table definitions. Use refinements when a column must meet a specific format or range.
Schema-Aware Generation
Define column types and foreign keys in your Drizzle schema.
// schema.ts
import { pgTable, serial, text, integer, boolean, timestamp } from 'drizzle-orm/pg-core'
export const users = pgTable('users', {
id: serial('id').primaryKey(),
email: text('email').notNull(),
name: text('name').notNull(),
age: integer('age'),
isActive: boolean('is_active'),
createdAt: timestamp('created_at'),
})
export const posts = pgTable('posts', {
id: serial('id').primaryKey(),
title: text('title').notNull(), // generates sentence-like titles
content: text('content'), // generates paragraph text
authorId: integer('author_id')
.references(() => users.id), // respects FK — inserts users first
})
This example declares the foreign key with references(). Seed the parent and child tables together. Test the resulting relationship against the database constraint.
Refinements for Custom Data
When you need specific values, refinements override auto-generation:
await seed(db, schema, { count: 100 }).refine((f) => ({
users: {
count: 50,
columns: {
email: f.email(), // force email format
name: f.fullName(), // force full name format
age: f.int({ minValue: 21, maxValue: 65 }),
}
},
posts: {
count: 200, // 200 posts across 50 users
columns: {
title: f.loremIpsum({ sentencesCount: 1 }),
content: f.loremIpsum({ sentencesCount: 5 }),
}
}
}))
The f.* namespace provides typed generators: f.email(), f.fullName(), f.int(), f.boolean(), f.date(), f.uuid(), f.loremIpsum(), f.postcode(), f.city(), f.country(), and more.
Reproducible Seeds
For deterministic test data, pass a seed number:
await seed(db, schema, { seed: 42, count: 100 })
// Keep the schema, package version, and inputs fixed for repeatable rows.
This is essential for snapshot tests and reproducible E2E test environments.
Reset Between Tests
import { reset } from 'drizzle-seed'
// In test beforeEach or afterEach:
await reset(db, schema) // truncates all seeded tables
await seed(db, schema) // re-seeds fresh data
@snaplet/seed
@snaplet/seed introspects a database through its configured adapter and generates a typed client for its schema. The client uses Copycat to generate deterministic values. A separate, optional model-assisted step can generate text examples during sync. It needs provider credentials and saves examples you can inspect.
Setup and a relationship check
Use the pinned quick start for a disposable PostgreSQL database. Configure the adapter, run npx @snaplet/seed sync after schema changes, then run the seed script. The following example assumes a generated posts method and an author relationship. Check that it creates a post linked to the supplied author email.
import { createSeedClient } from '@snaplet/seed'
const seed = await createSeedClient()
await seed.posts([
{
title: 'Sample post',
author: { email: 'fixture-author@example.com' },
},
])
Release and license
Supabase describes Seed as community-maintained with occasional fixes. Treat it as an optional development dependency and test your database adapter in CI. Supabase seeding guide.
The published @snaplet/seed@0.98.0 tarball carries the Functional Source License with an MIT grant that takes effect two years after release. The original terms allow internal use and restrict offering competing commercial products or services. The MIT grant for this release has taken effect. The source repository also has an MIT license. Published tarball · Functional Source License · Repository license.
Prisma's Seeding Approach
Prisma’s CLI runs the seed command you configure. In Prisma ORM v7, set migrations.seed in prisma.config.ts and call npx prisma db seed explicitly. If your script uses Prisma Client, initialize it with the driver adapter for your database.
Setup
Add this to the project’s Prisma config and keep its existing schema and datasource settings:
migrations: {
path: "prisma/migrations",
seed: "tsx prisma/seed.ts",
},
In the seed script, create known rows with stable IDs for test assertions. Use an upsert when a row needs to survive reruns. For bulk data, consider createMany() after you have the required parent IDs. Prisma seeding examples.
Compare the workflows
| Check | drizzle-seed | @snaplet/seed | Prisma seed command |
|---|---|---|---|
| Starting point | Drizzle table definitions | Database schema through an adapter | Your configured command |
| Control fixture data | Use refinements to override generated fields | Set values in a plan passed to the generated client | Specify the records and relationships in the script |
| Rerun in CI | Reset supported test tables and reuse seed inputs | Sync the client with the test schema and run the seed plan | Use explicit upserts or start from a fresh database |
When to Use Each
- Use drizzle-seed if your tables are already defined in Drizzle and tests need reproducible synthetic rows.
- Try @snaplet/seed if you want a typed client generated from a database schema. Check adapter compatibility and confirm a generated child row links to its parent.
- Keep Prisma’s seed command if you already maintain a script for exact business cases. Use the script to control which fixtures are created after migrations.
CI Integration
Apply migrations to a disposable database before running the seed step. With Prisma, call prisma db seed after migrations. With Drizzle, call the script that invokes seed(). Use a separate database or schema for each concurrent worker and check the inserted rows before running the tests.
Source notes
- To reproduce a Drizzle dataset, pass the same seed value and keep the schema and generator configuration fixed. Drizzle seed options
- For Prisma, configure the seed command in the project and invoke it with
prisma db seed. Prisma seeding workflow
Methodology
The Drizzle fixture uses drizzle-seed@0.3.1 and an in-memory PostgreSQL-compatible database to check reproducibility and foreign keys. Snaplet’s example illustrates its generated client and needs a database with the matching schema. Prisma’s config follows the Prisma ORM v7 seed runner contract.
See how Drizzle ORM compares to Prisma on PkgPulse.
Related: Drizzle ORM v1 vs Prisma 6 vs Kysely 2026 · Testcontainers Node.js vs Docker Compose 2026