Turbo Setup: Tauri + React 19.2.3, TypeScript & TailwindCSS v4 Boilerplate
Build powerful cross-platform desktop applications with a modern Tauri starter powered by React 19.2.3, TypeScript, and TailwindCSS v4. Enjoy native performance, small bundle sizes, and seamless integration between Rust backend and React frontend. Create once, deploy everywhere with confidence.
π Features
- βοΈ React 19.2.3 + TypeScript - Modern React with full TypeScript support.
- π¨ Tailwind CSS v4 - Utility-first CSS for rapid UI development.
- β‘ Vite - Next-generation frontend tooling for fast builds.
- π ESLint - Code linting for consistent code quality.
- π§Ή Prettier - Automated code formatting for style consistency.
- πͺ Husky & lint-staged - Pre-commit hooks for linting and formatting your code.
- π·οΈ Commitlint - Enforces conventional commit messages.
- π¦ Zustand - Simple and fast state management.
- πΊοΈ React Router - Declarative routing for React apps.
- π Day.js - Lightweight date manipulation library.
- π Axios - Promise-based HTTP client for the browser.
- π Custom useFetch Hook - Lightweight data fetching with loading and error states (replaces SWR).
- π₯οΈ Tauri - Cross-platform desktop applications with native performance.
- π UseAuth - Authentication and authorization.
π οΈ Prerequisites
- Node.js (v18 or higher)
- Bun (latest version)
- Rust (latest stable version) - for Tauri desktop functionality
π¦ Installation
Clone the repository
git clone https://github.com/khoivudevz/turbo-setup-tauri-reactInstall dependencies
bun installπ Development
Web Development
bun dev # Development mode
bun dev:stg # Staging mode
bun dev:prod # Production modeDesktop Application (Tauri)
bun run tauri:dev # Start Tauri desktop app in development mode
bun run tauri:build # Build Tauri desktop app for productionBuilding for Production
bun build # Production build (web)
bun build:stg # Staging build (web)
bun build:dev # Development build (web)
bun run tauri:build # Production build (desktop app)π Project Structure
src/
βββ assets/ # Static assets (images, fonts, icons)
βββ components/ # Reusable UI components
βββ configs/ # Configuration files (env, http, app urls)
βββ constants/ # Application constants and shared values
βββ hooks/ # Custom React hooks (useNews, useFetch, useMutation, useKeyPress)
βββ layouts/ # Layout components and templates
βββ pages/ # Page components
βββ providers/ # React context providers
βββ router/ # Routing configuration
βββ services/ # Browser services (cookies, localStorage)
βββ store/ # State management with Zustand
βββ styles/ # Global styles and Tailwind imports
βββ types/ # TypeScript type definitions
βββ utils/ # Utility functions
βββ views/ # View componentsπ₯οΈ Desktop Application (Tauri)
This project can be run as a cross-platform desktop application using Tauri. The desktop app provides:
- Cross-platform support: Windows, macOS, and Linux
- Native performance: Rust backend with web frontend
- Small bundle size: Efficient resource usage
- Native system integration: File system access, notifications, system tray
Tauri Configuration
The Tauri configuration is located in src-tauri/tauri.conf.json. Key settings include:
- App name: "Turbo setup Tauri x React 19, TypeScript & Tailwind and more..."
- Window title: "Turbo setup Tauri x React 19, TypeScript & Tailwind and more..."
- Window size: 800x600 (resizable)
- Web assets: Built from React app in
build/directory - Dev server: http://localhost:8000
Building for Different Platforms
# Build for current platform
bun run tauri:build
# The built application will be in src-tauri/target/release/bundle/π§ Configuration
Environment Variables
Create .env files for different environments:
VITE_ENV=development
VITE_API_URL=your_api_urlTypeScript
The project includes two TypeScript configurations:
tsconfig.app.json- Application configurationtsconfig.node.json- Node.js configuration
ESLint & Prettier
- ESLint is configured with TypeScript and React rules
- Prettier is set up with custom formatting rules
- Pre-commit hooks ensure code quality
π Internationalization (i18n)
This project uses i18next with react-i18next for internationalization support. The translations are stored in JSON files located in the src/i18n/translations directory.
Adding a New Language
- Create a new JSON file in the
src/i18n/translationsdirectory with the language code as the filename (e.g.,fr.jsonfor French). - Add your translations in the new JSON file.
Using Translations
import {useTranslation} from 'react-i18next'
import SwitchLanguage from '@/components/SwitchLanguage/SwitchLanguage'
const HomeView = () => {
const {t} = useTranslation()
return (
<div>
<p>{t('welcome')}</p>
<SwitchLanguage />
</div>
)
}π‘ Data Fetching
This project uses a Custom useFetch Hook for data fetching, which provides features like:
- Automatic data fetching
- Loading and error states
- Manual execution control
- Success/error callbacks
- TypeScript ready
- No external dependencies
useFetch Hook Example
Using the custom useFetch hook:
import {useFetch} from '@/hooks/use-fetch'
const MyComponent = () => {
const {data, isLoading, error, execute, reset} = useFetch(() =>
fetch('/api/news').then(res => res.json())
)
if (isLoading) return <div>Loading...</div>
if (error) return <div>Error loading data</div>
return (
<div>
{data?.map(item => (
<div key={item.id}>{item.name}</div>
))}
<button onClick={execute}>Refresh</button>
</div>
)
}π€ Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes using conventional commits
- Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
π License
This project is licensed under the MIT License.