npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

express-umzug

v2.1.4

Published

This middleware creates a series of endpoints to help you monitor and manage your database migrations

Readme

Express Umzug

This middleware creates a series of endpoints to help you monitor and manage your database migrations when it's pushed to production. It's useful when you run your application on Cloud Native Platforms such as Cloudfoundry, ElasticBeanstalk, AWS ECS, Nomad, Kubernetes, Openshift, Heroku etc. and you are in need of endpoints for administering schema migrations.

Getting Started

It is based on umzug by Sequelize.

Endpoints

| Endpoint ID | Description | | ---- | ---- | | GET migrations/all | Getting all migrations (Combining output of executed and pending) | | GET migrations/pending | Getting all pending migrations | | GET migrations/executed | Getting all executed migrations | | POST migrations/up| Executing pending migrations | | POST migrations/up/:id | Executing pending migrations upto specific migration id | | POST migrations/up/step/:count | Executing pending migrations up till pecific steps | | POST migrations/down | Reverting executed migration | | POST migrations/down/:id | Reverting executed migrations down to specific migration id | | POST migrations/down/step/:count | Reverting executed migrations down till specific steps |

Download Postman Collection

Installing

npm i express-umzug

Usage

Using express-umzug is really simple. You'd import it just as other packages, invoke the instance, and apply it as a middleware to your Express app instance. For example:

const express = require("express");
const { expressUmzug, SequelizeStorage } = require("express-umzug");
const sequelize = require("./path/to/your/sequelize/instance"); // usually "./models/"
const { Sequelize } = require("sequelize");
const app = express();

app.use(expressUmzug({
  secretKey: "<your_secret_key>" // make sure not to share this key
  umzugOptions: {
    context: sequelize.getQueryInterface(), // required for express-umzug to work
    storage: new SequelizeStorage({ sequelize }), // your migration storage mechanism (you can check the source code to look at the available storage types)
    basePath: "/development", // you can change this to a custom base path of your choice (by default - an empty string i.e. no base path),
    migrations: {
      // change according to your migration path
      glob: "/migrations/*.js",
      // you'd need to pass down a function to `resolve` field which hijacks
      // the migrations and passes down the correct sequelize instance and the
      // Sequelize class. Expect it to break if you don't pass the function
      resolve: ({ name, path, context }) => {
        const migration = require(path);
        return {
          name,
          up: async () => migration.up(context, Sequelize),
          down: async () => migration.down(context, Sequelize),
        };
      }
    },
    logger: console // you can optionally pass a logger too
  },
}));

// rest of the code...

For express-umzug to work, the options argument requires a secretKey string to be passed in. You'd then add the same secret key in x-secret-key header of you request. This secret key is not supposed to be committed in the code. Keep it somewhere hidden. options also requires umzugOptions to be passed in. This is the options object that is intrinsically passed into umzug constructor.

Currently, only the sequelize ORM is supported.

Once set up, you can use any HTTP client (e.g. cURL, Postman, Insomnia, etc.) to access the endpoints to manage you migrations. Refer to Endpoints for all the available endpoints and their use cases. For example, hitting migrations/all endpoint will give you all the executed and pending migrations.

curl -H "x-secret-key: <your_secret_key>" https://example.com/migrations/all

Running the tests

You can run the tests using npm test command:

npm test

To check the test coverage, execute:

jest --coverage

If you have jest globally installed on your system

OR

npx jest --coverage

If you don't have jest globally installed on your system

Deployment

Add additional notes about how to deploy this on a live system

Built With

To be updated.

Contributing

We currently don't allow other developers to contribute to this project. Once the project becomes more mature, we'll open the doors for contributions. Keep checking this space.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Dishant Pandya - Initial work - Openxcell
  • Dhwanik Panchal - Initial work - Email

License

This project is licensed under the MIT License - see the LICENSE.md file for details