> ## Documentation Index
> Fetch the complete documentation index at: https://docs.markup.freddiephilpot.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Tauri Desktop

> Build and run the Markup desktop application using Tauri v2.

# Tauri Desktop

Markup includes an optional desktop client built with **Tauri v2**, allowing you to run the app as a native application with local filesystem integration and improved performance.

***

# Requirements

Before using Tauri, install:

* Node.js 18+
* Rust (latest stable)
* Cargo (included with Rust)
* Tauri CLI v2

Install Rust:

```bash theme={null}
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

Install Tauri CLI:

```bash theme={null}
cargo install tauri-cli
```

Verify installation:

```bash theme={null}
cargo tauri --version
```

***

# Project Setup

Install dependencies:

```bash theme={null}
npm install
```

Ensure your web app builds correctly first:

```bash theme={null}
npm run build
```

***

# Development Mode

Run the Tauri desktop app in development mode:

```bash theme={null}
npm run tauri:dev
```

This will:

* Start the Next.js dev server
* Launch the Tauri desktop shell
* Enable hot reload for UI changes

***

# Production Build

Build the desktop application:

```bash theme={null}
npm run tauri:build
```

Output binaries will be located in:

```txt theme={null}
src-tauri/target/release/
```

***

# Tauri Project Structure

```txt theme={null}
src-tauri/
├── icons/              # App icons
├── src/                # Rust backend logic
├── tauri.conf.json     # Tauri configuration
└── Cargo.toml          # Rust dependencies
```

***

# Configuration

## App Settings

Edit:

```txt theme={null}
src-tauri/tauri.conf.json
```

Key settings include:

* App name
* Window size
* Security policies
* Build targets

***

## Allowlist / Permissions

Tauri v2 uses capability-based security.

You may need to enable:

* File system access
* Network access
* Clipboard access

Example (conceptual):

```json theme={null}
{
  "permissions": [
    "fs:read",
    "fs:write",
    "shell:allow-open"
  ]
}
```

***

# Local File Sync

Markup desktop supports optional local syncing:

* `.md` → Markdown notes
* `.canvas` → Whiteboard data
* `.mindmap` → Mind map structures

Files are stored locally and can optionally sync to the cloud when authenticated.

***

# Common Commands

## Start Desktop App

```bash theme={null}
npm run tauri:dev
```

## Build Desktop App

```bash theme={null}
npm run tauri:build
```

## Clean Build

```bash theme={null}
cargo clean
```

***

# Troubleshooting

## Rust not found

Ensure Rust is installed:

```bash theme={null}
rustc --version
```

If missing, reinstall via rustup.

***

## Tauri build fails

Try cleaning and rebuilding:

```bash theme={null}
cargo clean
npm install
npm run tauri:build
```

***

## Blank window on launch

Check:

* Next.js build completes successfully
* No runtime errors in terminal
* Correct dev server URL in `tauri.conf.json`

***

## File system access issues

Ensure permissions are enabled in Tauri capabilities configuration.

***

# Performance Notes

* Desktop mode uses native WebView rendering
* Local file access reduces latency compared to cloud-only mode
* Recommended for heavy note-taking and offline usage

***

# Recommended Workflow

1. Develop using `npm run dev`
2. Test desktop mode with `npm run tauri:dev`
3. Build production web app
4. Build desktop binaries with `npm run tauri:build`

***

# Security Notes

* Do not expose sensitive environment variables to frontend
* Restrict filesystem permissions where possible
* Use Tauri capabilities instead of full access when possible
* Keep Rust and Tauri dependencies updated

***

# Optional Enhancements

You can extend the desktop app with:

* Auto-updater (check [Github Repositor](https://github.com/pphilfre/markup)y for an example)
* System tray integration
* Global shortcuts
* Deep OS file integration
* Offline-first sync mode improvements
