Open-source SvelteKit SaaS template with auth via Supabase, subscriptions via Stripe, and more.
git clone
to deployment.Created by the folks at Kiln AI! It's the easiest tool for fine-tuning LLM models, synthetic data generation, and collaborating on datasets. The Kiln app was built with SaaS Starter!
Kiln AI Rapid AI Prototyping and Dataset Collaboration Tool
You can explore all the features using our fully functional demo saasstarter.work.
See criticalmoments.io and getkiln.ai for examples of what’s possible after this template has design, content, and functionality added.
Everything you need to get started for a SaaS company:
Want to learn why we picked the technologies we did, and how to keep your fork lightning fast as you add content? Check out our blog post on the process. Yes, it's hosted on a SaaS Starter fork!
There’s no cost for using this template. The costs below reflect our suggested hosting stack.
The selected tech stack creates lightning fast websites.
The result is a perfect Google PageSpeed Insights score in all categories!
To get started, create your own copy of the project for development. There are two options:
On your development machine:
git pull [Your Repo Created Above]cd CMSaasStarter ## or your repo name if differentnpm install## Create an env file. You'll replace the values in this in later steps.cp .env.example .env.local## Run the project locally in dev mode, and launch the browsernpm run dev -- --open
Note: some features won't work until you complete the rest of the setup steps below!
The repo includes CI scripts designed for GitHub Actions. These confirm you don’t break your build, you use proper code formatting, code linting and typechecking passes, and even spell checking.
Github disables CI on new forks by default, so be sure to go into the Github Actions page for your repo and enable workflows.
To manually run all these tools run the following script. You can view it's contents for individual commands.
# first time only: chmod +x ./checks.sh./checks.sh
Installing extensions in your editor can automatically format-on-save, show linting/type issues inline, and run your test cases:
To catch build, formatting, linting and test issues before you commit changes, we suggest the following local git hook. It will run before you commit, stop you from breaking the build, and show any issues that are found. Add the lines below to an executable git hook script at the location .git/hooks/pre-commit
.
#!/bin/sh# Run standard checks before committingcd "$(dirname "$0")"sh ../../checks.sh
If you find build, formatting or linting rules too tedious, you can disable enforcement by deleting the CI files (.github/workflows/*
) and removing the git hook (.git/hooks/pre-commit
).
database_migration.sql
to create the initial schema.supabase/migrations
directory:.env.local
file:
PUBLIC_SUPABASE_URL=https://your-project.supabase.coPUBLIC_SUPABASE_ANON_KEY=your-anon-keyPRIVATE_SUPABASE_SERVICE_ROLE=your service_role secret
https://saasstarter.work/auth/callback
. Also add that same URL to the the “allowed redirect URL” list in the Supabase auth console further down the page.https://saasstarter.work/auth/callback?*
http://localhost:5173/auth/callback
and http://localhost:5173/auth/callback?*
.yourdomain.com/auth/callback
. If they link to the base URL or another page, double check you have the config above set correctly.Account Permissions > Email Address > Read Only Access
oauthProviders
list in /src/routes/(marketing)/login/login_config.ts
with the list of providers you chose. If you don’t want any OAuth options, make this an empty array./login
page in your browser, and ensure you can sign up, confirm email, log in, and edit your account.SaaS Starter Free
, Saas Starter Pro
, Saas Starter Enterprise
). Include a monthly and annual price for each product if you want to support multiple billing periods..env.local
locally, and Cloudflare environment for prod). Be sure to use test keys for development, and keep your production/live keys secret and secure./src/routes/(marketing)/pricing/pricing_plans.ts
and Fill in all fields for each plan. stripe_price_id and stripe_product_id should only be omitted on a single “free” plan. Multiple free plans are not supported.defaultPlanId
to the plan the user will see as their “current plan” after signup, but before subscribing to a paid plan (typically “free”). It should align to the plan with no stripe_price_id./pricing
, specify that plan ID in /src/routes/(marketing)/pricing/+page.svelte
We have two documented options for deploying SaaS Starter: Cloudflare Pages and Vercel. However, it can be hosted anywhere you can host a SvelteKit app.
Our official demo is hosted on Cloudflare Pages, and deployed each time the main branch is updated.
Cloudflare Pages and Workers is one of the most popular options for deploying SvelteKit and we recommend it. Follow Cloudflare’s instructions to deploy in a few clicks. Be sure to select “SvelteKit” as framework, and the rest of the defaults will work.
When prompted: add environment variables for your production environment (PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, PRIVATE_SUPABASE_SERVICE_ROLE, and PRIVATE_STRIPE_API_KEY).
Optional: enable Cloudflare Analytics for usage metrics.
Deploy using Vercel's deploy button:
Here is a demo of of Saas Starter hosted on Vercel: vercel.saasstarter.work
If you prefer another host you can explore alternatives:
SaaS Starter includes email capabilities for sending emails to users and admins.
These are optional and disabled by default. See email docs for details on how to enable and customize them.
After the steps above, you’ll have a working version like the demo page. However, it’s not branded, and doesn’t have your content. The following checklist helps you customize the template to make a SaaS homepage for your company.
src/config.ts:
. These values are used for SEO.src/routes/(marketing)/blog/posts.ts
, and replace the post pages under src/routes/(marketing)/blog/posts
to align to the urls from posts.ts
.src/routes/(marketing)/+layout.svelte
).prerender = false
in the appropriate +page.ts
file. These are currently pre-rendered and served as static assets for performance reasons, but that will break if you add server side rendering requirements.src/config.ts
), but the more specific these are the better.posts.ts
metadataapp.css
). DaisyUI can automatically use a dark mode theme on systems with dark mode enabled (disabled by default) -- to enable if remove themes: false;
and specify a dark mode theme. Docs: https://daisyui.com/docs/themes/src/routes/(marketing)/+layout.svelte
: customize design, delete unwanted pages from header and footer/static/
directorysrc/routes/(marketing)/login/login_config.ts
(see Auth UI for options).excludePaths
in src/lib/build_index.ts
./src/routes/(admin)/account/+page.svelte
).The open source community is extending and improving SaasStarter!
These extensions are reference implementations of commonly needed features. We don't integrate them into the main branch to keep our dependencies minimal and simplify maintenance. However, if you need them you can cherry pick into your fork/repo:
Homescreen Icons are from Solar Broken Line Icons and Solar Linear Icons via CC Attribution License.
CMSaasStarter is sponsored by Kiln AI: the easiest way to build AI products.
Demo of Kiln AI:
https://github.com/user-attachments/assets/0fb3cd48-0f2c-40f5-baf2-b38f11ed85ea
Open-source SvelteKit SaaS template with auth via Supabase, subscriptions via Stripe, and more.
git clone
to deployment.Created by the folks at Kiln AI! It's the easiest tool for fine-tuning LLM models, synthetic data generation, and collaborating on datasets. The Kiln app was built with SaaS Starter!
Kiln AI Rapid AI Prototyping and Dataset Collaboration Tool
You can explore all the features using our fully functional demo saasstarter.work.
See criticalmoments.io and getkiln.ai for examples of what’s possible after this template has design, content, and functionality added.
Everything you need to get started for a SaaS company:
Want to learn why we picked the technologies we did, and how to keep your fork lightning fast as you add content? Check out our blog post on the process. Yes, it's hosted on a SaaS Starter fork!
There’s no cost for using this template. The costs below reflect our suggested hosting stack.
The selected tech stack creates lightning fast websites.
The result is a perfect Google PageSpeed Insights score in all categories!
To get started, create your own copy of the project for development. There are two options:
On your development machine:
git pull [Your Repo Created Above]cd CMSaasStarter ## or your repo name if differentnpm install## Create an env file. You'll replace the values in this in later steps.cp .env.example .env.local## Run the project locally in dev mode, and launch the browsernpm run dev -- --open
Note: some features won't work until you complete the rest of the setup steps below!
The repo includes CI scripts designed for GitHub Actions. These confirm you don’t break your build, you use proper code formatting, code linting and typechecking passes, and even spell checking.
Github disables CI on new forks by default, so be sure to go into the Github Actions page for your repo and enable workflows.
To manually run all these tools run the following script. You can view it's contents for individual commands.
# first time only: chmod +x ./checks.sh./checks.sh
Installing extensions in your editor can automatically format-on-save, show linting/type issues inline, and run your test cases:
To catch build, formatting, linting and test issues before you commit changes, we suggest the following local git hook. It will run before you commit, stop you from breaking the build, and show any issues that are found. Add the lines below to an executable git hook script at the location .git/hooks/pre-commit
.
#!/bin/sh# Run standard checks before committingcd "$(dirname "$0")"sh ../../checks.sh
If you find build, formatting or linting rules too tedious, you can disable enforcement by deleting the CI files (.github/workflows/*
) and removing the git hook (.git/hooks/pre-commit
).
database_migration.sql
to create the initial schema.supabase/migrations
directory:.env.local
file:
PUBLIC_SUPABASE_URL=https://your-project.supabase.coPUBLIC_SUPABASE_ANON_KEY=your-anon-keyPRIVATE_SUPABASE_SERVICE_ROLE=your service_role secret
https://saasstarter.work/auth/callback
. Also add that same URL to the the “allowed redirect URL” list in the Supabase auth console further down the page.https://saasstarter.work/auth/callback?*
http://localhost:5173/auth/callback
and http://localhost:5173/auth/callback?*
.yourdomain.com/auth/callback
. If they link to the base URL or another page, double check you have the config above set correctly.Account Permissions > Email Address > Read Only Access
oauthProviders
list in /src/routes/(marketing)/login/login_config.ts
with the list of providers you chose. If you don’t want any OAuth options, make this an empty array./login
page in your browser, and ensure you can sign up, confirm email, log in, and edit your account.SaaS Starter Free
, Saas Starter Pro
, Saas Starter Enterprise
). Include a monthly and annual price for each product if you want to support multiple billing periods..env.local
locally, and Cloudflare environment for prod). Be sure to use test keys for development, and keep your production/live keys secret and secure./src/routes/(marketing)/pricing/pricing_plans.ts
and Fill in all fields for each plan. stripe_price_id and stripe_product_id should only be omitted on a single “free” plan. Multiple free plans are not supported.defaultPlanId
to the plan the user will see as their “current plan” after signup, but before subscribing to a paid plan (typically “free”). It should align to the plan with no stripe_price_id./pricing
, specify that plan ID in /src/routes/(marketing)/pricing/+page.svelte
We have two documented options for deploying SaaS Starter: Cloudflare Pages and Vercel. However, it can be hosted anywhere you can host a SvelteKit app.
Our official demo is hosted on Cloudflare Pages, and deployed each time the main branch is updated.
Cloudflare Pages and Workers is one of the most popular options for deploying SvelteKit and we recommend it. Follow Cloudflare’s instructions to deploy in a few clicks. Be sure to select “SvelteKit” as framework, and the rest of the defaults will work.
When prompted: add environment variables for your production environment (PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, PRIVATE_SUPABASE_SERVICE_ROLE, and PRIVATE_STRIPE_API_KEY).
Optional: enable Cloudflare Analytics for usage metrics.
Deploy using Vercel's deploy button:
Here is a demo of of Saas Starter hosted on Vercel: vercel.saasstarter.work
If you prefer another host you can explore alternatives:
SaaS Starter includes email capabilities for sending emails to users and admins.
These are optional and disabled by default. See email docs for details on how to enable and customize them.
After the steps above, you’ll have a working version like the demo page. However, it’s not branded, and doesn’t have your content. The following checklist helps you customize the template to make a SaaS homepage for your company.
src/config.ts:
. These values are used for SEO.src/routes/(marketing)/blog/posts.ts
, and replace the post pages under src/routes/(marketing)/blog/posts
to align to the urls from posts.ts
.src/routes/(marketing)/+layout.svelte
).prerender = false
in the appropriate +page.ts
file. These are currently pre-rendered and served as static assets for performance reasons, but that will break if you add server side rendering requirements.src/config.ts
), but the more specific these are the better.posts.ts
metadataapp.css
). DaisyUI can automatically use a dark mode theme on systems with dark mode enabled (disabled by default) -- to enable if remove themes: false;
and specify a dark mode theme. Docs: https://daisyui.com/docs/themes/src/routes/(marketing)/+layout.svelte
: customize design, delete unwanted pages from header and footer/static/
directorysrc/routes/(marketing)/login/login_config.ts
(see Auth UI for options).excludePaths
in src/lib/build_index.ts
./src/routes/(admin)/account/+page.svelte
).The open source community is extending and improving SaasStarter!
These extensions are reference implementations of commonly needed features. We don't integrate them into the main branch to keep our dependencies minimal and simplify maintenance. However, if you need them you can cherry pick into your fork/repo:
Homescreen Icons are from Solar Broken Line Icons and Solar Linear Icons via CC Attribution License.
CMSaasStarter is sponsored by Kiln AI: the easiest way to build AI products.
Demo of Kiln AI:
https://github.com/user-attachments/assets/0fb3cd48-0f2c-40f5-baf2-b38f11ed85ea