Seed your Prisma database with realistic test data
Maintaining a prisma/seed.ts by hand means writing insert logic per model, and it rots the moment the schema moves. Copying a production dump into your dev database is a GDPR problem waiting to happen. The fix: foreign-key-consistent, realistic data generated straight from your schema, data that actually looks real, not "Premium Widget 1" and lorem ipsum. One call fills the whole database.
Free tier, no card. Want to see the output before wiring anything up? Try the login-free sandbox: paste a schema, generate, look at the rows.
Seed your Prisma database in one call
Pull SeedBase in as a dev dependency and call seedPrisma from your seed file. It generates and loads foreign-key-consistent data through the same PrismaClient your app uses, so your schema has to exist first, which prisma migrate already owns.
// prisma/seed.ts
import { PrismaClient } from "@prisma/client";
import { SeedbaseClient } from "@seedbase/client";
import { seedPrisma } from "@seedbase/client/prisma";
const prisma = new PrismaClient();
const client = new SeedbaseClient({ token: process.env.SEEDBASE_TOKEN });
await seedPrisma(prisma, client, { project: process.env.SEEDBASE_PROJECT, seed: 42 });
With that file in place, run prisma db seed and Prisma executes it. Install SeedBase as a dev dependency first:
npm install --save-dev @seedbase/client
The seedPrisma helper does the work: it generates a realistic, FK-consistent dataset for your schema and writes it through the same Prisma connection your app uses. No insert logic per model, no manual wiring between parents and children. Your schema must exist already, which prisma migrate owns, and SeedBase fills it FK-safe.
Realistic data, not "Premium Widget 1"
The point is not just filling rows, it is filling them with data a real query would actually return. SeedBase resolves foreign keys across tables, uses realistic distributions, and writes coherent free text instead of repeating a placeholder, so a customerId on an order points at a customer that exists and a product name reads like a product, not "Premium Widget 1".
- Foreign keys resolve across tables: every child row points at a parent that exists, so the data loads with constraints on.
- Realistic distributions and coherent free text, not placeholders, so your queries and assertions hit data that looks real.
- One call replaces the pile of per-model insert logic and the wiring between them.
A real alternative to hand-written seed scripts
A handful of prisma.user.create calls is fine. A real schema is not. Once you have dozens of models, your seed script has to know which parent rows exist, which relations to satisfy, and which derived totals to keep in sync. You end up maintaining a second, worse copy of your schema in your seed file.
- Seed scripts drift: add a required field and the inserts that miss it start failing.
- Insert logic multiplies: one block per model, plus all the ordering so children come after their parents.
- Production dumps are a GDPR problem: real names, real emails, real card data sitting in your dev database.
- The data looks fake, so tests pass against rows no real query would ever return.
SeedBase replaces all of that with one call that reads your schema, resolves the foreign keys for you, and seeds realistic data in the right order.
Deterministic and reproducible
Generation is seeded. The same seed produces the same data, every run. That keeps CI reproducible: the same prisma db seed run yields the same rows on every machine, so a green build stays green for the right reason. When a test fails, reuse the seed and you reproduce the exact dataset that broke it, instead of chasing a seed script that has since been hand-edited.
Free tier: generate, download, seed
Generation and JSON download are free to use. You do not need push-to-database or any paid feature to seed your Prisma database, because the data loads through your own PrismaClient. Generate once, run prisma db seed, and let it fill the schema prisma migrate already owns.
Try it
There is a runnable example, so you can clone it, run the seed, and watch a real FK-consistent dataset get written to a database. Then point it at your own schema.
node packages/seedbase-node/examples/prisma-seed-demo.mjs
- Paste a schema and look at the rows in the login-free sandbox, no account needed.
- Drive generation from your editor with the VS Code extension.
- Read the docs for the Prisma helper and the database connections.
- Create a free account at /register to generate against your own schema.
Stop hand-writing seed scripts.
Generate a foreign-key-consistent dataset once and seed your Prisma database with one call. Free tier, no card.
Create a free accountMore: login-free sandbox · Django · Symfony · Laravel · Test data fixtures · VS Code · Docs · home
Frequently asked questions
Is it free?
Yes. Generation and JSON download are part of the free tier, so you can pull a foreign-key-consistent dataset and seed your Prisma database at no cost. Pro adds Parquet export, direct database push and higher row limits, but you do not need any of that to seed a Prisma database from your schema.
How is this different from a hand-written prisma/seed.ts?
You do not write insert logic per model by hand. SeedBase fills the database foreign-key-consistent out of your schema with realistic data, so a row that points at a parent always finds a parent that exists, and the values look real instead of "Premium Widget 1" or lorem ipsum.
How do I run it?
Call seedPrisma in prisma/seed.ts, then run prisma db seed. The seedPrisma helper generates and loads FK-consistent data through the same PrismaClient your app uses, and prisma db seed runs that file.
Does it read my Prisma schema?
Yes. SeedBase reads schema.prisma or a live database, so it knows your models, fields and relations and fills them foreign-key-consistent without you describing the schema a second time.
Is it deterministic?
Yes, per seed. Generation is seeded, so the same seed produces the same data every run. That keeps CI reproducible: the same seed run yields the same rows, and a failing test can be reproduced exactly by reusing the seed.