{"id":43758784,"url":"https://github.com/fudanglp/tauri-fastapi-full-stack-template","last_synced_at":"2026-02-17T02:01:52.383Z","repository":{"id":336305552,"uuid":"1147126783","full_name":"fudanglp/tauri-fastapi-full-stack-template","owner":"fudanglp","description":"A production-ready template for building cross-platform desktop applications with a modern web frontend, Python FastAPI backend, and Rust integration layer.","archived":false,"fork":false,"pushed_at":"2026-02-03T19:12:49.000Z","size":640,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-02-04T08:37:54.576Z","etag":null,"topics":["boilerplate","cross-platform","desktop-app","fastapi","full-stack","openapi","python","react","rust","scaffold","shadcn-ui","sqlite","sqlmodel","starter","tailwindcss","tanstack-router","tauri","template","typescript","vite"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fudanglp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-01T08:33:51.000Z","updated_at":"2026-02-04T06:10:19.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/fudanglp/tauri-fastapi-full-stack-template","commit_stats":null,"previous_names":["fudanglp/tauri-fastapi-full-stack-template"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/fudanglp/tauri-fastapi-full-stack-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fudanglp%2Ftauri-fastapi-full-stack-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fudanglp%2Ftauri-fastapi-full-stack-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fudanglp%2Ftauri-fastapi-full-stack-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fudanglp%2Ftauri-fastapi-full-stack-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fudanglp","download_url":"https://codeload.github.com/fudanglp/tauri-fastapi-full-stack-template/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fudanglp%2Ftauri-fastapi-full-stack-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29530139,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T00:57:22.232Z","status":"online","status_checked_at":"2026-02-17T02:00:08.105Z","response_time":100,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["boilerplate","cross-platform","desktop-app","fastapi","full-stack","openapi","python","react","rust","scaffold","shadcn-ui","sqlite","sqlmodel","starter","tailwindcss","tanstack-router","tauri","template","typescript","vite"],"created_at":"2026-02-05T15:00:22.970Z","updated_at":"2026-02-17T02:01:52.374Z","avatar_url":"https://github.com/fudanglp.png","language":"TypeScript","readme":"# Tauri + FastAPI Full Stack Template\n\n\u003e A **template** for building desktop applications with Tauri (Rust), FastAPI (Python), and React (TypeScript).\n\nThis project combines two excellent templates:\n\n- **[Tauri](https://tauri.app)** - Cross-platform desktop apps with Rust\n- **[FastAPI Full Stack Template](https://github.com/fastapi/full-stack-fastapi-template)** - Production-ready backend/frontend stack (forked from commit [`1c6d656`](https://github.com/fastapi/full-stack-fastapi-template/commit/1c6d6564))\n\nThis is a **starter template** designed to be customized for your own application. It provides a complete full-stack desktop app foundation with optional authentication.\n\n![App Screenshot](docs/assets/screenshot-dashboard.png)\n\n## Architecture \u0026 Tech Stack\n\n### Technology Stack\n\n- **Frontend**: React + TypeScript with Vite, TanStack Router, TanStack Query, Tailwind CSS, shadcn/ui\n- **Backend**: FastAPI with SQLite, SQLModel, Alembic migrations, Pydantic settings\n- **Desktop**: Tauri 2 with sidecar architecture (FastAPI runs as bundled binary)\n- **Auth**: Optional - disabled by default for local desktop use\n- **Build**: PyInstaller bundles Python backend into single binary, Tauri creates native installers\n\n### Architecture Overview\n\nThis is a **three-process desktop application**:\n\n```mermaid\ngraph TB\n    subgraph \"Tauri Desktop App\"\n        Frontend[React Frontend\u003cbr/\u003eWebView]\n        Rust[Rust Backend\u003cbr/\u003eTauri]\n        Frontend \u003c--\u003e|IPC Commands| Rust\n    end\n\n    Frontend --\u003e|HTTP REST\u003cbr/\u003elocalhost:1420→1430| FastAPI\n    FastAPI --\u003e|Unix Socket| Rust\n\n    subgraph \"FastAPI Sidecar\"\n        FastAPI[FastAPI\u003cbr/\u003ePython]\n        DB[(SQLite DB)]\n        FastAPI --\u003e DB\n    end\n```\n\n**How the processes communicate**:\n- **Frontend → Tauri**: IPC commands (native operations like windows, file dialogs)\n- **Frontend → FastAPI**: HTTP REST (database queries, business logic)\n- **Tauri → FastAPI**: HTTP (health checks during startup)\n- **FastAPI → Tauri**: Unix socket (desktop features like window control)\n\n📖 **See [docs/IPC.md](docs/IPC.md)** for complete documentation on communication patterns.\n\n### Project Structure\n\n```\n├── frontend/          # React + TypeScript + Vite\n│   ├── src/\n│   │   ├── routes/   # TanStack Router file-based routing\n│   │   ├── components/\n│   │   ├── client/   # API client (auto-generated)\n│   │   └── hooks/    # React hooks (useAuth, etc.)\n│   └── openapi.json  # OpenAPI schema (auto-generated)\n├── fastapi/          # Python FastAPI backend\n│   ├── app/\n│   │   ├── api/      # API routes\n│   │   ├── core/     # Config, DB, logging\n│   │   ├── models.py # SQLModel database models\n│   │   └── crud/     # Database operations\n│   └── alembic/      # Database migrations\n├── tauri/            # Rust desktop app\n│   ├── src/\n│   │   ├── lib.rs    # Main app, sidecar management\n│   │   └── config.rs # Rust config from env vars\n│   └── binaries/     # Bundled sidecar binary (generated)\n└── scripts/          # Utility scripts (generate-client, etc.)\n```\n\n### Data Management\n\n**Database**: SQLite (included with Python standard library, no external server needed)\n\n**Location**:\n- **Dev**: `.data/app.db` (project root)\n- **Production (Linux)**: `~/.local/share/com.example.tauri-fastapi-full-stack-template/app.db`\n- **Production (macOS)**: `~/Library/Application Support/com.example.tauri-fastapi-full-stack-template/app.db`\n- **Production (Windows)**: `%APPDATA%\\com.example.tauri-fastapi-full-stack-template\\app.db`\n\n**Models**: SQLModel with automatic TypeScript/Rust type generation via OpenAPI\n\n```mermaid\nflowchart LR\n    A[FastAPI Models\u003cbr/\u003eSQLModel] --\u003e B[OpenAPI Schema\u003cbr/\u003eopenapi.json]\n    B --\u003e C[TypeScript Types\u003cbr/\u003eauto-gen]\n    B --\u003e D[Rust Types\u003cbr/\u003eauto-gen]\n```\n\n**Migrations**: Alembic for schema version control\n\n📖 **See [docs/data-management.md](docs/data-management.md)** for complete documentation on data storage, migrations, and models.\n\n## Development\n\n### Quick Start\n\nGet the app running in 3 steps:\n\n**1. Install system tools** (first time only):\n\n- [Rust](https://www.rust-lang.org/tools/install) (via rustup)\n- [bun](https://bun.sh/docs/installation/) (includes Node.js)\n- [uv](https://docs.astral.sh/uv/getting-started/installation/) (includes Python)\n\n**2. Install project dependencies** (first time only):\n\n```bash\nmake setup\n```\n\nThis installs:\n- Tauri CLI (via cargo)\n- Frontend dependencies (via bun)\n- Backend Python packages (via uv)\n\n**3. Run the app**:\n\n```bash\n# Terminal 1: Start the FastAPI backend\nmake fastapi\n\n# Terminal 2: Start the Tauri desktop app\nmake dev\n```\n\nThe app opens at http://localhost:1420 with the backend API at http://localhost:1430.\n\n**Why two terminals?** In development mode, the backend runs separately so you get hot-reload and easier debugging. Tauri doesn't spawn the sidecar binary in dev mode.\n\n### Requirements\n\n**System tools** (install separately first):\n\n1. **[Rust](https://www.rust-lang.org/tools/install)** (via rustup)\n   - Required by Tauri\n   - After installing Rust, `make setup` will install [Tauri CLI](https://tauri.app/v2/guides/getting-started/prerequisites)\n\n2. **[bun](https://bun.sh/docs/installation/)**\n   - Includes [Node.js](https://nodejs.org/) runtime\n   - Frontend package manager\n\n3. **[uv](https://docs.astral.sh/uv/getting-started/installation/)**\n   - Includes [Python 3.11+](https://www.python.org/downloads/) runtime\n   - Backend package manager\n\n4. **System**: Linux, macOS, or Windows\n\n### Frontend Development\n\n**Stack**: React + TypeScript, Vite, TanStack Router (file-based), TanStack Query, Tailwind CSS, shadcn/ui\n\n**File structure**:\n```\nfrontend/src/\n├── routes/          # File-based routing (TanStack Router)\n├── components/      # Reusable UI components\n├── client/          # Auto-generated API client\n└── hooks/           # Custom React hooks\n```\n\n**Typical tasks**:\n\n1. **Add a new page/route**:\n   ```bash\n   # Create route file\n   touch frontend/src/routes/about.tsx\n   ```\n   ```typescript\n   // frontend/src/routes/about.tsx\n   import { createFileRoute } from '@tanstack/react-router'\n\n   export const Route = createFileRoute('/about')({\n     component: About,\n   })\n\n   function About() {\n     return \u003cdiv\u003eAbout Page\u003c/div\u003e\n   }\n   ```\n\n2. **Add a widget/component**:\n   ```bash\n   # Create component\n   touch frontend/src/components/StatsCard.tsx\n   ```\n   ```typescript\n   // frontend/src/components/StatsCard.tsx\n   export function StatsCard({ title, value }: { title: string; value: number }) {\n     return (\n       \u003cdiv className=\"p-4 border rounded-lg\"\u003e\n         \u003ch3 className=\"text-lg font-semibold\"\u003e{title}\u003c/h3\u003e\n         \u003cp className=\"text-2xl\"\u003e{value}\u003c/p\u003e\n       \u003c/div\u003e\n     )\n   }\n   ```\n\n3. **Call API endpoints**:\n   ```typescript\n   import { client } from '@/client/client'\n   import { useQuery, useMutation } from '@tanstack/react-query'\n\n   // GET request\n   const { data: users } = useQuery({\n     queryKey: ['users'],\n     queryFn: () =\u003e client.GET('/api/v1/users/'),\n   })\n\n   // POST request\n   const createUser = useMutation({\n     mutationFn: (data: UserCreate) =\u003e\n       client.POST('/api/v1/users/', { body: data }),\n   })\n   ```\n\n4. **Styling with Tailwind**:\n   ```typescript\n   // Utility classes for styling\n   \u003cdiv className=\"flex items-center gap-4 p-4 bg-white rounded-lg shadow\"\u003e\n     {/* Content */}\n   \u003c/div\u003e\n   ```\n\n**Hot reload**: Vite automatically reloads the frontend when you save changes.\n\n### FastAPI Backend Development\n\n**Stack**: FastAPI, SQLModel, Alembic (migrations), Pydantic (validation)\n\n**File structure**:\n```\nfastapi/app/\n├── api/             # API routes\n├── core/            # Config, database, logging\n├── models.py        # SQLModel database models\n└── crud.py          # Database operations\n```\n\n**Data models** (detailed docs: [docs/data-management.md](docs/data-management.md)):\n\n1. **Add a new model**:\n   ```python\n   # fastapi/app/models.py\n   from sqlmodel import SQLModel, Field\n   from datetime import datetime\n   from uuid import UUID, uuid4\n\n   class ProductBase(SQLModel):\n       name: str = Field(max_length=255)\n       price: float = Field(gt=0)\n\n   class Product(ProductBase, table=True):\n       id: UUID = Field(default_factory=uuid4, primary_key=True)\n       created_at: datetime = Field(default_factory=datetime.utcnow)\n   ```\n\n2. **Create database migration**:\n   ```bash\n   cd fastapi\n   uv run alembic revision --autogenerate -m \"add products\"\n   uv run alembic upgrade head\n   ```\n\n3. **Regenerate API clients**:\n   ```bash\n   make generate-client\n   ```\n\n4. **Add API endpoint**:\n   ```python\n   # fastapi/app/api/routes/products.py\n   from fastapi import APIRouter, Depends\n   from app.models import Product, ProductCreate\n   from app.crud import create_product\n\n   router = APIRouter()\n\n   @router.post(\"/\", response_model=Product)\n   def create_new_product(\n       product: ProductCreate,\n       session: Session = Depends(get_session),\n   ):\n       return create_product(session, product)\n   ```\n\n5. **Update model (add/remove fields)**:\n   ```python\n   # Edit model in models.py\n   class ProductBase(SQLModel):\n       name: str = Field(max_length=255)\n       price: float = Field(gt=0)\n       description: str | None = Field(default=None)  # New field\n\n   # Create migration\n   cd fastapi\n   uv run alembic revision --autogenerate -m \"add product description\"\n   uv run alembic upgrade head\n\n   # Regenerate API clients\n   make generate-client\n   ```\n\n**Test API**:\n- Swagger UI: http://localhost:1430/docs (interactive API docs)\n- ReDoc: http://localhost:1430/redoc (alternative docs)\n\n### Tauri (Rust) Development\n\n**Stack**: Rust, Tauri 2\n\n**File structure**:\n```\ntauri/src/\n├── lib.rs           # Main app, Tauri commands\n├── config.rs        # Rust config from environment variables\n└── socket_server.rs # Unix socket server for FastAPI → Rust communication\n```\n\n**Typical tasks**:\n\n1. **Add a Rust dependency**:\n   ```toml\n   # tauri/Cargo.toml\n   [dependencies]\n   serde_json = \"1.0\"\n   ```\n\n2. **Add a Tauri command (IPC)**:\n   ```rust\n   // tauri/src/lib.rs\n   #[tauri::command]\n   fn greet(name: \u0026str) -\u003e String {\n       format!(\"Hello, {}!\", name)\n   }\n\n   // Register in main()\n   fn main() {\n       tauri::Builder::default()\n           .invoke_handler(tauri::generate_handler![greet])\n           .run(tauri::generate_context!())\n           .expect(\"error while running tauri application\");\n   }\n   ```\n\n3. **Call Tauri command from frontend**:\n   ```typescript\n   import { invoke } from '@tauri-apps/api/core'\n\n   const greeting = await invoke('greet', { name: 'World' })\n   ```\n\n4. **Test Tauri commands**:\n   ```bash\n   # Run Tauri dev (requires backend running separately)\n   make dev\n   ```\n\n5. **Build Rust backend**:\n   ```bash\n   # Build only the Rust part\n   cd tauri\n   cargo build\n   ```\n\n**Communication with FastAPI**: See [docs/IPC.md](docs/IPC.md) for Unix socket communication patterns.\n\n### Make Targets\n\n```bash\nmake setup            # Install all dependencies\nmake dev              # Run development mode (requires backend running)\nmake dev-frontend     # Frontend only (if backend is already running)\nmake fastapi          # Backend only (for debugging)\nmake init-db          # Initialize/reset database\nmake generate-client  # Generate API clients from OpenAPI schema\nmake package-backend  # Package FastAPI backend binary\nmake package          # Package production bundles\nmake clean            # Clean all build artifacts\nmake help             # Show all targets\n```\n\n### Customization\n\nThis is a **template** - customize these project-specific settings for your application:\n\n**1. Rename the app** - Edit `tauri/tauri.conf.json`:\n```json\n{\n  \"productName\": \"your-app-name\",\n  \"identifier\": \"com.yourcompany.your-app-name\",\n  \"title\": \"Your App Name\"\n}\n```\n\n**2. Update backend config** - Edit `fastapi/app/core/config.py`:\n```python\nPROJECT_NAME: str = \"Your App Name\"\nAUTH_REQUIRED: bool = False  # Set to True to enable authentication\n```\n\n**3. Update frontend branding** - Edit `frontend/src/routes/_layout.tsx`:\n```typescript\n// Change page title, branding, etc.\n```\n\nFor adding features (routes, models, API endpoints), see the [Development](#development) sections above.\n\n### Building for Production\n\nPackage the distributable application:\n\n```bash\n# Package everything (frontend + backend binary + Tauri app)\nmake package\n\n# Or package step by step:\nmake package-backend  # PyInstaller: tauri/binaries/fastapi-server-{arch}-{os}\ncargo tauri build     # Creates .deb, .rpm, .AppImage (Linux)\n```\n\nOutput: `tauri/target/release/bundle/`\n\n**What happens during build**:\n1. Frontend builds to static files\n2. Python backend bundles into PyInstaller binary\n3. Tauri creates platform-specific installers\n4. In production, Tauri automatically spawns the FastAPI sidecar with proper data directory\n\n## License\n\nMIT - use this template for anything you want.\n","funding_links":[],"categories":["Getting Started"],"sub_categories":["Templates"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffudanglp%2Ftauri-fastapi-full-stack-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffudanglp%2Ftauri-fastapi-full-stack-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffudanglp%2Ftauri-fastapi-full-stack-template/lists"}