Deploy SaaS Starter with React, Hono and Better Auth

Get accounts and organisations with Turborepo, Drizzle and Postgres

Deploy SaaS Starter with React, Hono and Better Auth

/var/lib/postgresql/data

Deploy and Host SaaS Starter with React, Hono and Better Auth on Railway

Start with a React SPA on Vite, a separate Hono API and Better Auth accounts and organisations. This open source TypeScript starter includes Drizzle on Postgres and shared Zod contracts in a Turborepo monorepo. I start my SaaS products from it. Read the starter write-up or get the source on GitHub.

About Hosting SaaS Starter with React, Hono and Better Auth

Deploy with no input: the template creates Postgres, server and web on one private network, generating the database password and BETTER_AUTH_SECRET. Caddy serves the SPA from web, the only public domain, and proxies requests to the private Hono API. Auth cookies stay first-party on one HTTPS origin, with no CORS setup. Before every deploy, server runs database migrations; /health/ready checks database connectivity. Sign-up, sign-in, sessions and organisations work immediately. Add the Loops variables for verification, password reset and invitation emails; these cannot be delivered until configured. Add PostHog variables on server and web for analytics. Redeploy web after changing its compiled-in analytics variables.

Common Use Cases

  • SaaS products: accounts and organisations; no billing or payments.
  • React SPAs: Vite frontend with a separate API.
  • Coding agents: AGENTS.md and a copyable setup prompt.

Dependencies for SaaS Starter with React, Hono and Better Auth Hosting

  • Postgres: Postgres 18 with SSL and a volume.
  • server: Node.js, Hono and Better Auth.
  • web: Caddy and the built React SPA.
  • Optional: Loops and PostHog accounts.

Deployment Dependencies

Implementation Details

Public domain → web → server: /api, /docs, /openapi.json, /health.

Custom domain:

  1. Add it to web.
  2. Set BETTER_AUTH_URL and APP_ORIGIN on server to your domain, for example https://app.example.com.
  3. Redeploy server.

Optional variables on server:

LOOPS_API_KEY=
LOOPS_RESET_PASSWORD_TEMPLATE_ID=
LOOPS_VERIFY_EMAIL_TEMPLATE_ID=
LOOPS_INVITATION_TEMPLATE_ID=
POSTHOG_PROJECT_KEY=
POSTHOG_HOST=

On web, add VITE_POSTHOG_PROJECT_KEY and VITE_POSTHOG_HOST; redeploy web.

Why Deploy SaaS Starter with React, Hono and Better Auth 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.

By deploying SaaS Starter with React, Hono and Better Auth on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

More templates in this category

View Template
open-excalidraw
Self-hostable collaborative drawing built on Excalidraw

Prateek Mohanty
5
View Template
caring-vibrancy
Deploy and Host caring-vibrancy with Railway

5
View Template
Appsmith
Low-code platform for internal tools, dashboards, and admin panels.

Agaz Self-Host
1