Skip to content

Generate Prisma seed files automatically from your existing database data - simplifies creating seed.ts scripts for easy project setup and data replication.

License

Notifications You must be signed in to change notification settings

clewup/seedgen-prisma

Repository files navigation

🚀 seedgen-prisma

npm version license build

Generate a prisma/seed.ts file from your existing database data - easily create seed scripts from live Prisma databases.

✨ Features

  • 🔄 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

📦 Installation

npm install seedgen-prisma

🚀 Quick Start

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

⚙️ Usage with package.json seed command

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

🧪 Running Tests

npm test

📄 License

MIT


🙋‍♀️ Contributing

  1. Fork this repo

  2. Create your feature branch (git checkout -b feature/awesome)

  3. Commit your changes (git commit -am 'Add awesome feature')

  4. Push to the branch (git push origin feature/awesome)

  5. Open a pull request


⚠️️ Disclaimer

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.

⚠️ Use at your own risk.

About

Generate Prisma seed files automatically from your existing database data - simplifies creating seed.ts scripts for easy project setup and data replication.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published