Railhead
alphine
HOBBYOP

21 days ago

Description: Next.js SaaS starter with auth, Stripe billing, email, and a worker.

Category: Starters

Full feature breakdown:

Stack: Next.js 15 (App Router) · Postgres via Drizzle ORM · Better Auth (email/password + magic link) · Stripe Checkout + webhooks · Resend + React Email · BullMQ on Redis

Auth (Better Auth): Email/password sign-up and sign-in, plus a magic-link flow. Better Auth never sends email itself — sendMagicLink enqueues a job and the worker (via Resend) sends it, keeping the web request fast.

Billing: /api/checkout creates a Stripe Checkout Session (monthly or annual plan) and redirects to Stripe. /api/webhooks/stripe verifies the signature against the raw body and returns 200 immediately — it never touches the database itself.

Why a separate worker service: Stripe webhooks time out after 5 seconds. Instead of doing the real work inline, the web app pushes a job onto a Redis queue (BullMQ) and a dedicated worker service — a long-running process with no public port — does the actual work (upserting the subscription, sending the receipt email). This is the one thing a serverless/Vercel-style starter can't one-click: a process that outlives a single request.

Dashboard: Server component that redirects unauthenticated users to /sign-in, otherwise shows the signed-in user's live subscription status from the database.

Admin: /admin/jobs lists dead-letter (permanently failed) queue jobs for manual inspection.

Testing: 19 Vitest unit tests covering job-payload validation, Stripe webhook signature verification, and subscription-upsert mapping — no real database, Redis, or Stripe account needed.

Deploy: Full stack (Postgres, Redis, web, worker) declared as code in .railway/railway.ts, applied with railway config apply. Reference variables wire DATABASE_URL/REDIS_URL automatically from the plugins.

License: LGPL-3.0-or-later — free, no paid tier. The only monetization is Railway's own template kickback program, a share of what Railway bills, paid to the maintainer.

Live demo: railhead.up.railway.app

Recent updates: redesigned landing page (dark theme, serif headline, pricing cards), fixed the worker's deploy source so git push triggers real rebuilds, and TEMPLATE.md now matches Railway's Template Hub structure.

URL: https://railway.com/deploy/railhead

0 Replies

Welcome!

Sign in to your Railway account to join the conversation.

Loading...