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

@checkgate/edge

v0.1.22

Published

Runtime-agnostic edge evaluator for Checkgate — fetch a flag snapshot, cache it with TTL + stale-while-revalidate, and evaluate at the edge (Cloudflare Workers, Deno Deploy, Fastly, Vercel Edge, Fly.io).

Downloads

435

Readme

A tiny, runtime-agnostic edge evaluator. It owns the edge concern — pull a flag snapshot from your Checkgate server, cache it with a TTL and optional stale-while-revalidate, survive origin outages by keeping the last-known-good snapshot — and delegates the actual evaluation to an injected engine. In production that engine is the shared @checkgate/web WebAssembly core, so edge evaluation is identical to every other Checkgate SDK. No re-implemented rule / rollout / segment / prerequisite logic to drift.

Zero dependencies. Works anywhere fetch exists.

Install

npm install @checkgate/edge

Use

import { CheckgateEdge } from '@checkgate/edge'
import { createWasmCore } from '@checkgate/web/core'
// Wrangler compiles a .wasm import into a WebAssembly.Module. On Node (Next.js
// server) and in the browser, call createWasmCore() with no argument instead.
import wasmModule from '@checkgate/web/dist/checkgate_bg.wasm'

const edge = new CheckgateEdge({
  serverUrl: 'https://flags.your-domain.com',
  sdkKey: env.CHECKGATE_SDK_KEY,          // environment-scoped SDK key (Bearer)
  core: await createWasmCore(wasmModule), // the WASM evaluation engine
  ttlSeconds: 30,                         // re-fetch the snapshot at most this often
  staleWhileRevalidateSeconds: 60,        // serve stale + refresh in background
})

// On each request (fast: in-memory on a warm isolate):
await edge.ensureFresh({ waitUntil: (p) => ctx.waitUntil(p) })
const showIt = edge.isEnabled('new-homepage', userKey)
const color  = edge.getValue('checkout-color', userKey, {}, 'blue')

API

| Member | Description | |---|---| | new CheckgateEdge({ serverUrl, sdkKey, core, ttlSeconds?, staleWhileRevalidateSeconds?, fetchImpl?, now?, snapshotPath? }) | Construct. core is the injected engine. | | refresh() | Fetch the snapshot and load it into the core. Concurrent calls are de-duplicated. Fails open to last-known-good. | | ensureFresh({ waitUntil? }) | Load if never loaded; serve from cache within the TTL; serve stale + background-refresh within the SWR window; block-refresh beyond it. | | isEnabled(key, userKey, attrs?) / getValue(key, userKey, attrs?, default?) / getVariant(key, userKey, attrs?) | Delegate to the core. | | isLoaded / flagCount / lastLoadedAt / ageMs() | Introspection. |

Design

  • Fail-open. If a refresh can't reach origin, the previous snapshot keeps serving — an origin blip never takes your flags down. The first load has nothing to fall back to, so it surfaces the error.
  • De-duplicated refresh. A burst of concurrent ensureFresh() calls triggers at most one snapshot fetch.
  • Injected core, fetch, and clock. That's what makes it dependency-free and fully unit-tested in plain Node (npm test) — no WASM build or edge runtime required to verify the caching/resilience logic.

Examples

  • examples/cloudflare-worker — per-request edge evaluation on Cloudflare Workers, with a Cron Trigger keeping the snapshot warm.
  • examples/fly — deploy the full Checkgate server multi-region on Fly.io.

Part of Checkgate — the self-hosted feature-flag platform.