---
title: "Deploy Railhead"
description: "Next.js SaaS starter with auth, Stripe billing, email, and a worker."
category: "Starters"
url: https://railway.com/deploy/railhead
---

# Deploy Railhead

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

**[Deploy Railhead on Railway](https://railway.com/template/railhead)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/railhead/manifest.json

- **Creator:** alphine's Projects
- **Category:** Starters

## Template content

### worker

- **Source:** https://github.com/Alphine/Railhead
- **Start command:** `npm run start --workspace=apps/worker`

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### web

- **Source:** https://github.com/Alphine/Railhead
- **Start command:** `npm run start --workspace=apps/web`
- **Health check:** /api/health
- **Public domain:** Yes

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

## Documentation

# Deploy and Host Railhead on Railway

Railhead is a batteries-included SaaS starter: Next.js, Postgres, Better
Auth, Stripe billing, Resend email, and a Redis-backed worker, wired
together and ready to deploy. Most "SaaS starter" templates stop at auth
and a database — Railhead goes the rest of the way, because Stripe
Checkout and webhooks, transactional email, and a real background worker
are the parts everyone rebuilds from scratch and nobody wants to.

## About Hosting Railhead

This template deploys two Railway services (a Next.js app and a BullMQ
worker) plus a Postgres and a Redis plugin, wired together with
reference variables. The `web` service handles the UI, Better Auth
sign-up/sign-in, and Stripe Checkout; the `worker` service is a
dedicated, no-public-port BullMQ consumer that sends transactional email
and processes Stripe webhook events asynchronously, so a webhook is
always acknowledged inside Stripe's 5-second window regardless of
downstream load.

## Why Deploy Railhead on Railway?

Railway is a singular platform to deploy your infrastructure stack.
Railway will host your infrastructure so you don't have to deal with
configuration, while allowing you to vertically and horizontally scale
it. Deploying Railhead on Railway means every piece — the app, the
worker, Postgres, and Redis — lives on one dashboard with private
networking between them already wired in, and the worker service runs
as a genuine long-lived process, which is the one thing a
serverless/Vercel-style starter can't one-click.

## Common Use Cases

- Launching a subscription SaaS product without rebuilding auth and
  billing from scratch.
- A starting point for an indie developer or small team who wants
  Stripe Checkout and a background worker wired in from day one.
- A reference implementation of "ack fast, process async" for Stripe
  webhooks, worth reading even if you don't deploy it.

## Dependencies for Railhead Hosting

- A [Stripe](https://stripe.com) account (test or live) for
  `STRIPE_SECRET_KEY`, `STRIPE_WEBHOOK_SECRET`, and the two price IDs.
- A [Resend](https://resend.com) account for `RESEND_API_KEY` and a
  verified `RESEND_FROM_EMAIL`.

Both are optional at deploy time — the template boots without them —
but sign-up and checkout need them filled in to actually work.

### Deployment Dependencies

- [Next.js](https://nextjs.org) 15 (App Router)
- [Drizzle ORM](https://orm.drizzle.team) on Postgres
- [Better Auth](https://www.better-auth.com)
- [Stripe](https://stripe.com) Checkout + webhooks
- [Resend](https://resend.com) + React Email
- [BullMQ](https://docs.bullmq.io) on Redis

Full architecture, data model, and the system design document behind
these decisions live in the [GitHub repo](https://github.com/Alphine/Railhead).
Railhead is free and open source under
[LGPL-3.0](https://github.com/Alphine/Railhead/blob/main/LICENSE) — fork
it and build a proprietary product on top; only changes to Railhead
itself need to stay open.


## Similar templates

- [open-excalidraw](https://railway.com/deploy/open-excalidraw) — Self-hostable collaborative drawing built on Excalidraw
- [caring-vibrancy](https://railway.com/deploy/caring-vibrancy) — Deploy and Host caring-vibrancy with Railway
- [Appsmith](https://railway.com/deploy/appsmith-1) — Low-code platform for internal tools, dashboards, and admin panels.

Open this page in a browser: https://railway.com/deploy/railhead
