A SvelteKit starter app with email/password login, and some other nice bells & whistles!
- SvelteKit: A framework for building web applications with Svelte
- TypeScript: A typed superset of JavaScript that compiles to plain JavaScript
- Supabase: An open-source Firebase alternative
- Zod: A TypeScript-first schema declaration and validation library
- svelte-persisted-state: Svelte 5 state runes persisted to localStorage, sessionStorage, or cookies
- vite-plugin-kit-routes: Automatically generates a
ROUTES.tsfile in SvelteKit projects that facilitates type-safehrefrouting to avoid broken links - Tailwind CSS: A utility-first CSS framework
- DaisyUI: A "collection of CSS class names", like an extension of Tailwind with easy theming options
- Iconify: A unified icon framework using icons from icones.js
- Supabase Authentication (PKCE flow)
- Sign up/in/out
- hCaptcha spam prevention
- Change/recover password
- Server-side redirects for protecting routes
- Drizzle + Postgres + Zod for storing additional account data
- SvelteKit SuperForms + Zod for form parsing, validation, progressive enhancement, and reactive
submitting/delayedstate handling - Light/dark mode stored reactively in cookies with
svelte-persisted-state- Set reactively client-side
- Set proactively server-side by transforming HTML in
hooks.server.tsto prevent FOUC! - Ready to extend to store/load arbitrary site-wide settings!
- Custom site-wide reactive toast messaging system
-
Clone this repo
git clone https://github.com/jacksonthall22/sveltekit-supabase cd sveltekit-supabase -
Install dependencies
pnpm i
-
Create a Supabase project. The default settings and free tier are fine! Save your
Database passwordfor later. -
Set up in Supabase:
-
Disable Legacy API Keys:
Project Settings > API Keys > Legacy API Keys tab > Disable legacy API keys. -
Generate publishable/secret keys:
Project Settings > API Keys > API Keys tab > Create new API keys -
Password settings:
Authentication > Sign In / Providers > Email -
Turn off
Confirm email(optional):Authentication > Sign In / Providers > Confirm email (off) -
Email auth settings (recommended):
Authentication > Sign In / Providers > Email:Secure email change: onSecure password change: onMinimum password length: 14Password Requirements: Lowercase, uppercase letters, digits and symbolsEmail OTP Length: 6Save
-
Enable hCaptcha verification:
Authentication > Attack Prevention > Enable Captcha protection -
Change
Authentication > URL Configuration > Site URL:http://localhost:5173 -
Update email templates for sign up / password reset flows (original docs):
Authentication > Emails > ...:Confirm sign up:<h2>Confirm your signup</h2> <p>Follow this link to confirm your user:</p> <p> <a href="{{ .SiteURL }}/auth/confirm?token_hash={{ .TokenHash }}&type=email&next={{ .RedirectTo }}" >Confirm your email</a > </p>
Reset password:<h2>Reset Password</h2> <p>Follow this link to reset the password for your user:</p> <p> <a href="{{ .SiteURL }}/auth/confirm?token_hash={{ .TokenHash }}&type=recovery&next=/account/update-password" >Reset Password</a > </p>
-
-
Create a
.envbased on.env.example:cp .env.example .env
-
Fill in your own Supabase keys in
.env. In your Supabase project, click
and find the four vars: -
Create an hCaptcha site. Copy the sitekey and generate a secret key, then paste in
.env(no need to install any plugins for step 3, just clickDone). -
Push database schema to Supabase with Drizzle
drizzle-kit push
-
Start your app
pnpm dev
-
Navigate to
http://localhost:5173to see your app running!
(Feel free to open issues with any questions about missing steps here!)
- Might need to update the redirect URL sent in change-password emails in Supabase project settings - I think after deploying to vercel, the live site might still try to redirect to
localhost
(TODO: verify these are all the steps needed)
-
Create a new project in the Vercel dashboard
-
Install the Vercel CLI
pnpm add -g vercel
-
Build
pnpm build
-
Deploy!
vercel --prod
Contributions are welcome! Please feel free to submit a PR or open issues.
Shout out to Davis Media for building the base-base template for this project! 🤙
Shout out to engageintellect for building the base template for this project! 🤙

