A modern, fast cross-platform desktop application template.
This template uses Tauri to build lightweight, secure cross-platform desktop applications. It integrates a modern frontend tech stack: React (UI), Vite (build tool), Tailwind CSS (CSS framework), and Ant Design (UI component library). It uses pnpm for dependency management and TypeScript to enhance developer experience and code quality.
Combining a Rust backend with a modern frontend, it's an ideal starting point for building high-performance, secure desktop applications.
This project integrates the following core technologies:
- Tauri: Builds lightweight, secure, cross-platform desktop applications, leveraging Rust as the backend.
- React: A popular JavaScript library for building declarative user interfaces.
- Vite: A next-generation frontend build tool, known for its fast development server startup and build speeds.
- Tailwind CSS: A utility-first CSS framework that allows rapid UI building by composing classes.
- Integration Method: Uses the
@tailwindcss/vite
plugin and is imported via@import "tailwindcss";
in the main CSS file.
- Integration Method: Uses the
- Ant Design: An enterprise-class UI design language and React component library, ready to use out-of-the-box.
- pnpm: A fast and disk-space efficient package manager.
- TypeScript: A superset of JavaScript that provides static type checking, improving code maintainability.
- @types/node: Provides type definitions for Node.js APIs, ensuring type safety when using Node.js modules in files like
vite.config.ts
.
Before cloning and running the project, ensure your development environment meets the following requirements:
- Rust: Tauri's backend relies on Rust.
- Installation: Recommended to install using Rustup.
- Verification: After installation, run
rustc --version
andcargo --version
to check.
- Node.js: Required to run the frontend toolchain.
- Installation: Recommended to use the LTS version. You can download the installer or use a version manager (like nvm).
- Verification: After installation, run
node --version
to check.
- pnpm: The package manager used by the project.
- Installation: If not installed, install via npm:
npm install -g pnpm
- Verification: After installation, run
pnpm --version
to check.
- Installation: If not installed, install via npm:
- Tauri System Dependencies: Building Tauri applications requires specific system libraries and tools.
- Installation: Depending on your operating system, you might need to install additional dependencies. Refer to the official Tauri documentation for a detailed list:
- Common Dependencies:
- Windows: The "Desktop development with C++" workload from Visual Studio 2022 (or later).
- macOS: Xcode Command Line Tools (
xcode-select --install
). - Linux: Various development libraries and tools, depending on your distribution (e.g.,
webkit2gtk
,libappindicator3-dev
,librsvg2-dev
, etc.). Consult the official documentation.
Follow these steps to clone the repository, install dependencies, and start the development server:
-
Clone the repository:
git clone <repository_url> cd tauri-react-template # Assuming you cloned the repository into this directory
Replace
<repository_url>
with the actual repository URL. -
Install dependencies:
pnpm install
-
Run in development mode:
pnpm dev
Starts the Tauri application, loading the Vite development server, providing development conveniences like hot reloading.
To build the production executable, run:
pnpm build
After building, the executable is typically found in the src-tauri/target/release/
directory.
The core project directory structure is:
.
├── src/ # Frontend React application code
│ ├── main.tsx # Application entry point
│ ├── App.tsx # Main component
│ ├── index.css # Main style file
│ └── ... # Other components, pages, utility functions, etc.
├── src-tauri/ # Tauri backend (Rust) code and configuration
│ ├── src/ # Rust source code
│ │ └── main.rs # Rust application entry point
│ ├── tauri.conf.json # Tauri configuration file
│ └── ... # Other Rust modules or resources
├── index.html # Application's HTML entry file
├── vite.config.ts # Vite configuration file
├── tailwind.config.js # Tailwind CSS configuration file
├── package.json # Project dependencies and scripts
├── pnpm-lock.yaml # pnpm lock file
└── ... # Other configuration files (.gitignore, README.md, etc.)
- Frontend: Modify the React code in the
src/
directory, style files (src/index.css
or others), andtailwind.config.js
to customize the UI and functionality. - Backend: Modify
src-tauri/src/main.rs
andsrc-tauri/tauri.conf.json
to adjust Tauri configuration, add Rust backend logic, or call system APIs. - Dependencies: Use
pnpm add <package>
orpnpm remove <package>
to manage project dependencies.
This project is licensed under the MIT License. See the LICENSE
file for details.