Mongoose Seed Kit

Run Mongoose seed scripts once, and keep track of which ones ran.

GitHubnpmNode.jsTypeScriptMongoDB

A seeding toolkit for Mongoose that runs one-time database initialization scripts on application startup and records what has already been executed. It exists because every project I worked on kept reinventing the same "has this seed already run?" bookkeeping.

Features

  • Runs pending seeders on startup and tracks each result in MongoDB
  • Retries failed seeders on the next run, leaving successful ones alone
  • CLI to scaffold, run, inspect and reset seeders
  • Programmatic API (runPendingSeeders, runSeederByName, getSeederStatuses, resetSeeder) for building admin routes
  • Environment aware path resolution, so src and dist both work
  • Zero external dependencies, no extra model registration

Install

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

Requires Mongoose 6 or newer.

Source on GitHub, package on npm.