Code examples from the video course Build a SaaS with SvelteKit
- Authentication with Auth.js
- Database with Prisma
- Plans & pricing page
- Payments with Stripe Checkout
- Syncing subscription status via webhooks
Start by copying the example .env:
cp .env.example .envThen customize the .env file. You'll need to provide values for:
DATABASE_URL: The url of your database.AUTH_SECRET: The secret Auth.js uses. Can be generated usingopenssl rand -base64 32GITHUB_ID: The id of your GitHub OAuth client.GITHUB_SECRET: The secret of your GitHub OAuth client.SECRET_STRIPE_KEY: Your Stripe API secret key.STRIPE_WEBHOOK_SECRET: Your Stripe secret for webhooks.
Install the dependencies:
pnpm installCreate the database:
pnpm prisma db pushTo tunnel Stripe webhooks in development mode, install Stripe's CLI.
Follow instructions here:
First, run the dev server
pnpm devThen, tell Stripe to tunnel webhooks to the local dev server:
stripe listen --forward-to localhost:5173/integrations/stripeYou can adjust the seed data in prisma/seed.js to use price ids from your Stripe account.
To load seed data, run:
prisma db seedFor more info, here's the full video: https://joshuanussbaum.podia.com/build-a-saas-with-sveltekit
MIT