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

@flaghoist/server

v0.4.1

Published

Hono app factory for Flaghoist: OFREP evaluate, admin CRUD, and pluggable auth.

Readme

@flaghoist/server

The Flaghoist server, as a function you call. It returns a Hono app, so it runs on Cloudflare Workers, Node, Bun, Deno, or anywhere else Hono runs.

Most people never install this directly. The flaghoist CLI generates a Worker that uses it. Reach for it when you want to compose the server yourself, add middleware, or plug in your own auth.

npm install @flaghoist/server @flaghoist/adapter-cloudflare-kv
import { cloudflareKV } from '@flaghoist/adapter-cloudflare-kv'
import { apiKey, bearerToken, createFlagServer } from '@flaghoist/server'

export default createFlagServer((env) => ({
  storage: cloudflareKV(env.FLAGS),
  auth: {
    admin: bearerToken(env.ADMIN_TOKEN),
    read: apiKey(env.READ_API_KEY),
  },
}))

What it serves

  • POST /ofrep/v1/evaluate/flags and /flags/:key, the OFREP read path, behind the read API key.
  • /api/v1/flags, the admin CRUD API, behind admin auth, with an OpenAPI 3.1 document at /api/v1/openapi.json. Also covers archive/restore, JSON export/import, and the audit log.
  • /api/v1/webhooks, HMAC-signed HTTP callbacks fired on flag changes.
  • /api/v1/environments, when environments is configured: named environments (production, staging, ...) sharing one storage backend, with per-environment read keys via apiKeys().
  • /admin, the dashboard, when you pass one.

The dashboard

The prebuilt admin UI ships in the same package, on its own entry point:

import { dashboardHtml } from '@flaghoist/server/dashboard'

createFlagServer({ storage, auth, dashboard: dashboardHtml })

It lives on a subpath rather than the package root, so a deploy that does not want the UI never pulls the HTML into its bundle. It is a single self contained file with the fonts and styles inlined, and it makes no requests to anything outside your server.

Auth

bearerToken, apiKey, apiKeys and oidc ship with it. apiKeys maps one read secret per environment (apiKeys({ production: '...', staging: '...' })) instead of a single shared one, so a leaked staging key can't read production. Auth is an interface, so if none of those fit, pass your own function.

Accounts

Pass users to turn on named accounts with roles, so people sign in as themselves instead of sharing the admin token. It needs a pepper, a secret of at least 32 characters read from the environment, and takes optional single sign-on, two-factor, email and invite settings.

createFlagServer((env) => ({
  storage,
  auth: { admin: bearerToken(env.ADMIN_TOKEN), read: apiKey(env.READ_API_KEY) },
  users: { pepper: env.AUTH_PEPPER },
}))

Accounts live in the same storage as your flags. npm create flaghoist turns this on by default, generates the pepper for you, and keeps it in a git-ignored .env.

Environments

Pass environments: ['production', 'staging', ...] to partition flags without a second deploy or a second database: the same key can be on in staging and off in production, each with its own audit trail. The default environment uses bare storage keys, so turning this on for an existing deployment needs no migration. See docs.flaghoist.dev for the full picture.

Webhooks

Manage endpoints under /api/v1/webhooks (or the dashboard's Webhooks page). Each delivery is a signed POST: X-Flaghoist-Signature: sha256=<hmac> over the raw body, keyed by a secret generated per webhook. Fire-and-forget with a 10s timeout and no retries, so treat it as a notification, not a guaranteed log.

Status

Pre-alpha, built and maintained by one person. The API can still change without notice, and production use is not recommended yet. If you try it and something breaks, an issue is genuinely useful.

Apache-2.0. Part of Flaghoist.