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

firescope

v0.1.1

Published

A convention-first framework for Firebase apps, functions, hosting, environments, and deploys.

Readme

Firescope

Firescope is a convention-first framework for Firebase apps. It keeps Firebase's power, but removes the repetitive setup: admin SDK bootstrapping, function exports, generated Firebase config, local env loading, emulator wiring, project connection, and deploy commands.

Quick Start

npx firescope@latest init my-app
cd my-app
npm install
npm run dev

Deploy:

npm run connect
npm run deploy

App Shape

my-app/
  firescope.config.ts
  src/
    db.ts
    functions/
      hello.ts
      users/
        create.ts
  public/
  .env.local

Config

import { defineConfig } from "firescope"

export default defineConfig({
  project: process.env.FIRESCOPE_PROJECT,
  region: "us-central1",
  runtime: "nodejs20",
  functions: {
    source: "src/functions",
  },
  hosting: {
    public: "public",
    cleanUrls: true,
  },
})

HTTP Function

import { http } from "firescope/functions"
import { data } from "../db.js"

export default http(async ({ scope, res }) => {
  const snapshot = await data.collection("users", scope.db).limit(10).get()

  res.json({
    users: snapshot.docs.map((doc) => ({ id: doc.id, ...doc.data() })),
  })
})

Typed Firestore

Define your data model once. Firescope adds type-safe collections and docs without adding runtime validation or abstraction overhead.

import { defineFirestoreSchema } from "firescope"

export type AppDb = {
  users: {
    displayName: string
    createdAt: string
  }
  audit: {
    type: "user.created"
    userId: string
    createdAt: string
  }
}

export const data = defineFirestoreSchema<AppDb>()
await data.collection("users").add({
  displayName: "Ada",
  createdAt: new Date().toISOString(),
})

Collection names and document shapes are checked by TypeScript. data.collection("userz") and missing required fields fail at compile time.

Callable Function

import { callable } from "firescope/functions"

export default callable<{ name: string }>(async ({ data }) => {
  return { message: `Hello ${data.name}` }
})

Firestore Trigger

import { firestore } from "firescope/functions"
import { data } from "../db.js"

export default firestore.document("users/{userId}").onCreate(async ({ event, scope }) => {
  await data.collection("audit", scope.db).add({
    type: "user.created",
    userId: event.params.userId,
    createdAt: new Date().toISOString(),
  })
})

event.params.userId is inferred from "users/{userId}". Rename the path param and TypeScript forces the handler to follow.

CLI

firescope init      scaffold an app
firescope connect   login, select project, write config, enable APIs
firescope dev       build and start Firebase emulators
firescope build     generate Firebase-compatible output
firescope deploy    build and deploy
firescope doctor    validate local setup

Generated apps install firebase-tools locally, so npm run dev works without a global Firebase CLI. Local dev uses the demo project demo-firescope until you run firescope connect. firescope connect can also use gcloud to enable required Firebase/GCP APIs automatically.

What Firescope Generates

firebase.json
.firebaserc
firestore.rules
storage.rules
.firescope/
  functions/
    package.json
    src/index.ts
    lib/index.js

The generated Functions package is what Firebase deploys. The source app stays clean.

Firescope bundles its own runtime helpers into the generated Functions output and leaves Firebase packages external. That keeps deploy output self-contained while preserving Firebase's runtime packages.

Firescope also writes safe default firestore.rules and storage.rules files when they are missing. The defaults are closed (allow read, write: if false) so emulators start without accidentally opening production data. Customize those files when your client app needs direct Firestore or Storage access.

Function Discovery

Every supported source file under src/functions is treated as a Firebase function export by default:

src/functions/hello.ts          -> hello
src/functions/users/created.ts  -> usersCreated

Use underscore-prefixed files or folders for local helpers that should not become functions:

src/functions/_shared/audit.ts
src/functions/users/_helpers.ts

Environment Files

Firescope loads env files in this order, with later files winning over earlier files:

.env
.env.local
.env.<mode>
.env.<mode>.local

Existing shell environment variables are preserved by default. Pass override: true to loadEnv when file values should replace existing process values.

Local Credentials

Do not commit service account JSON files. Prefer emulators locally and Firebase runtime credentials in production.

Optional local admin credential support exists for advanced cases:

FIRESCOPE_SERVICE_ACCOUNT=./secrets/service-account.json
FIRESCOPE_STORAGE_BUCKET=my-app.appspot.com

Current Status

This is the first working framework version. It is intentionally small: conventions, CLI, runtime scope, typed Firestore helpers, typed function wrappers, generated Firebase config, generated deploy output, and onboarding checks.

Release

Publish to npm first so npx firescope@latest init my-app can install the CLI:

npm login
npm publish --access public

The package name firescope must be available on npm. If it is published successfully, users can run:

npx firescope@latest init my-app

Releases are created from version tags:

git tag v0.1.1
git push origin v0.1.1

The release workflow runs type checks, tests, builds an npm tarball, and publishes a GitHub release.

GitHub Pages

The project page is served from docs/ on main: https://maskjelly.github.io/firescope/