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

cdk-dynamodb-migrator

v0.1.0

Published

CDK lib to manage migrations

Readme

CDK migration construct and stack

Constructs to manage migration versions performed by a migration lambda

Usage

It is possible to use either MigrationConstruct inside a stack, or use MigrationStack as an independent stack These constructs contain a state machine (Step Functions) and a DynamoDB table to store current state and versions.

They take as input a Lambda function which should perform migrations using a version number strictly increasing. Lambda input must extend: {} or { targetVersion: number } Lambda output must extend: { status: 'SUCCEEDED' | 'FAILED', targetVersion: number }

Example with target version defined by the migration runner itself

State machine input: {} The migration runner is responsible for determining the set of migrations to run.

Target version defined by the migration runner itself

Example with target version defined in the input

State machine input: { targetVersion: number } The migration runner is responsible for executing the correct migrations to reach the target version.

Target version defined in the state machine input

Migration runners

The migration runner is designed to be generic, but only Lambda Functions are available for now.

Versioning design

Versions must be integers starting from 0 (or firstVersion if defined in versioning settings). Once a set of migrations have been run, the target version is stored in the versioning table in two items:

  • Current status item (version is updated only if the migration is successful).

    {
      "pk": {
        "S": "_migration"
      },
      "sk": {
        "S": "CURRENT_STATUS"
      },
      // Latest status of the migration status machine
      "status": {
        "S": "SUCCEEDED"
      },
      // Version before the migration was run
      "previousVersion": {
        "N": "7"
      },
      // Version after the migration is successfully run
      "version": {
        "N": "8"
      },
      "metadata": {
        "M": {
          // State entered time (approximately the time when the record is saved)
          "date": {
            "S": "2023-09-01T15:24:12.666Z"
          },
          // State machine start execution time
          "startedAt": {
            "S": "2023-09-01T15:24:12.225Z"
          },
          // State machine that run the migration
          "stateMachineId": {
            "S": "arn:aws:states:[REGION]:[ACCOUNT ID]:stateMachine:[STATE MACHINE ID]"
          }
        }
      }
    }
  • Version item

    {
      "pk": {
        "S": "_migration"
      },
      "sk": {
        "S": "VERSION_9#2023-09-01T15:24:12.225Z#c6fe0617-f713-49a6-a52e-89f9e3ca6efa"
      },
      "status": {
        "S": "FAILED"
      },
      "version": {
        "N": "9"
      },
      "metadata": { ... }
    }

To search for migration data, it is possible to query on the migration partition key (_migration by default) and sort on the sort key:

  • "CURRENT_STATUS" for the current status
  • "VERSION_[VERSION ID]#[DATE ISO FORMAT]#[UUID]" to for a specific migration run

The versioning table supports a single-table design, that's why only one partition key is used for all migration records.

Advanced configuration

Versioning

It is possible to customize the versioning system:

  • provide your own DynamoDB table
  • change the name of the partition key, sort key
  • change the value of the partition key used to store versions