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

@deadcode-uk/mutatio

v0.1.4

Published

A database migration solution for use with the libSQL client in Node

Readme

Mutatio

A database migration solution for use with the libSQL client in Node

Installation

npm install @deadcode-uk/mutatio

Peer Dependencies

Your project will need to include the following packages:

@libsql/client
dotenv

Environment Variables

Mutatio depends on the following environment variables being available:

DATABASE_URL            // required
DATABASE_AUTH_TOKEN     // required for hosted databases, e.g. Turso
DATABASE_ENCRYPTION_KEY // optional

These variables should be in a .env file in the project root directory, they are used to create a libSQL client when applying and reverting migrations

Opinionated

Mutatio has primarily been created for my own use in projects that use libSQL, so it is opinionated for consistency reasons

Database migrations will be created in a migrations directory in the project root

/migrations <- migrations live in this directory
/node_modules
/src
/readme.md
/package.json

Migration files are JavaScript modules that export two functions, apply and revert, both of which must return a Promise

import { sqlite } from "@deadcode-uk/archivum"

/**
 * @param {import("@libsql/client").Client} client
 * @returns {Promise<void>}
 */
export async function apply(client) {
    await client.execute(sqlite`
        CREATE TABLE example (
            id INTEGER PRIMARY KEY AUTOINCREMENT,
            created_at INTEGER DEFAULT (unixepoch()),
            updated_at INTEGER DEFAULT (unixepoch())
        )
    `)
}

/**
 * @param {import("@libsql/client").Client} client
 * @returns {Promise<void>}
 */
export async function revert(client) {
    await client.execute(sqlite`
        DROP TABLE IF EXISTS example
    `)
}

You can do whatever you need to do in those functions to apply migrations and revert migrations

Within your database, a table called migrations will be created the first time migrations are applied, and will be used to track which migrations have been applied

Create a Migration

Use the following command to create a migration, where <migration-name> is the name of the migration to create:

npx mutatio create <migration-name>

For example, npx mutatio create add-core-tables would create a file similar to this:

/migrations/20250706123456-add-core-tables.js

File names can contain alpha-numeric characters and dashes. The name will be converted to lowercase automatically, dashes will be removed from the start and end of the name, and multiple dashes will be collapsed

An error will be thrown if the name is invalid or if the generated filename conflicts with an existing one

Apply Migrations

Use the following command to apply pending migrations:

npx mutatio apply

Revert a Migration

Use the following command to revert the latest batch of migrations that were applied with the apply command:

npx mutatio revert

Post Install

You will more than likely want to apply migrations after the npm install command has been run, either locally or during a deployment. That is easy enough to setup in your package.json file:

{
    "scripts": {
        "postinstall": "npx mutatio apply",
        ...
    }
}