cloudflare-d1-svelte-template Svelte Themes

Cloudflare D1 Svelte Template

πŸš€ SvelteKit + Cloudflare D1 Template

A modern, production-ready full-stack template for building blazing-fast web applications


✨ Features

Feature Description
⚑ SvelteKit 5 Latest Svelte with runes, server-side rendering, and file-based routing
☁️ Cloudflare Workers Edge-first deployment with global distribution and near-zero cold starts
πŸ—„οΈ Cloudflare D1 Serverless SQLite database with automatic replication
🎨 Tailwind CSS Utility-first CSS framework for rapid UI development
πŸ”§ Drizzle ORM Type-safe, lightweight ORM with migrations support
🌍 Paraglide i18n Fully type-safe internationalization (EN/VI)
πŸ“¦ Bun Ultra-fast JavaScript runtime and package manager
βœ… ESLint + Prettier Consistent code style and automatic formatting

πŸ› οΈ Tech Stack

β”œβ”€β”€ 🎯 Framework      β†’ SvelteKit 5 (Svelte 5 with Runes)
β”œβ”€β”€ 🌐 Runtime        β†’ Cloudflare Workers (Edge)
β”œβ”€β”€ πŸ’Ύ Database       β†’ Cloudflare D1 (SQLite)
β”œβ”€β”€ πŸ”— ORM            β†’ Drizzle ORM
β”œβ”€β”€ 🎨 Styling        β†’ Tailwind CSS
β”œβ”€β”€ 🌍 i18n           β†’ Paraglide
β”œβ”€β”€ πŸ“¦ Package Mgr    β†’ Bun
β”œβ”€β”€ πŸ” Linting        β†’ ESLint
└── ✨ Formatting     β†’ Prettier

πŸš€ Quick Start

Prerequisites

Installation

# Clone this template
git clone <your-repo-url>
cd <project-name>

# Install dependencies
bun install

# Start development server
bun run dev

Database Setup

# Generate migrations
bun run db:generate

# Push migrations to local D1
bun run db:migrate

# Open Drizzle Studio (database GUI)
bun run db:studio

πŸ“ Project Structure

β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ lib/           # Reusable library code
β”‚   β”‚   β”œβ”€β”€ server/    # Server-only utilities (DB, auth, etc.)
β”‚   β”‚   └── components/# Svelte components
β”‚   β”œβ”€β”€ routes/        # SvelteKit file-based routing
β”‚   └── app.css        # Global styles
β”œβ”€β”€ drizzle/           # Database migrations
β”œβ”€β”€ messages/          # i18n translation files
β”œβ”€β”€ wrangler.jsonc     # Cloudflare Workers config
└── drizzle.config.ts  # Drizzle ORM config

πŸ“œ Available Scripts

Command Description
bun run dev Start development server
bun run build Build for production
bun run preview Preview production build locally
bun run check Type-check the project
bun run lint Lint & format code
bun run db:generate Generate Drizzle migrations
bun run db:migrate Apply migrations
bun run db:studio Open Drizzle Studio

☁️ Deployment

Deploy to Cloudflare Workers with a single command:

# Deploy to production
bun run deploy

Note: Make sure you've configured your wrangler.jsonc and drizzle.config.ts and authenticated with Cloudflare CLI.


πŸ“„ License

MIT Β© VΕ© ThΓ nh Trung


Built with ❀️ using SvelteKit and Cloudflare

Documentation Β· Report Bug Β· Request Feature

Top categories

Loading Svelte Themes