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

@migration-script-runner/firebase

v0.2.0

Published

Migration Script Runner for Firebase Realtime Database

Downloads

128

Readme

Firebase Migration Script Runner

Test Coverage Status Quality Gate Status NPM Version NPM Downloads GitHub issues License Static Badge

Firebase Realtime Database implementation for Migration Script Runner (MSR Core). Provides version-controlled database migrations with built-in backup, rollback, and distributed locking for production deployments.

⚠️ UNSTABLE VERSION WARNING

Version v0.2.0 is currently unstable and not recommended for production use. The project is under active development and may receive significant updates. Please use with caution and test thoroughly before deploying to production environments.

What's New in v0.2.0

🎉 Major upgrade with production-ready features:

  • 🔒 Migration Locking - Prevent concurrent migrations in Kubernetes, Docker, and multi-instance deployments
  • ⬆️ MSR Core v0.8.1 - Latest core with bug fixes, handler access API, and improved locking lifecycle
  • 🔧 Type-Safe API - Full TypeScript support with generic type parameters
  • 🖥️ Lock Management CLI - Commands for monitoring and managing migration locks
  • 📚 Comprehensive Documentation - 300+ line locking guide with deployment examples
  • 🧪 Production Tested - Battle-tested in distributed environments

Upgrading from v0.1.x? See the Migration Guide.

Table of Contents

Features

  • 🔄 Version-Controlled Migrations: Track and apply database changes systematically
  • 🔒 Distributed Locking: Prevent concurrent migrations in Kubernetes, Docker, and multi-instance deployments
  • 💾 Automatic Backups: Built-in backup and restore functionality
  • ↩️ Rollback Support: Safely revert migrations with down() functions or backups
  • Checksum Validation: Detect modified migration files
  • 🎯 Firebase-Specific: Optimized for Firebase Realtime Database with atomic transactions
  • 🛠️ CLI & Programmatic: Use via command-line or integrate into your application
  • 🧪 Emulator Support: Test migrations locally with Firebase Emulator
  • 📊 Migration Status: Track applied, pending, and failed migrations
  • 🔐 Production-Ready: Battle-tested locking for distributed environments

Installation

npm install @migration-script-runner/firebase

Or with yarn:

yarn add @migration-script-runner/firebase

Quick Start

# Install
npm install @migration-script-runner/firebase

# Run migrations with inline credentials
npx msr-firebase migrate \
  --database-url https://your-project.firebaseio.com \
  --credentials ./serviceAccountKey.json

# Or use environment variables
export DATABASE_URL=https://your-project.firebaseio.com
export GOOGLE_APPLICATION_CREDENTIALS=./serviceAccountKey.json
npx msr-firebase migrate

👉 View Full Getting Started Guide for complete setup instructions, migration examples, and configuration options.

Key Features

🔒 Migration Locking for Distributed Environments

Perfect for Kubernetes, Docker Swarm, and auto-scaling deployments:

// msr.config.js
module.exports = {
  locking: {
    enabled: true,
    timeout: 600000  // 10 minutes
  }
};

Benefits:

  • Prevents race conditions in multi-pod deployments
  • Automatic lock expiration and cleanup
  • Force-release stuck locks with CLI commands
  • Works seamlessly across distributed instances

CLI Commands:

# Check lock status
msr-firebase lock:status

# Force-release stuck lock
msr-firebase lock:release --force

See Migration Locking Guide for details.

💾 Backup & Restore

Automatic backups before migrations:

# Create backup
msr-firebase backup

# List backups
msr-firebase list-backups

# Restore from backup
msr-firebase restore backup-1234567890.json

↩️ Safe Rollbacks

Multiple rollback strategies:

# Roll back last migration
msr-firebase down

# Roll back multiple migrations
msr-firebase down --steps 3

🧪 Firebase Emulator Support

Test migrations locally before deploying:

# Start emulator
firebase emulators:start --only database

# Run migrations against emulator
export FIREBASE_DATABASE_URL=http://localhost:9000
msr-firebase migrate

Documentation

Full documentation available at https://migration-script-runner.github.io/msr-firebase/

Quick Links

Getting Started:

Using MSR Firebase:

Writing Migrations:

How to obtain Service Account Key

To use the Firebase Admin SDK in non-Google environments, you need a service account key file.

Official Documentation: Initialize the SDK in non-Google environments

Quick Steps:

  1. Open https://console.firebase.google.com/project/{your_project_id}/settings/serviceaccounts/adminsdk (replace {your_project_id} with your actual project ID)
  2. Click Generate new private key button
  3. Download the JSON file and store it securely
  4. Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the file path

Migration from v0.1.x

Breaking Change: Package name changed from msr-firebase to @migration-script-runner/firebase.

For complete upgrade instructions, troubleshooting, and migration scenarios, see the Migration Guide.


📄 License

This project is licensed under the MIT License with Commons Clause and Attribution Requirements.

Based on Migration Script Runner by Volodymyr Lavrynovych.

Quick Summary:

  • ✅ Free to use in your applications (including commercial)
  • ✅ Free to modify and contribute
  • ❌ Cannot sell this adapter or Firebase-specific extensions as standalone products
  • 🔒 Firebase migration extensions require attribution

See the LICENSE file and NOTICE file for detailed examples and FAQ.


By Volodymyr Lavrynovych • Created in Ukraine 🇺🇦