A modern cookiecutter template for Svelte 5 projects with TypeScript, Tailwind CSS, and Bun.
The generated project includes:
your-project/
โโโ src/
โ โโโ lib/
โ โ โโโ components/ # Reusable UI components
โ โ โ โโโ ui/ # Basic UI elements
โ โ โ โโโ features/ # Feature-specific components
โ โ โโโ utils/ # Utility functions
โ โ โโโ hooks/ # Custom Svelte 5 runes/hooks
โ โ โโโ stores/ # Svelte stores
โ โ โโโ api/ # API functions
โ โ โโโ config/ # Application configuration
โ โ โโโ assets/ # Static assets
โ โ โโโ vendor/ # Third-party components
โ โโโ routes/ # SvelteKit routes
โ โโโ styles/ # Global styles
โ โโโ app.html # HTML template
โ โโโ app.css # Main CSS entry point
โ โโโ app.d.ts # TypeScript declarations
โโโ static/ # Static files
โโโ package.json
โโโ svelte.config.js
โโโ vite.config.ts
โโโ tailwind.config.js
โโโ tsconfig.json
uvx cookiecutter https://github.com/mort-sh/svelte.git
pip install cookiecutter
cookiecutter https://github.com/mort-sh/svelte.git
cookiecutter gh:mort-sh/svelte
After generating your project:
Navigate to your project directory:
cd your-project-name
Install Bun if you haven't already:
curl -fsSL https://bun.sh/install | bash
Install dependencies:
bun install
Start the development server:
bun dev
Open your browser and visit http://localhost:5173 (or the port you configured)
When you run the cookiecutter command, you'll be prompted to configure:
The generated project includes these scripts:
bun dev - Start development serverbun run build - Build for production bun run preview - Preview production buildbun run check - Run TypeScript and Svelte checksbun run format - Format code with Prettierbun run lint - Lint code with ESLintbun run test - Run tests (if testing is enabled)If you enabled Docker support, you can:
# Build the image
docker build -t your-app .
# Run the container
docker run -p 3000:3000 your-app
The template sets up convenient path aliases:
$lib โ src/lib$components โ src/lib/components$ui โ src/lib/components/ui$features โ src/lib/components/features$utils โ src/lib/utils$assets โ src/lib/assets$hooks โ src/lib/hooks$stores โ src/lib/stores$api โ src/lib/api$config โ src/lib/config$vendor โ src/lib/vendorUse them in your imports:
import Button from '$ui/Button.svelte';
import { formatDate } from '$utils/date.js';
Issues and pull requests are welcome! Please feel free to contribute to make this template even better.
This template is released under the MIT License.