---
title: "Deploy SvelteKit + Better Auth Starter"
description: "SvelteKit 3, Better Auth, Postgres/Drizzle, i18n, email: a base to build on"
category: "Starters"
url: https://railway.com/deploy/sveltekit-better-auth-starter
---

# Deploy SvelteKit + Better Auth Starter

SvelteKit 3, Better Auth, Postgres/Drizzle, i18n, email: a base to build on

**[Deploy SvelteKit + Better Auth Starter on Railway](https://railway.com/template/sveltekit-better-auth-starter)**

- **Creator:** Two Workspaces
- **Category:** Starters
- **Total deploys:** 4

## Template content

### postgres https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/postgresql.svg

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

### sveltekit https://devicons.railway.com/i/svelte.svg

- **Source:** https://github.com/nomideusz/sveltekit-better-auth-starter
- **Health check:** /api/health
- **Public domain:** Yes

## Documentation

# Deploy and Host a SvelteKit + Better Auth Starter on Railway

[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/new/template/sveltekit-better-auth-starter?utm_medium=integration&amp;utm_source=button&amp;utm_campaign=sveltekit-better-auth-starter)

A minimal, production-shaped SvelteKit app to build on: sign-in, password reset and email verification (Better Auth), Postgres via Drizzle with migrations, URL-locale i18n (`/`, `/pl`, `/de`, `/uk`, `/es`), transactional email, security headers, a health endpoint and one protected area. Source: [nomideusz/sveltekit-better-auth-starter](https://github.com/nomideusz/sveltekit-better-auth-starter).

## About Hosting a SvelteKit + Better Auth Starter

Two services: the SvelteKit server (Node adapter, built by Railpack from the repo) and PostgreSQL 17 on a volume. Every deploy runs Drizzle migrations and then creates the admin account from `ADMIN_EMAIL` / `ADMIN_PASSWORD` if it does not exist yet, so a fresh deploy has someone who can sign in without opening public sign-up. Sessions, password-reset and verification tokens live in Postgres (Better Auth tables). Email goes out over Resend's HTTP API when `RESEND_API_KEY` is set (Railway's Hobby plan blocks outbound SMTP ports, so this is the transport that works there) or over SMTP; with neither, reset and verification emails are logged instead of sent and the app runs fully. Built on `@sveltejs/kit` 3.0.0-next (pre-release) and Svelte 5.

## Common Use Cases

- The starting point for a SaaS, internal tool or member area that needs real auth on day one
- A reference for the SvelteKit 3 layout: config in `vite.config.ts`, declared env vars, `#lib` imports
- Multilingual sites: default locale un-prefixed, others at `//*`, one server hook

## Dependencies for SvelteKit + Better Auth Starter Hosting

- Bundled: PostgreSQL 17 on a volume
- Optional: a Resend API key (HTTP email — works on the Hobby plan) or SMTP credentials (needs a plan where outbound SMTP is allowed)

### Deployment Dependencies

- [Better Auth documentation](https://better-auth.com/docs)
- [Drizzle ORM documentation](https://orm.drizzle.team)
- [Template source on GitHub](https://github.com/nomideusz/sveltekit-better-auth-starter)

### Implementation Details

**Sign in at `/auth/login`** with `ADMIN_EMAIL` and the generated `ADMIN_PASSWORD` (read it in the service's Variables tab). Change it afterwards via "Forgot your password?" once email is configured (`RESEND_API_KEY` or SMTP).

Variable wiring:

- `DATABASE_URL = postgres://${{postgres.POSTGRES_USER}}:${{postgres.POSTGRES_PASSWORD}}@${{postgres.RAILWAY_PRIVATE_DOMAIN}}:5432/${{postgres.POSTGRES_DB}}?sslmode=disable` (private network)
- `ORIGIN = https://${{RAILWAY_PUBLIC_DOMAIN}}` (auth base URL and email links; change when you attach a custom domain)
- `BETTER_AUTH_SECRET` generated; `ADMIN_PASSWORD` generated
- `railway.toml` in the repo sets the build, pre-deploy (`migrate` + `bootstrap-admin`), start command and `/api/health`

Notes:

- Add your tables to `src/lib/server/db/schema.ts`, run `pnpm db:generate` locally, commit the migration; it applies on the next deploy.
- Public sign-up is off by default; set `ALLOW_SIGNUP=true` to open `/auth/signup` (new accounts get a verification email).
- Upgrade path: fork the repo, point the service at your fork.

## Why Deploy a SvelteKit + Better Auth Starter 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 this starter 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.


## 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/sveltekit-better-auth-starter
