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

@firemap/cli

v0.1.1

Published

Firemap CLI - Generate Cloud Functions, indexes, and security rules from decorators

Readme

@firemap/cli

Code generators for Firestore — generates Cloud Functions, indexes, and security rules from your @firemap/sdk decorators.

Installation

npm install -g @firemap/cli

Requirements

  • Node.js 18+
  • TypeScript 5.0+ project with @firemap/sdk decorators
  • A Pro or Team license key from firemap.dev

Configuration

// firemap.config.js
export default {
  models: ["src/models/**/*.ts"],
  outDir: "./generated",
  licenseKey: "fmk_pro_...", // or use FIREMAP_LICENSE_KEY env var
};

License Key

There are three ways to provide your license key:

# Option 1: Environment variable
export FIREMAP_LICENSE_KEY="fmk_pro_..."

# Option 2: Config file (firemap.config.js)
export default {
  licenseKey: "fmk_pro_...",
  models: ["src/models/**/*.ts"],
};

# Option 3: .firemaprc (JSON)
{ "licenseKey": "fmk_pro_..." }

Get your key at firemap.dev/settings under API Keys.

Commands

# Generate all files (functions, indexes, rules)
firemap generate:all

# Individual generators
firemap generate:functions   # Cloud Functions for denormalization sync
firemap generate:indexes     # firestore.indexes.json
firemap generate:rules       # firestore.rules

# Preview without writing files
firemap generate:rules --dry-run

# Verbose output
firemap generate:all --verbose

# Machine-readable JSON output
firemap generate:indexes --json

Export Schema

Export your decorator-defined schema as JSON for the web Schema Designer.

# Export schema metadata as JSON
firemap export

# Pipe to clipboard
firemap export | pbcopy          # macOS
firemap export | Set-Clipboard   # Windows (PowerShell)

# Save to file
firemap export > schema.json

Denormalization

The killer feature of Firemap is automated denormalization sync. Define which fields to sync using @SyncTo and @DenormalizedFrom decorators in the SDK, then let the CLI generate the Cloud Functions that keep everything consistent.

Schema decorators (defined in your code with @firemap/sdk):

@Collection('users')
class User extends BaseModel {
  @SyncTo('posts', { field: 'authorName', sourceField: 'name' })
  @Field({ type: 'string' })
  name!: string;

  @SyncTo('posts', { field: 'authorAvatar', sourceField: 'avatarUrl' })
  @Field({ type: 'string' })
  avatarUrl!: string;
}

@Collection('posts')
class Post extends BaseModel {
  @Field({ type: 'reference' })
  authorRef!: string;

  @DenormalizedFrom('users', { fields: ['name', 'avatarUrl'] })
  @Field({ type: 'string' })
  authorName!: string;

  @DenormalizedFrom('users', { fields: ['name', 'avatarUrl'] })
  @Field({ type: 'string' })
  authorAvatar!: string;
}

Run the generator:

firemap generate:functions

Generated output (generated/functions/syncUsersToPost.ts):

import { onDocumentUpdated } from "firebase-functions/v2/firestore";
import { getFirestore } from "firebase-admin/firestore";

const db = getFirestore();

export const syncUsersToPosts = onDocumentUpdated("users/{docId}", async (event) => {
  const before = event.data?.before?.data();
  const after = event.data?.after?.data();
  if (!before || !after) return;

  // Only run if synced fields actually changed
  const nameChanged = before.name !== after.name;
  const avatarChanged = before.avatarUrl !== after.avatarUrl;
  if (!nameChanged && !avatarChanged) return;

  // Find all posts referencing this user
  const snapshot = await db
    .collection("posts")
    .where("authorRef", "==", event.params.docId)
    .get();

  if (snapshot.empty) return;

  // Batch-update denormalized fields
  const batch = db.batch();
  for (const doc of snapshot.docs) {
    const updates: Record<string, any> = {};
    if (nameChanged) updates.authorName = after.name;
    if (avatarChanged) updates.authorAvatar = after.avatarUrl;
    batch.update(doc.ref, updates);
  }

  await batch.commit();
});

This is the boilerplate you would have to write and maintain by hand for every denormalization relationship. With Firemap, you declare it once and the CLI generates it -- type-safe, batched, and only triggered when the synced fields actually change.

What Gets Generated

Cloud Functions (generate:functions)

Creates Cloud Functions v2 that keep denormalized fields in sync, based on @SyncTo and @DenormalizedFrom decorators. Handles change detection, batched writes, and supports multiple sync targets per field.

Indexes (generate:indexes)

Generates firestore.indexes.json from @Index decorators for composite queries.

Security Rules (generate:rules)

Generates firestore.rules from @Rules, @AuthRequired, @AuthOwner, and @PublicRead decorators.

Links

License

Proprietary — requires a Pro or Team subscription.