migrate

A minimal, storage-agnostic migration framework for Node.js with both a CLI and a programmatic API.

Tool
npm
v2.1.0
1,548stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
38/100Needs Attention
Development Activity0
Maintenance0
Community64
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
79/100Good
Architecture80
Code Quality78
Innovation76
Learning Curve68

migrate (node-migrate) is a lightweight, abstract migration framework for Node.js. Rather than being tied to a specific database, it manages an ordered set of reversible up/down migrations against any state store you choose — a SQL database, a document store, files, or an entirely custom system.

You create timestamped migration files with up and down functions, then run them forward or backward through the migrate CLI or programmatically via migrate.load(). Migration state is persisted (by default to a .migrate file, or to a custom store you supply), so the tool always knows which migrations have been applied.

What You Get

  • A migrate CLI with init, create, list, up, and down commands
  • A programmatic API (migrate.load, set.up, set.down) for embedding migrations in your own scripts
  • Timestamped migration files with paired up/down functions supporting callbacks or async/await
  • Pluggable state storage — a default .migrate file store or a custom stateStore you provide
  • Dry-run and other flags for controlling how migrations execute

Common Use Cases

  • Managing database schema and data migrations in a framework-agnostic Node.js app
  • Running ordered setup/teardown steps against any custom or non-database state store
  • Embedding migration runs into deployment or CI scripts programmatically
  • Keeping reversible, versioned changes to application state under source control

Under The Hood

Architecture - The core models a migration Set — an ordered list of migration objects each with up/down functions and a title — and a MigrationSet that tracks the last-run position. A pluggable store (FileStore by default) loads and persists which migrations have run to a state file. The CLI wraps this core with commands that discover files in ./migrations/, load the set, and step up or down to a target, while the programmatic load() entry point exposes the same set to application code. Tech Stack - Plain JavaScript following the standard style guide, distributed as a Node package with a migrate bin. It has minimal runtime dependencies and relies on Node’s module system to load migration files. Code Quality - The repo follows standardjs, ships a test suite, and has a stable, mature codebase; recent development activity is low, reflecting a feature-complete tool rather than active churn. API Design - Both surfaces are intentionally small: the CLI mirrors familiar migration verbs, and the programmatic API is a couple of functions. The abstract, storage-agnostic design trades a little setup (you wire your own state/db) for broad flexibility.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search