SimplySaas--Boilerplate Svelte Themes

Simplysaas Boilerplate

πŸš€ SimplySaaS is a SvelteKit 5 boilerplate with Supabase auth, shadcn-svelte UI, and TypeScriptβ€”built for developers who want full control. It includes email/password + OAuth, protected routes, error handling, and Superforms with Zod for seamless authentication. Fast, flexible, and production-ready. πŸ”₯

πŸš€ SimplySaaS

A modern SvelteKit boilerplate with Supabase authentication, shadcn-svelte components, and TypeScript designed to jumpstart your SaaS project.

πŸ’­ Why I Created SimplySaaS

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.

πŸ€” Why These Tech Choices?

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.

✨ What's Included

I made sure this template has everything you need for a production-ready auth system:

  • βœ‰οΈ Email/password registration with proper validation
  • πŸ”‘ Google OAuth that actually works
  • πŸ”„ Complete password reset flow
  • ⚑ Error handling that gives real feedback
  • βœ… Email verification that just works

🎁 Use It Freely

I'm making SimplySaaS free for everyone to build their own SaaS products. You can:

  • πŸ’Ό Use it for commercial projects
  • πŸ› οΈ Modify it however you want
  • πŸ’° Build and sell products with it

Just one rule (which is in the license):

  • ❌ Don't resell this template itself as a paid product - that would defeat the whole purpose of making it free for everyone.

Core Features

  • πŸ” Authentication & Security:

    • Complete Supabase authentication system
    • OAuth and email/password strategies
    • Protected routes with auth guards
    • Email verification and password reset
    • Error and success feedback
  • 🎨 UI Components:

    • Fully customizable shadcn components
    • Form validation states and feedback
    • Loading states and indicators
    • Responsive and accessible design
  • πŸš€ Developer Experience:

    • SvelteKit 2.16 with SSR
    • Svelte 5
    • TypeScript for type safety
    • Superforms with Zod validation
    • Tailwind CSS for styling

🏁 Getting Started

πŸ“‹ Prerequisites

  1. Node.js 18+ and npm installed
  2. A Supabase account

βš™οΈ Installation

  1. Clone the repository:
git clone https://github.com/yourusername/SimplySaaS.git
cd SimplySaaS
  1. Install dependencies:
npm install

πŸ› οΈ Supabase Setup

  1. Create a new Supabase project at https://supabase.com and find your supabase-url and ANON-key.
  2. Create .env.local
  3. Update .env.local with your Supabase credentials:
PUBLIC_SUPABASE_URL=your_project_url
PUBLIC_SUPABASE_ANON_KEY=your_anon_key
  1. (Optional) Configure authentication settings in src/lib/features/auth/config/auth.ts:
    • Update redirect paths
    • Customize auth behavior and routes
    • Modify protection rules

πŸ› οΈ Technologies

  • Framework: SvelteKit with Svelte 5 runes
  • Language: TypeScript
  • Authentication: Supabase Auth (@supabase/ssr)
  • UI Components: shadcn-svelte (Next version) with Tailwind CSS
  • Icons: unplugin-icons with SSR support
  • Forms: sveltekit-superforms with Zod schema validation

πŸ”‘ Google OAuth Setup

For Google OAuth setup, follow this video tutorial (starting at 7:20). It shows how to:

  1. Create Google OAuth credentials in Google Cloud Console
  2. Configure the credentials in your Supabase dashboard

No code changes are needed - just configuration in the Supabase dashboard.

πŸ’» Development

Start the development server:

npm run dev

Visit http://localhost:5173 to see your app.

πŸ”’ Auth Features

  • Form Validation: Built with superforms and Zod schema validation
  • Error Handling: Proper error responses and user feedback
  • Password Management: Reset password flow included
  • OAuth: Google authentication integration
  • Route Protection: Public and private route handling
  • UI Components: Using shadcn-svelte (Next version) for form elements

πŸ“ Project Structure

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)

πŸ”‘ Authentication Flow

1. Email/Password Authentication

  • Registration (/auth?mode=register):

    • Form validation with superforms
    • Automatic email verification
    • Redirect to login after verification
  • Login (/auth?mode=login):

    • Email/password validation
    • Redirect to dashboard on success
    • Password reset option

2. Password Reset Flow

  • Request reset at /auth/reset
  • Update password at /auth/update-password
  • Success feedback with redirect

3. Protected Routes

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');
}

πŸ› οΈ Code Quality Tools

  • TypeScript - Static type checking
  • ESLint - Code linting
  • Prettier - Code formatting
  • svelte-check - Svelte type checking

πŸ”§ Additional Tools

  • shadcn-svelte - Pre-built accessible UI components
  • Tailwind CSS - Utility-first styling
  • Bits UI - Low-level UI primitives
  • Lucide - Beautiful SVG icons
  • Prettier - Code formatting
  • ESLint - Code linting

πŸ“š Utils Structure Explanation

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 components
    • supabase-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:

  1. shadcn's component installation system works without modification
  2. Clear, descriptive file names make it easy to understand each utility's purpose
  3. Flat directory structure reduces complexity while maintaining organization
  4. Easy to add new utilities without creating unnecessary hierarchy

πŸ“š Resources

β˜• Buy me a coffee

Top categories

svelte logo

Need a Svelte website built?

Hire a professional Svelte developer today.
Loading Svelte Themes