A modern SvelteKit boilerplate with Supabase authentication, shadcn-svelte components, and TypeScript designed to jumpstart your SaaS project.
I've spent countless hours looking for a good Svelte 5 boilerplate that just works - one with a complete authentication setup including both email/password and OAuth, proper error handling, and all the essential features you need. The ones I found were either missing key features or built with UI libraries like DaisyUI or Mantine where I couldn't really control the code the way I wanted.
I hold somewhat of a grudge against Next.js since it was clearly made to lock you into Vercel's ecosystem. Svelte 5, on the other hand, was made with developer experience in mind. It gives you the freedom to build and deploy however you want.
I went with shadcn because I love that we actually own the code. You get the components right in your project where you can modify them however you need. No more being stuck with someone else's design decisions.
I made sure this template has everything you need for a production-ready auth system:
I'm making SimplySaaS free for everyone to build their own SaaS products. You can:
Just one rule (which is in the license):
π Authentication & Security:
π¨ UI Components:
π Developer Experience:
git clone https://github.com/yourusername/SimplySaaS.git
cd SimplySaaS
npm install
.env.local
.env.local
with your Supabase credentials:PUBLIC_SUPABASE_URL=your_project_url
PUBLIC_SUPABASE_ANON_KEY=your_anon_key
src/lib/features/auth/config/auth.ts
:For Google OAuth setup, follow this video tutorial (starting at 7:20). It shows how to:
No code changes are needed - just configuration in the Supabase dashboard.
Start the development server:
npm run dev
Visit http://localhost:5173 to see your app.
src/
βββ lib/
β βββ components/
β β βββ auth/ # Authentication components
β β β βββ AuthForm.svelte
β β β βββ GoogleSignIn.svelte
β β β βββ Login.svelte
β β β βββ Register.svelte
β β βββ ui/ # shadcn-svelte components
β β βββ avatar # User avatars
β β βββ button # Button components
β β βββ card # Card containers
β β βββ dropdown-menu # Dropdown menus
β β βββ error-message # Error feedback
β β βββ footer # Page footer
β β βββ form # Form components
β β βββ input # Input fields
β β βββ label # Form labels
β β βββ logo # Site logo
β β βββ navbar # Navigation bar
β β βββ profile-dropdown # User profile menu
β β βββ sheet # Slide-out panels
β β βββ spinner # Loading indicators
β β βββ success-message # Success feedback
β β βββ switch # Toggle switches
β β βββ table # Data tables
β β βββ tabs # Tab navigation
β β βββ tooltip # Hover tooltips
β βββ features/
β β βββ auth/ # Auth feature module
β β βββ config/ # Auth paths and redirects
β β βββ hooks/ # Auth guards and Supabase setup
β β βββ schemas/ # Zod validation schemas
β β βββ services/ # Auth business logic
β βββ types/ # TypeScript type definitions
β β βββ unplugin-icons.d.ts # Icon plugin types
β βββ utils.ts # shadcn utility re-exports (keeps default shadcn imports working!!!!)
β βββ utils/ # Organized utility modules
β βββ cn.ts # Tailwind class merging utility for shadcn
β βββ supabase-session-warnings.ts # Handles Supabase SSR warning suppression
βββ routes/
β βββ +error.svelte # Error handling
β βββ +layout.server.ts # Root server layout
β βββ +layout.svelte # Root layout
β βββ +layout.ts # Root layout logic
β βββ +page.svelte # Home page
β βββ auth/ # Auth routes
β β βββ +layout.svelte # Auth layout
β β βββ +page.server.ts # Auth server logic
β β βββ +page.svelte # Auth page
β β βββ login/ # Login flow
β β β βββ +page.server.ts
β β β βββ +page.svelte
β β βββ register/ # Registration flow
β β β βββ +page.server.ts
β β β βββ +page.svelte
β β βββ reset/ # Password reset
β β β βββ +page.server.ts
β β β βββ +page.svelte
β β βββ update-password/ # Password update
β β β βββ +page.server.ts
β β β βββ +page.svelte
β β βββ verify/ # Email verification
β β β βββ +page.server.ts
β β β βββ +page.svelte
β β βββ callback/ # OAuth callback
β β β βββ +server.ts
β β βββ confirm/ # Email confirmation
β β βββ +server.ts
β βββ private/ # Protected routes
β βββ +layout.server.ts # Protected layout logic
β βββ +layout.svelte # Protected layout
β βββ dashboard/ # User dashboard
β β βββ +page.svelte
β βββ settings/ # User settings
β βββ +page.server.ts
β βββ +page.svelte
βββ hooks.server.ts # Server hooks (auth setup)
Registration (/auth?mode=register
):
Login (/auth?mode=login
):
/auth/reset
/auth/update-password
All routes under /private/*
are automatically protected through the auth guard:
// src/lib/features/auth/hooks/auth-guard.server.ts handles protection
if (!event.locals.session && event.url.pathname.startsWith('/private')) {
throw redirect(303, '/auth');
}
// Also redirects authenticated users away from auth pages
if (event.locals.session && event.url.pathname === '/auth') {
throw redirect(303, '/private/dashboard');
}
I've decided to use a simple and flat utils structure while maintaining compatibility with third-party libraries:
/lib/utils.ts
: A re-export file that maintains shadcn's expected import paths, keeping component installations working smoothly./lib/utils/
: Contains all utility files with descriptive names that indicate their purpose:cn.ts
: Tailwind class merging utility used by shadcn componentssupabase-session-warnings.ts
: Handles SSR-related warning suppression for Supabase auth (specifically one really annoying bug I mention in the file comment)This structure provides several benefits: