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

@galatiq/demo-gateway-middleware

v1.0.0

Published

Vercel Edge Middleware that admits only requests from Galatiq's demo-gateway via a shared header secret.

Readme

@galatiq/demo-gateway-middleware

Vercel Edge Middleware that admits only requests from Galatiq's demo-gateway via a shared header secret. Drop it into any Vercel-hosted Galatiq client demo to gate the public *.vercel.app URL behind gateway auth.

Install

npm install @galatiq/demo-gateway-middleware

Use

Create middleware.js (or middleware.ts) at the root of the Vercel project:

export { default, config } from '@galatiq/demo-gateway-middleware';

That's the whole file. Both default (the handler) and config (the matcher) come from the package — Vercel auto-discovers them.

Configure

Set these env vars in the Vercel project — Settings → Environment Variables:

| Name | Value | Required | |---|---|---| | GATEWAY_SECRET | A long random string. Must match the value stored on this demo's row in demo-gateway's admin UI. Generate with openssl rand -hex 32. | ✅ | | GATEWAY_URL | Override the default gateway URL. Defaults to https://galatiq-demo-gateway-production.up.railway.app. | optional |

Apply both to Production (and Preview if you want gating there).

How it works

Browser ──► demo-gateway (auth)
              │ proxy fetch + x-demo-gateway-secret: <secret>
              ▼
          *.vercel.app ──► middleware verifies header ──► demo

Browser ──► *.vercel.app directly  ──► middleware sees no header ──► 302 to /login
  • Request carries x-demo-gateway-secret: <secret> matching GATEWAY_SECRET → request passes through to the demo.
  • Header missing or wrong → 302 redirect to ${GATEWAY_URL}/login.
  • GATEWAY_SECRET env var not set → middleware fails closed with a 503 Demo gateway not configured. The demo is never served unprotected.

The matcher gates every path except Vercel internals (/_vercel/*) and /favicon.ico. That includes static assets (/js/*, /css/*, etc.) and API routes (/api/*) — everything goes through gateway auth.

Rotating the secret

  1. Generate a new value: openssl rand -hex 32.
  2. Update GATEWAY_SECRET in Vercel → redeploy the demo.
  3. Update the demo's row in demo-gateway's admin UI → Save Changes.

If you update Vercel first, gateway requests carrying the old secret get rejected until you also update the admin UI. Plan for ~30 seconds of "Demo unavailable" during a rotation, or update the admin UI first.

Versioning

Standard SemVer:

  • major — change to the wire protocol (header name, redirect target shape) or breaking API change for consumers.
  • minor — new optional behavior, backwards compatible.
  • patch — bug fixes.

License

MIT