A modern desktop application template that combines the power of Tauri (Rust), SvelteKit (TypeScript), and Python FastAPI. This template provides a complete cross-platform desktop development environment with a beautiful frontend, robust backend API, and native system integration.
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā
ā SvelteKit āāāāāŗā Tauri āāāāāŗā Python FastAPI ā
ā Frontend ā ā (Rust Core) ā ā Sidecar ā
ā ā ā ā ā ā
ā ⢠TypeScript ā ā ⢠Window Mgmt ā ā ⢠REST API ā
ā ⢠Tailwind CSS ā ā ⢠File System ā ā ⢠Data Process ā
ā ⢠Component UI ā ā ⢠Native APIs ā ā ⢠ML/AI Ready ā
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā
Before you begin, ensure you have the following installed:
npm install -g pnpm
xcode-select --install
sudo apt update
sudo apt install libwebkit2gtk-4.0-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
Clone or download this template, then run:
# Install all dependencies (Node.js and Python)
pnpm run install-reqs
Create your app configuration:
# Copy the example configuration
cp app.config.example.json app.config.json
# Edit the configuration with your app details
# Configure app name, bundle ID, window settings, etc.
Apply the configuration:
# Configure all project files based on your app.config.json
python configure.py
Choose your development workflow:
# Start the complete development environment
pnpm tauri dev
This starts:
# Frontend only (for UI development)
pnpm run dev
# Or with standalone Python backend
pnpm run dev:standalone
# Python API development with auto-reload
pnpm run dev:api
tauri-svelte-python/
āāā src/ # SvelteKit frontend
ā āāā lib/ # Shared components and utilities
ā āāā routes/ # Page components and routing
ā āāā app.html # HTML template
ā āāā app.css # Global styles
āāā src-python/ # Python backend
ā āāā api/ # API endpoints and logic
ā ā āāā __init__.py
ā ā āāā endpoints.py # REST API routes
ā āāā main.py # FastAPI application entry point
ā āāā requirements.txt # Python dependencies
āāā src-tauri/ # Tauri application
ā āāā src/ # Rust source code
ā āāā tauri.conf.json # Tauri configuration
ā āāā Cargo.toml # Rust dependencies
ā āāā bin/ # Compiled Python sidecar binaries
āāā static/ # Static assets
āāā build.py # Production build script
āāā configure.py # Configuration management
āāā app.config.json # App configuration (create from example)
āāā package.json # Node.js project configuration
The app is configured through app.config.json
. Key sections:
{
"app": {
"name": "my-app",
"productName": "My App",
"version": "1.0.0",
"description": "My desktop application",
"author": "Your Name"
}
}
{
"window": {
"title": "My App",
"width": 1200,
"height": 800,
"resizable": true
}
}
{
"python": {
"port": 8008,
"host": "127.0.0.1",
"title": "My App API"
}
}
After modifying app.config.json
, run:
pytho configure.py
The frontend is located in src/
and uses:
# Start frontend development
pnpm run dev
# Build frontend
pnpm run build
# Preview production build
pnpm run start
The backend API is in src-python/
and provides:
# Start Python API with auto-reload
pnpm run dev:api
# Or activate virtual environment manually
source .venv/bin/activate # On macOS/Linux
# .venv\Scripts\activate # On Windows
cd src-python
uvicorn main:app --reload --port 8008
# Activate virtual environment
source .venv/bin/activate
# Install new packages
pip install package-name
# Update requirements.txt
pip freeze > src-python/requirements.txt
# Add new Node.js packages
pnpm add package-name
# Add development dependencies
pnpm add -D package-name
Add new endpoints in src-python/api/endpoints.py
:
from fastapi import APIRouter
router = APIRouter()
@router.get("/my-endpoint")
async def my_endpoint():
return {"message": "Hello from Python!"}
Access APIs from frontend:
// In SvelteKit components
const response = await fetch('http://localhost:8008/v1/my-endpoint');
const data = await response.json();
# Build everything (icons, sidecar, frontend, desktop app)
python build.py
This creates platform-specific bundles in src-tauri/target/release/bundle/
:
.app
and .dmg
files.exe
and .msi
files .AppImage
, .deb
, and .rpm
files# Build only Python sidecar
python build.py --sidecar
# Complete build
python build.py
# this is also same as above
pnpm tauri build
# Generate app icons from source image
pnpm run build:icons
Ensure your icon source is specified in app.config.json
:
{
"icon": {
"source": "static/app-icon.png",
"generate": true
}
}
This project is licensed under the MIT License - see the package.json file for details.