Create SvelteKit Boilerplate
A CLI tool to generate a customizable SvelteKit (Svelte 5) application with all the features you need.
Features
Create a modern SvelteKit application with your choice of:
- β
ESLint - Code linting
- β
TypeScript - Type safety
- β
Playwright - End-to-end testing
- β
Vitest - Unit testing
UI Frameworks
- π¨ svelte-shadcn UI - Beautiful, accessible components
- π Storybook - Component development environment
Databases
- π PostgreSQL - Powerful relational database
- β‘ Supabase - Open-source Firebase alternative
Type-Safe Backend
- π tRPC-SvelteKit - End-to-end type-safe APIs
- β Zod - Schema validation library
Payment Integration
- π³ Stripe - Online payment processing
- π° Paddle - Payment infrastructure for SaaS
Analytics
- π Plausible - Privacy-friendly analytics
SEO Optimization
- πΌοΈ Dynamic OG Images - Social media preview images
- πΊοΈ Sitemap.xml - Automatic sitemap generation
- π€ Robots.txt - Search engine crawler instructions
Content Management
- π Blog with Markdown - Write blog posts in Markdown
Authentication
- π Auth.js - Flexible authentication library
- π Lucia - Simple and lightweight authentication
Installation
npm install
Build
npm run build
Usage
npm start
Or run directly with npx (once published):
npx create-sveltekit-boilerplate
Interactive CLI
The tool will guide you through selecting the features you want:
- Project Name - Choose a name for your project
- Development Tools - Select ESLint, TypeScript, Playwright, and/or Vitest
- UI Framework - Choose between svelte-shadcn UI, Storybook, or none
- Database - Select PostgreSQL, Supabase, or none
- Backend Tools - Choose tRPC-SvelteKit and/or Zod
- Payment Provider - Select Stripe, Paddle, or none
- Analytics - Include Plausible Analytics
- SEO Optimization - Add SEO features (OG images, sitemap, robots.txt)
- Blog - Include blog with Markdown support
- Authentication - Choose Auth.js, Lucia, or none
Generated Project Structure
my-sveltekit-app/
βββ src/
β βββ routes/
β β βββ +layout.svelte
β β βββ +page.svelte
β β βββ blog/ (if blog enabled)
β β βββ sitemap.xml/ (if SEO enabled)
β β βββ robots.txt/ (if SEO enabled)
β β βββ og-image/ (if SEO enabled)
β βββ lib/
β β βββ auth/ (if auth enabled)
β β βββ db/ (if database enabled)
β β βββ trpc/ (if tRPC enabled)
β β βββ payment/ (if payment enabled)
β β βββ seo/ (if SEO enabled)
β βββ app.html
βββ static/
βββ tests/ (if Playwright enabled)
βββ .storybook/ (if Storybook enabled)
βββ package.json
βββ svelte.config.js
βββ vite.config.ts
βββ tsconfig.json (if TypeScript enabled)
βββ eslint.config.js (if ESLint enabled)
βββ playwright.config.ts (if Playwright enabled)
βββ .env.example
βββ README.md
Development
To work on the CLI tool itself:
# Install dependencies
npm install
# Build the TypeScript code
npm run build
# Run in development mode
npm run dev
# Test the CLI locally
npm start
Examples
Check out the examples directory for common configuration patterns:
Project Structure
Each generated project follows SvelteKit conventions:
src/routes/ - Your application routes
src/lib/ - Reusable components and utilities
static/ - Static assets (images, fonts, etc.)
tests/ - End-to-end tests (if Playwright is enabled)
Features in Detail
- ESLint: Configured with Svelte-specific rules and TypeScript support
- TypeScript: Full type safety with proper SvelteKit types
- Vitest: Fast unit testing with Svelte component support
- Playwright: Reliable E2E testing with real browser automation
UI Frameworks
- svelte-shadcn UI: Accessible components built with Tailwind CSS, ready to customize
- Storybook: Isolated component development with hot reload and docs
Databases
- PostgreSQL: Direct connection with pg library, ready for migrations
- Supabase: Backend-as-a-service with auth, database, and real-time subscriptions
Type-Safe Backend
- tRPC-SvelteKit: End-to-end type safety between client and server
- Zod: Runtime validation with TypeScript inference
Payment Integration
- Stripe: Complete payment setup with subscription support
- Paddle: Merchant of record payment processing
SEO Features
- Dynamic OG Images: Generate social media preview images on-demand
- Sitemap.xml: Automatic sitemap generation for search engines
- Robots.txt: Search engine crawler instructions
Authentication
- Auth.js: Multiple OAuth providers (GitHub, Google, etc.)
- Lucia: Lightweight auth with session management
Troubleshooting
Build Errors
If you encounter build errors after generating a project:
- Make sure you've installed dependencies:
npm install
- Check that all environment variables are set
- Try clearing the SvelteKit cache:
rm -rf .svelte-kit
Type Errors
If TypeScript shows errors:
- Run
npm run check to sync types
- Make sure you're using compatible versions
- Check that
tsconfig.json extends .svelte-kit/tsconfig.json
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Development Setup
- Fork the repository
- Clone your fork
- Install dependencies:
npm install
- Make your changes
- Build and test:
npm run build && npm start
- Submit a pull request
License
MIT