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

@hkarthi10/flagsmith-flight-check

v0.1.0

Published

Doctor + guard CLI for self-hosted Flagsmith Experimentation (Toggle Wars hackathon)

Readme

Flight Check for Flagsmith Unofficial community tool for Flagsmith; not affiliated with or endorsed by Flagsmith.

Self-hosted Flagsmith experiments can look healthy while their events never arrive. Flight Check probes the event pipeline on a local instance; Feature Health reporting is implemented per the documented webhook schema but not yet verified on a live instance.

Quick start

npx @hkarthi10/flagsmith-flight-check init
npx @hkarthi10/flagsmith-flight-check

Local setup lives in .env; FLAGSMITH_* environment variables are for CI only. In non-interactive shells, npx @hkarthi10/flagsmith-flight-check init --yes writes flight-check.json placeholders instead. The environment key is never printed; only its first four characters appear as ABCD….

Requires Node >=20.12.0; CI tests Node 20 and 22 (the .env loader uses process.loadEnvFile when available, with a parser fallback). The Flagsmith JS SDK used by the simulator is 12.6.0.

npx @hkarthi10/flagsmith-flight-check --ci     # no colors, no prompts, exit 1 on any FAIL
npx @hkarthi10/flagsmith-flight-check --json   # machine-readable results

The example workflow in examples/example-flight-check.yml runs npx @hkarthi10/flagsmith-flight-check --ci with values from GitHub secrets; copy it into .github/workflows/ to use it.

Docker image (untested)

The Docker image has not been tested against a host Flagsmith instance. A container needs host.docker.internal to reach Flagsmith on the host.

bash:

docker build -t flight-check .
docker run --rm --add-host=host.docker.internal:host-gateway -v "$PWD:/work" flight-check --ci

PowerShell:

docker build -t flight-check .
docker run --rm --add-host=host.docker.internal:host-gateway -v "${PWD}:/work" flight-check --ci

Sample output

$ npx @hkarthi10/flagsmith-flight-check
Flight Check doctor
Config: apiUrl=http://localhost:8000/api/v1 (.env) | eventsUrl=http://localhost:8000/api/ (.env) | envKey=ABCD… (.env)

[PASS] API URL: Using http://localhost:8000/api/v1
[PASS] API reachability: HTTP response from http://localhost:8000/api/v1.
[PASS] events URL: Events will be sent to http://localhost:8000/api/v1/events
[INFO] event timestamp: Reminder: events older than 10 days or more than 24h ahead are rejected.
[INFO] batch size: Reminder: batches over 2 MiB are rejected.
[PASS] environment key: Loaded (ABCD…).
[PASS] synthetic event round trip: Endpoint accepted the probe (HTTP 202) at http://localhost:8000/api/v1/events

Manual checklist (cannot be detected remotely):
  [ ] EXPERIMENTATION_ENABLED=true is set on the API (otherwise the Warehouse tab does not appear).
  [ ] Storage mode chosen: Flagsmith Postgres (evaluation only) or your own warehouse.
  [ ] SDK initialised with enableEvents: true and an identified user.
  [ ] Flags read via getExperimentFlag (plain getValue records no exposure).

RESULT: READY

Why this exists

I read the self-hosting docs and the SDK source, found that events default to Flagsmith Cloud and that a rejected key stops tracking, reproduced this against a local instance, then built the check.

Doctor failing on Cloud events URL

Doctor passing on local instance

What doctor checks

doctor resolves config in this order: CLI flags, FLAGSMITH_* environment variables (CI only), .env in the working directory, then flight-check.json (apiUrl, eventsUrl, envKey).

Uses the same events endpoint as the SDKs; event shape verified against the JS SDK 12.6.0 only. doctor only speaks HTTP to the events endpoint (POST <eventsUrl>v1/events with X-Environment-Key). It checks the API URL, GET reachability, the events URL, timestamp-window and batch-size rules as [INFO] reminders, then posts one synthetic event. The reminders state that events older than 10 days or more than 24h ahead are rejected and batches over 2 MiB are rejected; INFO does not count as a problem. If the events URL or API check fails, the probe is skipped. Failing checks print a fix hint and the last line is always RESULT: READY, RESULT: NOT READY (1 problem), or RESULT: NOT READY (N problems).

On a real self-hosted Flagsmith instance (Docker, local), the synthetic event got HTTP 202 and the Warehouse "Total events received" rose by exactly 1 per doctor run. Each doctor run adds one flight_check_probe event to the Warehouse. Pointing the events URL at Flagsmith Cloud returned HTTP 403 "Unknown environment key".

npx @hkarthi10/flagsmith-flight-check doctor --api-url http://localhost:8000/api/v1 \
  --events-url http://localhost:8000/api/ --env-key "$FLAGSMITH_ENV_KEY"

Plan and guard

plan

Rough frequentist sample-size and days-to-decision estimate; Flagsmith's results engine is Bayesian, so treat this as planning guidance only.

npx @hkarthi10/flagsmith-flight-check plan --baseline 0.05 --lift 0.2 --daily 400

guard

Evaluates a per-arm bad-event rate, then reports healthy/unhealthy to Feature Health through the Webhook provider.

npx @hkarthi10/flagsmith-flight-check guard --exposures 500 --bad 40 --arm Variant_1 --min 100 \
  --feature checkout_button --webhook-url "$FLAGSMITH_HEALTH_WEBHOOK" \
  --environment Development

--webhook-url may come from FLAGSMITH_HEALTH_WEBHOOK. guard --from-json <tally.json> evaluates every arm in a simulator tally; --error-arm <name> picks the arm reported to Feature Health. The Admin API kill sequence is not implemented against the real API; only the interface and the rollout-to-0%-then-pause ordering exist in src/guard.ts.

simulator

sim/simulate.mjs uses the real Flagsmith JS SDK 12.6.0 to enroll identities, record exposures, and send events.

node sim/simulate.mjs --env-key "$FLAGSMITH_ENV_KEY" --flag checkout_button \
  --users 300 --event purchase \
  --rates control=0.10,Variant_1=0.16 --errors Variant_1=0.40 --seed 42

Arm names in --rates and --errors are case-insensitive; unmatched keys produce a loud warning and the arms actually seen are printed after the run. --errors fires checkout_error events to demo a bad variant, --seed makes a run repeatable, and --json <path> writes a tally file for guard --from-json. --dry-run still calls getExperimentFlag and tallies locally, but initialises the SDK with enableEvents: false and no eventProcessorConfig, so no events are sent; on a live Docker instance it left the Warehouse total unchanged. examples/bad-tally.sample.json shows the tally shape, and sim/mock-server.mjs is a fake Flagsmith for offline testing.

Track 01 experiment

In simulated traffic, a redesigned checkout button (Variant_1) will raise purchase conversion from 10% to 18% versus control, reaching at least 95% win probability within a single 600-user run.

Metric: Purchase Conversion.

As of 28 Nov 2026 07:25 UTC, simulated traffic enrolled 600 users into a running experiment: 292 control and 308 Variant_1. The Flagsmith results page computed 8.6% vs 16.6%, +93.4% lift, 98% chance to be best, and a 95% credible interval of [6.0%, 180.8%]. The 98% result meets the hypothesis; observed rates (8.6% and 16.6%) differ from the simulated 10% and 18% by chance. The interval is wide because the sample is small. simulate --dry-run left the Warehouse total unchanged.

Experiment result

Analysis table

How Flagsmith is used

  • Self-hosted Docker: follow the official Docker guide:

    bash:

    curl -o docker-compose.yml https://raw.githubusercontent.com/Flagsmith/flagsmith/main/docker-compose.yml
    docker compose up

    PowerShell:

    curl.exe -o docker-compose.yml https://raw.githubusercontent.com/Flagsmith/flagsmith/main/docker-compose.yml
    docker compose up

    The UI is at http://localhost:8000, the SDK API at http://localhost:8000/api/v1/, and the events URL at http://localhost:8000/api/ (the SDK appends v1/events).

  • Experiments: the running "Checkout Button Final" experiment used the real arm names control and Variant_1.

  • SDK events: the simulator initialises with enableEvents: true and eventProcessorConfig.eventsApiUrl, identifies the user, calls getExperimentFlag, trackEvent, and flushEvents. Events POST to <eventsApiUrl>v1/events with the X-Environment-Key header and epoch-millisecond timestamps. Event shape is verified against the JS SDK 12.6.0 only.

  • Feature Health webhook: guard posts {feature, status, environment, reason} per the documented webhook schema; live verification is outstanding.

Limitations

  • The Feature Health webhook is not yet verified on a live instance.
  • The Admin API kill sequence is not implemented against the real API; only the interface and the rollout-to-0%-then-pause ordering exist in src/guard.ts.
  • The Docker image run against a host Flagsmith instance is not yet verified.
  • SDKs other than JS 12.6.0 are not yet verified.
  • guard evaluates numbers you give it (flags or a tally file); it does not read live Flagsmith results and cannot end an experiment.
  • doctor confirms the server accepted the probe; it does not read the Warehouse counter, so ingestion was confirmed by hand.

Development

npm ci && npm run build
npm test        # tsc + node:test (CLI checks and simulator helpers)

sim/ and scripts/ are repo-only demo tools that need git clone + npm ci && npm run build to run locally. On Windows you can also use flight-check.bat, which calls dist/src/cli.js. Never commit environment keys or webhook URLs; pass them via the config sources above at runtime. .gitignore excludes flight-check.json, .env, brain*.md and *-tally.json.

License

MIT