Production-oriented SvelteKit starter with a real auth/data/UI baseline:
This repo is meant to remove setup churn for full-stack SvelteKit projects. It ships with auth wiring, typed DB access, reusable UI primitives, and route protection already integrated.
@sveltejs/kit, svelte, typescriptbetter-auth + better-auth/svelte-kitdrizzle-orm, drizzle-kit, @libsql/client (Turso/libSQL)tailwindcss@4, tailwind-variants, bits-ui, shadcn-svelte-style componentsvite-plugin-pwa, workbox-windowvitest, @testing-library/svelte@sveltejs/adapter-vercel (Node 20 runtime)bun install
cp .env.example .env
.env:DATABASE_URL="libsql://<your-db>.turso.io"
DATABASE_AUTH_TOKEN="<your-turso-token>"
BETTER_AUTH_SECRET="<long-random-secret>"
BETTER_AUTH_URL="http://localhost:5173"
GITHUB_CLIENT_ID="<github-client-id>"
GITHUB_CLIENT_SECRET="<github-client-secret>"
bun run db:push
bun run dev
Create a GitHub OAuth app with:
http://localhost:5173http://localhost:5173/api/auth/callback/githubUse the generated client ID/secret in .env.
bun run dev - start dev serverbun run build - production buildbun run preview - preview production buildbun run check - Svelte + TypeScript checksbun run lint - Prettier checkbun run format - Prettier writebun run test:run - run Vitest oncebun run db:generate - generate Drizzle migrationbun run db:push - push schema to DBbun run db:migrate - apply migrationsbun run db:studio - open Drizzle Studiosrc/
hooks.server.ts # session hydration into locals
pwa.ts # service worker registration helpers
lib/
auth-client.ts # Better Auth client
auth-utils.ts # shared client auth actions
constants.ts # route + external constants
server/
auth.ts # Better Auth config (GitHub provider)
db/
index.ts # DB client
schema.ts # Drizzle schema
components/
Navbar.svelte # responsive nav + auth actions
PWAInstallPrompt.svelte
ui/ # reusable UI primitives
routes/
+layout.svelte # global shell
+layout.server.ts # pass user to layout
+page.svelte # signed-out landing
+page.server.ts # redirect logged-in users to dashboard
auth/+page.svelte # dedicated sign-in page
dashboard/+page.svelte # protected dashboard
components/+page.svelte # organized UI playground
about/+page.svelte # architecture/stack page
api/auth/[...all]/+server.ts # Better Auth endpoint
src/hooks.server.ts resolves session/user and sets event.locals.src/routes/dashboard/+page.server.ts redirects to / when unauthenticated.src/routes/+page.server.ts redirects authenticated users to /dashboard.src/lib/auth-utils.ts.bun run check
bun run lint
bun run test:run
bun run build
adapter-vercel is configured in svelte.config.js with nodejs20.x runtime.