Deploy Next.js Better Auth Prisma SaaS Starter Kit

Next.js starter with Better Auth, Prisma/Postgres and role-based dashboards

Deploy Next.js Better Auth Prisma SaaS Starter Kit

/var/lib/postgresql/data

Deploy and Host Next.js Better Auth Prisma SaaS Starter Kit on Railway

Next.js Better Auth Prisma SaaS Starter Kit is an open-source, production-ready starter for building SaaS products with Next.js 16, Better Auth, Prisma and PostgreSQL. It ships with email and password login, Google OAuth, email verification, password reset, role-based access, admin and user dashboards, and a shadcn/ui interface.

About Hosting Next.js Better Auth Prisma SaaS Starter Kit

Deploying the template on Railway creates two services: the Next.js app and a PostgreSQL database. Railway builds the app, generates the Prisma client, and wires DATABASE_URL automatically. On every start the app applies pending database migrations, so the schema is always up to date. A built-in /api/health endpoint runs a database check and is used as Railway's healthcheck, with automatic restarts on failure. You get a public HTTPS URL as soon as the first deploy finishes. After that, you only add your auth secret, your public URL, and your Resend and Google credentials, then push to your repository to redeploy.

Common Use Cases

  • SaaS MVPs - Launch a new product with authentication, user management and dashboards already working, and spend your time on the features that make it unique.
  • Admin panels and internal tools - Protect pages with sessions and an admin role so only authorized users can access them.
  • Membership and gated-content portals - Offer sign-up with email verification, Google login and password recovery out of the box.
  • Client projects and prototypes - Start every new project from a typed, consistent base instead of rebuilding auth and database setup each time.

Dependencies for Next.js Better Auth Prisma SaaS Starter Kit Hosting

  • PostgreSQL - Provisioned automatically by Railway. It stores users, sessions, accounts and verification tokens.
  • Resend - Sends the verification and password reset emails. Email verification is required to sign in, so a RESEND_API_KEY and a sender address on a domain you have verified in Resend are needed.
  • Google OAuth credentials - Needed to enable the "Continue with Google" login.

Deployment Dependencies

Implementation Details

Set these variables on the Next.js service after deploying:

# Provided by the Railway PostgreSQL service
DATABASE_URL=postgresql://...

# Generate with: openssl rand -base64 32
BETTER_AUTH_SECRET=your_secret_here

# Your public URL (also used for the social preview image, sitemap and robots.txt)
BETTER_AUTH_URL=https://your-app.up.railway.app
NEXT_PUBLIC_BASE_URL=https://your-app.up.railway.app

# Google OAuth
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret

# Transactional email via Resend
RESEND_API_KEY=re_your_api_key
EMAIL_SENDER_NAME=Your App
EMAIL_SENDER_ADDRESS=noreply@yourdomain.com

In Google Cloud Console, add https://your-app.up.railway.app/api/auth/callback/google as an authorized redirect URI.

The first admin: sign up normally, then set that user's role to admin in the database (for example with bunx prisma studio). That user is then redirected to /admin.

To customize, edit the site name and metadata in src/lib/constants.ts and src/app/layout.tsx, and add or change login providers in src/lib/auth.ts.

Why Deploy Next.js Better Auth Prisma SaaS Starter Kit 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 Next.js Better Auth Prisma SaaS Starter Kit 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
4
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