PG Seed Kit

Run Postgres seeds once, whichever ORM you use.

GitHubnpmWebsiteTypeScriptNode.jsPostgreSQL

A seeder toolkit for Postgres that runs one-time seed scripts on startup and records which ones have already been applied, so each seeder runs exactly once. It is the Postgres counterpart to Mongoose Seed Kit, built the same way and for the same reason.

Features

  • Runs pending seeders on startup and tracks each result, creating the tracking table on first run
  • Retries failed seeders on the next run, leaving successful ones untouched
  • Adapters for Prisma, Drizzle, TypeORM and Sequelize, imported as subpaths such as pg-seed-kit/prisma
  • Reuses your ORM's existing connection, so there is nothing extra to configure
  • CLI to create, run, inspect and reset seeders
  • Zero runtime dependencies

Install

npm install pg-seed-kit
npx pg-seed-kit create add-default-roles
npx pg-seed-kit status
npx pg-seed-kit run

Source on GitHub, package on npm, docs at kulcsarrudolf.github.io/pg-seed-kit.