Home / Docs / SaaS Toolkit & DB
Solo SaaS Suite Batteries-Included

Full-Stack Solo SaaS Toolkit

Everything a solo developer needs to ship a paid SaaS in record time: Better-Auth authentication (including Passkeys/WebAuthn and TOTP 2FA), switchable Drizzle ORM (Neon PostgreSQL or Turso LibSQL), Polar.sh payments & subscriptions, Resend transactional emails, and drop-in Svelte 5 runes components.

Live Component Playground

Interact with real Svelte 5 SaaS components rendered below.

Welcome back

Sign in to access your dashboard and workspace.

Don't have an account?

1. Database Configuration (Neon vs. Turso)

Choose between serverless PostgreSQL (Neon) or edge LibSQL/SQLite (Turso) by setting DATABASE_DRIVER in your .env:

.env
bash
1# .env
2# For Neon PostgreSQL:
3DATABASE_DRIVER="neon"
4DATABASE_URL="postgresql://user:password@ep-cool-db.us-east-2.aws.neon.tech/neondb?sslmode=require"
5
6# OR For Turso SQLite:
7# DATABASE_DRIVER="turso"
8# DATABASE_URL="libsql://your-db-org.turso.io"
9# DATABASE_AUTH_TOKEN="your-turso-token"

2. Authentication in 1 Hook (`src/hooks.server.ts`)

Attach Better-Auth session validation and protected dashboard route guards with createYaxaAuthHook:

src/hooks.server.ts
typescript
1// src/hooks.server.ts
2import { sequence } from '@sveltejs/kit/hooks';
3import { createYaxaHook, createYaxaAuth, createYaxaAuthHook } from 'yaxa-svelte/server';
4import { siteConfig } from './site.config';
5
6const yaxaHook = createYaxaHook(siteConfig);
7const auth = createYaxaAuth({
8 passkey: { enabled: true },
9 twoFactor: { enabled: true, issuer: 'My SaaS' }
10});
11
12const authHook = createYaxaAuthHook({
13 auth,
14 protectedPaths: ['/dashboard', '/settings', '/billing'],
15 loginPath: '/login'
16});
17
18export const handle = sequence(yaxaHook, authHook);

3. Polar.sh Payments & Webhooks

Create instant checkout endpoints and handle webhooks with automatic Drizzle database synchronization:

src/routes/api/webhooks/polar/+server.ts
typescript
1// src/routes/api/webhooks/polar/+server.ts
2import { createPolarWebhookHandler } from 'yaxa-svelte/polar';
3
4export const POST = createPolarWebhookHandler({
5 onSubscriptionCreated: async (event) => {
6 console.log('New paid subscription created!', event.data.id);
7 }
8});

4. Subpath Module Architecture (Zero-Bundle Tax)

Yaxa isolates full-stack dependencies via dedicated subpath exports, ensuring pure client and static documentation projects don't download or bundle unused backend libraries:

subpath-imports.ts
typescript
1// 1. Core UI Components & Headless Actions (Zero Backend Overhead)
2import { Button, Modal, UserMenu, useToast, useColorMode, springTilt } from 'yaxa-svelte';
3
4// 2. Full-Stack Client Auth (Passkeys, 2FA, & Polymorphic AuthCards)
5import { useAuth, AuthCard, PasskeyUI, TwoFactorModal } from 'yaxa-svelte/auth';
6
7// 3. SvelteKit Server Hooks, Auth Factory, Pagination & SEO Handlers
8import { createYaxaHook, createYaxaAuth, createYaxaAuthHook, parseDataTableQuery } from 'yaxa-svelte/server';
9
10// 4. Drizzle ORM Database Schema & Client
11import { getDb, schemaPg, schemaSqlite } from 'yaxa-svelte/db';
12
13// 5. Polar.sh Billing & Webhooks
14import { createPolarCheckout, createPolarWebhookHandler } from 'yaxa-svelte/polar';
15
16// 6. S3 / Cloudflare R2 Presigned Uploads
17import { createPresignedUploadUrl } from 'yaxa-svelte/storage';