A modern, fast, and beautiful template for building Svelte applications with Rsbuild, Tailwind CSS, and shadcn/ui components.
Tool | Version | Purpose |
---|---|---|
Rsbuild | Latest | Build tool & bundler |
Svelte | 5.x | Frontend framework |
Tailwind CSS | 4.x | Utility-first CSS |
shadcn/ui | Latest | UI component library |
TypeScript | 5.x | Type safety |
Bun | Latest | Package manager & runtime |
Biome | Latest | Linter & formatter |
Make sure you have Bun installed:
# Install Bun (if not already installed)
curl -fsSL https://bun.sh/install | bash
Clone the template
git clone <your-repo-url>
cd rsbuild-svelte-template
Install dependencies
bun install
Start development server
bun run dev
Open your browser
Navigate to http://localhost:3000
Command | Description |
---|---|
bun run dev |
Start development server with hot reload |
bun run build |
Build for production |
bun run start |
Build and serve production build |
bun run preview |
Preview production build |
bun run check |
Run Biome linter and formatter |
bun run format |
Format code with Biome |
bun run svelte-check |
Run Svelte type checking |
bun run commit |
Interactive commit with Commitizen |
bun run release |
Create a new release with release-it |
This template uses Commitizen with cz-git for conventional commits. This ensures consistent and meaningful commit messages.
Instead of using git commit
, use the interactive commit command:
# Interactive commit with Commitizen
bun run commit
This will guide you through creating a conventional commit message with:
Type | Description |
---|---|
feat |
A new feature |
fix |
A bug fix |
docs |
Documentation changes |
style |
Code style changes (formatting, etc.) |
refactor |
Code refactoring |
test |
Adding or updating tests |
chore |
Maintenance tasks |
perf |
Performance improvements |
ci |
CI/CD changes |
build |
Build system changes |
# Feature commit
feat(ui): add dark mode toggle
# Bug fix
fix(auth): resolve login redirect issue
# Documentation
docs(readme): update installation instructions
# Breaking change
feat(api)!: change user endpoint structure
BREAKING CHANGE: The user API endpoint has been restructured
This template uses release-it for automated versioning and releases. It automatically bumps version numbers, creates git tags, and generates changelogs based on your conventional commits.
Create a new release with the interactive release command:
# Interactive release process
bun run release
This will:
package.json
release-it automatically determines the version bump based on your commit types:
Commit Type | Version Bump | Example |
---|---|---|
feat: |
Minor (0.1.0 โ 0.2.0) | New features |
fix: |
Patch (0.1.0 โ 0.1.1) | Bug fixes |
feat!: or BREAKING CHANGE |
Major (0.1.0 โ 1.0.0) | Breaking changes |
Other types | Patch | Documentation, refactoring, etc. |
# Dry run (preview what would happen)
bun run release --dry-run
# Force a specific version
bun run release 1.2.3
# Force a specific bump type
bun run release --minor
bun run release --major
bun run release --patch
# Skip git operations (useful for CI/CD)
bun run release --no-git
# Create a pre-release version
bun run release --pre-release=beta
bun run release --pre-release=alpha
# Examples: 1.0.0-beta.1, 1.0.0-alpha.2
If you have a GitHub repository, release-it can also:
Configure this in your package.json
or .release-it.json
:
{
"github": {
"release": true,
"releaseNotes": "generate-changelog"
}
}
# 1. Make your changes
git add .
bun run commit # Use conventional commits
# 2. Create a release
bun run release
# 3. Push the release
git push --follow-tags
rsbuild-svelte-template/
โโโ src/
โ โโโ lib/
โ โ โโโ components/
โ โ โ โโโ ui/ # shadcn/ui components
โ โ โโโ utils.ts # Utility functions
โ โโโ App.svelte # Main app component
โ โโโ app.css # Global styles & Tailwind
โ โโโ index.ts # App entry point
โ โโโ env.d.ts # TypeScript declarations
โโโ dist/ # Production build output
โโโ rsbuild.config.ts # Rsbuild configuration
โโโ biome.json # Biome configuration
โโโ tailwind.config.js # Tailwind configuration
โโโ package.json
This template comes with shadcn-svelte pre-configured. To add new components:
Install a component using the CLI
# Install the shadcn-svelte CLI
bun add -D @huntabyte/shadcn-svelte
# Add components
bunx shadcn-svelte add button
bunx shadcn-svelte add card
bunx shadcn-svelte add input
bunx shadcn-svelte add dialog
Install required dependencies (if needed)
# Some components require bits-ui
bun add bits-ui
Use in your Svelte components
<script lang="ts">
import { Button } from "$lib/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "$lib/components/ui/card";
</script>
<Card>
<CardHeader>
<CardTitle>Welcome</CardTitle>
</CardHeader>
<CardContent>
<Button>Click me</Button>
</CardContent>
</Card>
shadcn-svelte provides many components including:
Visit the shadcn-svelte documentation for the complete list and examples.
The build tool is configured in rsbuild.config.ts
:
import { defineConfig } from '@rsbuild/core';
import { pluginSvelte } from '@rsbuild/plugin-svelte';
import tailwindcss from '@tailwindcss/vite';
export default defineConfig({
plugins: [pluginSvelte(), tailwindcss()],
});
Tailwind CSS v4 is configured with:
Biome is configured for:
bun run build
This creates an optimized build in the dist/
folder.
bun run start
This builds and serves your app at http://localhost:3333
.
bun run build
dist
bun run build
dist
src/
App.svelte
Edit the CSS variables in src/app.css
:
:root {
--background: oklch(1 0 0);
--foreground: oklch(0.129 0.042 264.695);
/* ... more variables */
}
# Add a new dependency
bun add <package-name>
# Add a dev dependency
bun add -d <package-name>
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.
Happy coding! ๐
If you find this template helpful, please give it a โญ star!