Skip to content
Cursor Rules Generator
Frontend4 sections

Tauri Cursor Rules Template

Generate production-ready Tauri Cursor rules for Project Rules (.mdc), AGENTS.md, or legacy .cursorrules. This template encodes stack-specific conventions for projects using Tauri. Lightweight desktop framework with a Rust backend and web frontend.

The Complete Tauri Cursor Rules

The full rule set in all three formats Cursor understands — copy the one your project uses. Project Rules (.mdc) load per-file via globs, AGENTS.md is portable across AI tools, and .cursorrules is the legacy single-file format.

Replacing a legacy file? Read the guide to migrate .cursorrules to Cursor Project Rules (.mdc) before copying this template into your project.

.cursor/rules/tauri-architecture.mdc
---
description: "Tauri Architecture"
alwaysApply: false
---
- Separate concerns: Rust backend (src-tauri/) handles system operations, web frontend handles UI.
- Use Tauri commands (#[tauri::command]) for all backend operations — never call system APIs from the frontend.
- Keep the Rust backend focused on native functionality: file system, system tray, notifications, window management.
- Use the invoke() API in the frontend to call Rust commands, with typed parameters and return values.
- Configure tauri.conf.json with appropriate window settings, security policies, and bundle config.
- Use Tauri's event system for bidirectional communication between frontend and backend.
.cursor/rules/tauri-security.mdc
---
description: "Security"
alwaysApply: false
---
- Use the allowlist in tauri.conf.json to restrict which APIs are accessible from the frontend.
- Enable only the APIs your app actually needs — never enable the all permission broad flag.
- Use Tauri's CSP (Content Security Policy) to restrict resource loading.
- Validate all user input in Rust commands before processing.
- Use the tauri::api::path module for resolving standard directories instead of hardcoding paths.
- Keep Tauri CLI and Rust dependencies updated — follow the Tauri security advisories.
- Use Tauri's built-in updater for secure application updates.
.cursor/rules/tauri-rust-backend.mdc
---
description: "Rust Backend Patterns"
alwaysApply: false
---
- Use the Tauri State manager (tauri::State) for shared application state.
- Organize Rust code into modules: commands/, state/, utils/, error.rs.
- Use thiserror or anyhow for structured error handling in commands.
- Return Result<T, String> from Tauri commands for proper error propagation.
- Use async Tauri commands with tokio for non-blocking operations.
- Follow Rust naming conventions: snake_case functions, PascalCase types, SCREAMING_SNAKE_CASE constants.
- Use tracing or log crates for structured logging instead of println!.
.cursor/rules/tauri-frontend.mdc
---
description: "Frontend Integration"
alwaysApply: false
---
- Use @tauri-apps/api for calling Rust commands and accessing Tauri APIs from the frontend.
- Always handle invoke() errors with try/catch — Tauri commands can fail at runtime.
- Use TypeScript types that mirror your Rust command signatures for type safety.
- Use the @tauri-apps/api/window module for window management from the frontend.
- Prefer Tauri's built-in dialogs (tauri::api::dialog) over browser alert()/confirm().
- Keep the frontend framework-agnostic — Tauri works with React, Vue, Svelte, or vanilla HTML/JS.
- Use Vite for fast development builds — Tauri has first-class Vite integration.

Customize These Rules

The generator below is preloaded with the Tauri template. Adjust indentation, quotes, naming, add your own rules, then download — no need to start from scratch on the homepage.

What This Template Covers

Required guidance

  • - Tauri Architecture
  • - Security
  • - Rust Backend Patterns
  • - Frontend Integration

Default style

  • - Indentation: 2 spaces
  • - Quotes: single
  • - Semicolons: enabled
  • - Naming: camelCase

Frequently Asked Questions

What does the Tauri Cursor rules template include?
It includes 4 rule sections covering tauri architecture, security, rust backend patterns and other Tauri development conventions.
Can I generate Tauri Project Rules and AGENTS.md from the same template?
Yes. The generator can export the same stack-specific guidance as modern Project Rules (.mdc), AGENTS.md, or a legacy .cursorrules file.
Should I combine Tauri with other Cursor rules templates?
Yes. You can combine Tauri with related templates such as TypeScript, Tailwind CSS, Docker, or backend frameworks when your project uses multiple technologies.