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

@indy-center/identity

v1.0.0

Published

Centralized identity Worker for `*.flyindycenter.com`. Wraps VATSIM Connect OAuth, mints session cookies on `.flyindycenter.com`, exposes typed RPC over Cloudflare service bindings.

Readme

identity

Centralized identity Worker for *.flyindycenter.com. Wraps VATSIM Connect OAuth, mints session cookies on .flyindycenter.com, exposes typed RPC over Cloudflare service bindings.

Tests and Verification License: MIT

HTTP surface

  • GET /login?return_url=… starts the OAuth flow (browser).
  • GET /login/callback?code=…&state=… is the OAuth callback from VATSIM (browser).
  • GET /healthz is the liveness check.

Session validation, role management, profile updates, and logout all go over RPC, not HTTP. Consumer Workers call env.IDENTITY.validateSession(token), env.IDENTITY.invalidateSession(token), etc.

Why no HTTP surface for those? RPC over service bindings is in-process — no network round trip, no JSON serialization, no CORS, typed errors propagating cleanly. For Workers consuming identity, that's strictly better than HTTP. We've considered adding a thin HTTP layer (e.g. GET /api/me, POST /api/logout) wrapping the same internal functions the RPC methods use, and it's the right answer the moment a non-Worker consumer shows up — browser-only static site, mobile app, third-party tool — but until then we stay RPC-only. If you need this, see the deferred-option note in WIKI_APP_DESIGN.md.

Project layout

  • src/users/, src/sessions/, src/roles/: domain modules. Plain async functions over a Drizzle DB. src/index.ts delegates RPC methods straight to these.
  • src/client/: the consumer-facing surface. Types (User, SessionPayload, AttributePatch, VatsimProfile), the IdentityRpc interface, and IdentityError. Other Workers import from here so they only see the public contract, not the implementation.
  • src/migrations/: D1 migrations, applied automatically on deploy.

Local development

npm install
npm run db:migrate:local   # apply D1 migrations to the local sqlite
npm run dev                # wrangler dev on http://localhost:8787
npm test                   # vitest with workers pool
npm run cf-typegen         # regenerate worker-configuration.d.ts after wrangler.jsonc changes

For OAuth testing locally, register a VATSIM Connect dev client with redirect URI http://localhost:8787/login/callback, then copy .dev.vars.example to .dev.vars and fill in the credentials.

When COOKIE_DOMAIN=localhost, identity also accepts loopback return_url values (http://localhost:*, http://127.0.0.1:*, http://[::1]:*) so dev consumer apps can complete the OAuth flow against the local worker. Production stays strict.

If the local D1 gets tangled up:

npx wrangler d1 delete identity_db
npx wrangler d1 create identity_db
# Copy the new database_id into wrangler.jsonc
npm run db:migrate:local

Tests

npm test
npm run typecheck

Deployment

Pushing to main triggers .github/workflows/build-and-deploy.yml, which applies pending D1 migrations and then deploys the Worker. Requires a CLOUDFLARE_WORKERS_API_KEY repository secret with Workers Scripts:Edit and D1:Edit permissions.

One-time setup per environment:

wrangler d1 create identity_db
# copy the database_id into wrangler.jsonc
wrangler secret put CONNECT_CLIENT_ID
wrangler secret put CONNECT_CLIENT_SECRET

Consumer apps

Other Workers consume identity via a service binding. In their wrangler.jsonc:

"services": [
  { "binding": "IDENTITY", "service": "identity" }
]

Type the binding against IdentityRpc (from src/client/api.ts) so consumers only see the public surface:

import type { IdentityRpc } from './identity-client';

type Env = {
	IDENTITY: Service<IdentityRpc>;
};

const session = await env.IDENTITY.validateSession(cookieToken);
if (!session) return new Response('unauthorized', { status: 401 });
// session.userId is the canonical UUID; session.roles is string[]
const user = await env.IDENTITY.getUserById(session.userId);

Disclaimer

We are not affiliated with the FAA or any aviation governing body. This software is for flight simulation use on the VATSIM network.