[App Name] · SvelteKit + Lucia
Full-stack SvelteKit app. Server actions for mutations, Lucia for sessions, Drizzle for the DB. No third-party auth providers.
Source of truth
Vercel auto-deploys from main. Lucia stores sessions in Postgres (column on sessions table). Session cookie is httpOnly.
Tech stack
SvelteKit 2 + Svelte 5 (runes mode) + TypeScript. Drizzle ORM with Postgres. Lucia 4 for session-based auth (no JWTs, sessions live in your DB). Tailwind v4. Resend for transactional email (verification, password reset). Deployed to Vercel via @sveltejs/adapter-vercel.
Deploy
git push origin main. Vercel builds with the SvelteKit Vercel adapter. Postgres via Vercel Postgres or Neon.
File map
src/routes/file-based routingsrc/routes/(marketing)/public:/,/pricing,/privacysrc/routes/(app)/authed:/dashboard,/settingssrc/routes/api/route handlers (rare; prefer form actions)src/lib/server/db/schema.tsDrizzle tablessrc/lib/server/db/index.tsDB clientsrc/lib/server/auth.tsLucia instance + session helperssrc/hooks.server.tsrequest hook attachinglocals.userdrizzle.config.ts
.env keys
DATABASE_URLRESEND_API_KEYRESEND_FROM_EMAILPUBLIC_SITE_URL
Hard rules
- Mutations via form actions (
+page.server.tsactions), NOT API routes. Progressive enhancement matters. - All authed pages check
locals.userin+page.server.tsload. NEVER trust the client. - Lucia sessions live in
sessionstable with an FK tousers. Stale sessions cleaned via a cron. - Use Svelte 5 runes (
$state,$derived,$effect). Don't mix in legacy$:reactive statements. - Form actions return either
{ form }orredirect(). Never return raw data the client can't use. - Password hashing with Lucia's recommended Argon2id, NOT bcrypt.
Recent significant changes
- 2026-05-15: Scaffolded. Locked: Lucia over Auth.js (full control of session lifetime), Drizzle over Prisma (smaller, faster), Resend over SendGrid (DX).
Next session: start here
- Create Vercel project + Postgres.
npm run db:pushto apply Drizzle schema.- Implement signup form action. Test the cookie flow with a real browser.
- Add a protected
/dashboardpage; confirm unauthed redirects to login. - Set up Resend with verified domain for the magic-link / verification emails.