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

flamecache

v2.0.0

Published

Redis-style caching layer over the Firebase Realtime Database REST API. Zero dependencies. Runs in Cloudflare Workers, Deno, Bun, Node and browsers.

Readme

Flamecache

npm version License: MIT

A Redis-style cache for Firebase Realtime Database, built on plain fetch. No dependencies. Runs in Cloudflare Workers, Deno, Bun, Node 20+ and browsers.

Install

npm install flamecache

Quick start

import { createCache, serviceAccountAuth } from 'flamecache';

const cache = createCache({
  databaseUrl: 'https://my-app-default-rtdb.firebaseio.com',
  auth: serviceAccountAuth(process.env.FIREBASE_SERVICE_ACCOUNT!), // key file JSON
});

await cache.set('user:123', { name: 'Ada' }, 600); // ttl in seconds
await cache.get('user:123'); // { name: 'Ada' }
await cache.incr('views:home'); // atomic, returns the new value
await cache.wrap('posts', () => loadPosts(), 300); // cached read-through

In the browser

Pass the signed-in user's Firebase ID token:

const cache = createCache({
  databaseUrl: 'https://my-app-default-rtdb.firebaseio.com',
  auth: ({ forceRefresh }) => user.getIdToken(forceRefresh),
  rootPath: 'flamecache/shared',
  readOnly: true,
});

Deploy database.rules.json first. It lets browsers read a cache your server writes, and optionally keep their own validated entries. See Security rules.

API

| Method | What it does | | ----------------------------------------------------- | ------------------------------------------------- | | get(key), mget(keys) | Read values; null when missing or expired | | set(key, value, ttl?), mset(entries, ttl?) | Write values; mset is atomic | | del(key), mdel(keys), clear() | Delete; mdel is atomic | | has(key) | true when present and not expired | | incr(key, by?, ttl?), decr(key, by?, ttl?) | Atomic counters; return the new value | | expire(key, ttl), touch(key, ttl?), getTtl(key) | Change or read the expiry | | wrap(key, fn, ttl?) | Return the cached value, or run fn and cache it | | pull(key) | Read and delete in one atomic step | | keys() | List the keys under the root | | sweep() | Delete expired entries; run it from a cron | | scope(path) | A cache rooted at a sub-path |

Failures throw a FlamecacheError with a code such as permission-denied. wrap is the exception: if the cache fails it still returns fn()'s result.

Options

| Option | Default | Description | | --------------- | -------------- | -------------------------------------------- | | databaseUrl | required | Your Realtime Database URL | | auth | none | Token, or ({ forceRefresh }) => token | | rootPath | 'flamecache' | Where entries are stored | | ttl | 3600 | Default expiry in seconds; 0 never expires | | readOnly | false | Reject writes, for browser clients | | valueEncoding | 'json' | Use 'string' in rule-validated tiers | | disableCache | false | Make every call a miss | | debug | false | Log requests, with tokens redacted |

Timeouts, retries, App Check and a custom fetch are covered in the guide.

Docs

Development

npm install
npm test        # offline, no Firebase project needed
npm run lint && npm run typecheck && npm run build

npm run test:integration and npm run bench use a real database. Copy .env.example to .env to configure them.

License

MIT © Anish Roy