A full-stack endurance athletics focused Software as a Service (SaaS) web application built with SvelteKit, incorporating various technologies such as Stripe for subscriptions, Lucia for authentication, Prisma ORM for database interactions, Svelte Superforms form handling, Zod for validation, and enhanced with Skeleton UI and Lucide icons.
This SaaS implements modern standards for building web applications with a focus on endurance athleteics. It integrates powerful tools and libraries to handle essential aspects like user authentication, subscription management, form handling, and more.
- User authentication using Lucia
- Subscription management with Stripe
- Stripe Webhook integration and handling
- Database interactions with Prisma ORM
- Form handling with Svelte Superforms and Zod
- UI styling with Skeleton UI
- Iconography with Lucide
-
Clone the repository:
git clone https://github.com/deancochran/skauth.git
-
Install dependencies:
pnpm install
To enable subscription handling, sign up for a Stripe account and obtain your test API keys. To develop and test locally, you'll need to download and login to stripe through the CLI tool. https://stripe.com/docs/stripe-cli
To set up a subscription product for testing purposes, you can follow these steps on your Stripe dashboard:
- Navigate to the "Products" section in the Dashboard.
- Click the "Create product" button. Fill in the product details, including a name, description, and pricing information.
NOTICE: It is imperative for the application that your add a TIER
tag to the product you configure.
The different tags that you can specify are found in the prisma/schema.prisma
file. So changing these will alter the business logic of the application.
enum UserRole {
PRO
BASE
}
- Inside the product, click the "Add pricing plan" button. Configure the plan details, such as the billing interval, currency, and amount.
- Go to the "Developers" section and find your API keys. Use the test publishable and secret keys for your integration.
- Implement Stripe into your application using the Stripe API library. Use the test API keys to update the corresponding values in the
.env
file:
~/.env
STRIPE_SECRET_KEY=XXXXXX
STRIPE_PUBLIC_KEY=XXXXXX
Configure Lucia authentication by updating the authentication configuration in src/lib/auth.js
.
Create a .env
file with your database connection URL:
DATABASE_URL="postgresql://user:password@localhost:5432/dbname"
Apply database migrations:
prisma migrate dev
Run the SvelteKit application:
pnpm run dev
In a separate terminal start the webhook listener:
pnpm run stripe-webhook
# or
stripe listen --forward-to localhost:5173/stripe/webhook