tauri-svelte-template Svelte Themes

Tauri Svelte Template

tauri2 + svelteKit + tailwind css4

Tauri v2 + SvelteKit Template

A modern desktop application template built with:

  • Tauri v2 - Build smaller, faster, and more secure desktop applications
  • SvelteKit - The fastest way to build Svelte apps with routing and SSG
  • Svelte 5 - Cybernetically enhanced web apps with runes
  • Vite - Next generation frontend tooling
  • TypeScript - Type-safe development
  • Tailwind CSS 4 - Utility-first CSS framework
  • Biome - Fast formatter and linter
  • pnpm - Fast, disk space efficient package manager
  • Husky + lint-staged - Git hooks for quality control

Features

✨ Modern Stack

  • Tauri v2 for native desktop capabilities
  • SvelteKit with static adapter for SPA mode
  • Svelte 5 with the latest runes API
  • Tailwind CSS 4 with Vite plugin integration
  • Full TypeScript support

šŸ› ļø Developer Experience

  • Fast builds with Vite
  • File-based routing with SvelteKit
  • Code formatting and linting with Biome
  • Pre-commit hooks with Husky
  • Staged file linting with lint-staged

šŸš€ CI/CD Ready

  • GitHub Actions workflows included
  • Multi-platform builds (Windows, macOS, Linux)
  • Automated releases

Prerequisites

Platform-specific requirements

Linux:

sudo apt update
sudo apt install libwebkit2gtk-4.1-dev \
  build-essential \
  curl \
  wget \
  file \
  libxdo-dev \
  libssl-dev \
  libayatana-appindicator3-dev \
  librsvg2-dev

macOS:

  • Xcode Command Line Tools

Windows:

  • Microsoft Visual Studio C++ Build Tools

Getting Started

  1. Clone the repository:

    git clone https://github.com/HONGJICAI/tauri-svelte-template.git
    cd tauri-svelte-template
    
  2. Install dependencies:

    pnpm install
    
  3. Run the development server:

    pnpm tauri:dev
    

Available Scripts

  • pnpm dev - Start Vite dev server
  • pnpm build - Build the frontend
  • pnpm preview - Preview the built frontend
  • pnpm tauri:dev - Run Tauri in development mode
  • pnpm tauri:build - Build the Tauri application
  • pnpm check - Run Svelte type checking
  • pnpm lint - Run Biome linter
  • pnpm lint:fix - Run Biome linter and fix issues
  • pnpm format - Format code with Biome

Project Structure

tauri-svelte-template/
ā”œā”€ā”€ .github/
│   └── workflows/         # GitHub Actions workflows
ā”œā”€ā”€ .husky/                # Husky git hooks
ā”œā”€ā”€ src/                   # SvelteKit source files
│   ā”œā”€ā”€ routes/            # SvelteKit file-based routes
│   │   ā”œā”€ā”€ +layout.svelte # Root layout
│   │   ā”œā”€ā”€ +layout.ts     # Layout config (prerender, ssr)
│   │   └── +page.svelte   # Home page
│   ā”œā”€ā”€ lib/               # Reusable components and utilities
│   ā”œā”€ā”€ app.html           # HTML template
│   └── app.css            # Global styles with Tailwind
ā”œā”€ā”€ src-tauri/             # Tauri (Rust) source files
│   ā”œā”€ā”€ src/
│   │   ā”œā”€ā”€ main.rs        # Tauri entry point
│   │   └── lib.rs         # Library code
│   ā”œā”€ā”€ icons/             # Application icons
│   ā”œā”€ā”€ Cargo.toml         # Rust dependencies
│   └── tauri.conf.json    # Tauri configuration
ā”œā”€ā”€ static/                # Static assets
ā”œā”€ā”€ package.json           # Node dependencies and scripts
ā”œā”€ā”€ pnpm-workspace.yaml    # pnpm workspace configuration
ā”œā”€ā”€ biome.json             # Biome configuration
ā”œā”€ā”€ svelte.config.js       # SvelteKit configuration
ā”œā”€ā”€ tsconfig.json          # TypeScript configuration
└── vite.config.ts         # Vite configuration

Building for Production

Build the application for your current platform:

pnpm tauri:build

The built application will be in src-tauri/target/release/bundle/.

Customization

Tailwind CSS

Tailwind CSS 4 is integrated via the Vite plugin. Customize styles in src/app.css using the @import "tailwindcss" syntax.

Biome

Modify linting and formatting rules in biome.json.

Tauri

Configure the application in src-tauri/tauri.conf.json:

  • Window properties
  • Application identifier
  • Bundle settings
  • Security policies

CI/CD

Two GitHub Actions workflows are included:

  1. CI (.github/workflows/ci.yml):

    • Runs on push and pull requests
    • Lints and formats code
    • Type checks
    • Builds the application on all platforms
  2. Release (.github/workflows/release.yml):

    • Triggers on version tags (e.g., v1.0.0)
    • Builds and publishes releases for all platforms

License

This template is open source and available under the MIT License.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Top categories

Loading Svelte Themes