Auth Link Rail

Docs

Get the rail running locally or with Supabase in under 15 minutes.

Quickstart

Local (5 minutes)

npm install
wrangler d1 execute EIG_DB --file=sql/schema.sql --local --config ./wrangler.toml
npm run dev

Then in another terminal: npm run smoke to verify.

Supabase (15 minutes)

  1. Deploy the worker and point your rail domain (e.g. links.yourdomain.com) to it.
  2. Set allowed destination hosts so the rail can redirect to your Supabase project and app (e.g. ALLOWED_DEST_HOSTS=yourproject.supabase.co,yourapp.com or ALLOWED_DEST_HOST_SUFFIXES=.supabase.co).
  3. In your email flow, build the rail link instead of the raw confirmation URL: unique rid + #u= + encodeURIComponent(confirmationUrl). Use that link in the email body.

Example (Node): const railLink = `https://links.yourdomain.com/r/$${rid}#u=$${encodeURIComponent(destination)}`;

Deploy this site (suqram.com)

Cloudflare Pages: root directory site, build command npm run build, output directory out. Add custom domain suqram.com. Full steps in site/README.md.

Full documentation

Setup, allowed hosts, Supabase templates (Magic Link, Invite, Password Reset), troubleshooting, and demo mode are in the GitHub README.

Open full docs on GitHub →