dchuk avatar

Calling Rust From Tauri Frontend

If you're building a Tauri v2 app and need to wire up your frontend to Rust backend functions, this walks you through the command system and invoke pattern. It focuses on type-safe IPC using the #[tauri::command] attribute macro, which is the recommended approach over events for bidirectional calls. The skill is part of a larger Tauri collection from dchuk with 23 GitHub stars and 167 installs. It's straightforward documentation rather than complex examples, so treat it as a reference when you forget the syntax or need to show Claude how Tauri's command system works. Useful if you're already committed to Tauri and just need the IPC basics in context.

skills.sh installs
361
GitHub stars
36
last updated
Aug 21, 2026

Install

$ npx -y skills add dchuk/claude-code-tauri-skills --skill calling-rust-from-tauri-frontend --agent claude-code

Installs into .claude/skills of the current project.

Files

Calling Rust from Tauri Frontend

This skill covers how to call Rust backend functions from your Tauri v2 frontend using the command system and invoke function.

Overview

Tauri provides two IPC mechanisms:

  • Commands (recommended): Type-safe function calls with serialized arguments/return values
  • Events: Dynamic, one-way communication (not covered here)

Basic Commands

Defining a Command in Rust

Use the #[tauri::command] attribute macro:

// src-tauri/src/lib.rs
#[tauri::command]
fn greet(name: String) -> String {
    format!("Hello, {}!", name)
}

Registering Commands

Commands must be registered with the invoke handler:

#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
    tauri::Builder::default()
        .invoke_handler(tauri::generate_handler![greet, login, fetch_data])
        .run(tauri::generate_context!())
        .expect("error while running tauri application")
}

Invoking from JavaScript/TypeScript

import { invoke } from '@tauri-apps/api/core';

const greeting = await invoke('greet', { name: 'World' });
console.log(greeting); // "Hello, World!"

Sponsors

Details

Repository
github.com/dchuk/claude-code-tauri-skills
Categories
Frontend Development, Backend & APIs, Rust, Mobile Development
First seen
Jun 3, 2026

More from dchuk/claude-code-tauri-skills

All 6
1schalkneethling avatarsemantic-htmlschalkneethling/webdev-agent-skillssemantic html351skills.sh installs
2cloudwego avatareino-componentcloudwego/eino-extEino component selection, configuration, and usage. Use when a user needs to choose or configure a ChatModel, AgenticModel, Embedding, Retriever, Indexer, Tool,348skills.sh installs
3alfredoperez avatarangular-best-practices-translocoalfredoperez/angular-best-practicesangular best practices transloco342skills.sh installs
4arraydude avatarreact-query-best-practicesarraydude/agent-skillsReact Query v4 (TanStack Query) best practices, patterns, and troubleshooting. Use when working with useQuery, useMutation, query invalidation, caching, WebSock339skills.sh installs
5secondsky avatarnuxt-seosecondsky/claude-skillsNuxt SEO v5 modules (robots, sitemap, og-image, schema-org, link-checker, seo-utils, site-config). Use when implementing SEO, robots.txt, sitemaps, Schema.org, 335skills.sh installs
6alfredoperez avatarangular-best-practices-rules-revieweralfredoperez/angular-best-practicesangular best practices rules reviewer331skills.sh installs