Generate a prisma/seed.ts file from your existing database data - easily create seed scripts from live Prisma databases.
- 🔄 Generate seed files based on current database content
- 🎯 Select specific Prisma models to include
- ⚙️ Automatically add Prisma seed command to your package.json
- ✅ Works with TypeScript seed scripts
- 🚫 Prevents overwriting existing seed commands without confirmation
npm install seedgen-prisma
Run the CLI from your project root (make sure you have run prisma generate):
npx seedgen-prisma
By default, this will create prisma/seed.ts based on your entire database.
To generate seed file for specific models:
Output:
npx seedgen-prisma --models User Post Comment
The CLI will prompt to add or update this command in your package.json:
"prisma": {
"seed": "ts-node prisma/seed.ts"
}
You can then seed your database by running:
npx prisma db seed
npm test
MIT
-
Fork this repo
-
Create your feature branch (git checkout -b feature/awesome)
-
Commit your changes (git commit -am 'Add awesome feature')
-
Push to the branch (git push origin feature/awesome)
-
Open a pull request
This project is not affiliated with or endorsed by Prisma or Prisma Labs.
It is an independent community-built tool designed to work alongside the Prisma ORM.
This tool exports live data from your connected database into a seed script (prisma/seed.ts
).
Depending on your data, it may include sensitive or production-only values.
Use with caution and always review generated seed files before committing or deploying.