# zephyrus21/tauri-timer architecture

> Architecture diagram of the GitHub repository zephyrus21/tauri-timer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zephyrus21/tauri-timer
- Repository: https://github.com/zephyrus21/tauri-timer

## Overview

##### Project type and purpose
- This is a desktop application built with Tauri (Rust-based native shell) and Yew (Rust-to-WASM web UI framework). It provides a single-window, web-UI front end (compiled with Trunk) talking to a Rust backend for OS-level capabilities.

##### File structure
- Top-level:
- Cargo.toml, Makefile, Trunk.toml, tauri config (src-tauri/tauri.conf.json)
- index.html, CSS files (input.css, output.css, styles.css), tailwind.config.js
- src-tauri/… – the Rust “backend” implementing Tauri commands and bundling
- src/… – the Yew front-end (app.rs, components/, helpers.rs, main.rs)
- Patterns:
- Separation of front end vs backend
- Build tool (Trunk) compiles Rust → WASM + bundles static assets
- Tauri bridges WebView ↔ native code via JSON-RPC commands

##### README insights
- Describes a “Tauri + Yew” template: minimal setup to bootstrap a desktop app.
- No external microservices—purely local UI + native API calls.

a. Main components
- Yew Web UI (WASM bundle loaded into index.html)
- Tauri Runtime (WebView + event loop)
- Rust Backend (src-tauri/main.rs, build.rs)
- OS-level services (filesystem, notifications, clipboard, etc.)
- Build tooling (Trunk, Cargo)
b. Relationships & interactions
- User → Web UI (DOM events)
- Web UI → Tauri (invoke JSON-RPC commands)
- Tauri → Rust backend (command handlers)
- Rust backend → OS (native APIs)
- Backend emits events → Web UI (via “emit” callbacks)
c. Architectural patterns
- Clear UI/backend separation
- Message-based RPC between WASM and native
- Single-page application structure inside a desktop shell
d. Key technologies
- Yew (Rust→WASM front end)
- Trunk (bundler for WASM + static)
- Tauri (lightweight desktop shell, Rust API layer)
- Tailwind CSS for styling

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User
    User["User"]:::user

    %% Build Tooling & Configuration
    subgraph "Build Tooling & Configuration"
        CargoTOML["Cargo.toml"]:::config
        TauriCargo["src-tauri/Cargo.toml"]:::config
        TrunkTOML["Trunk.toml"]:::config
        Makefile["Makefile"]:::config
    end

    %% Static Assets & Styles
    subgraph "Static Assets & Styles"
        IndexHTML["index.html"]:::ui
        OutputCSS["output.css"]:::ui
        InputCSS["input.css"]:::ui
        StylesCSS["styles.css"]:::ui
        Tailwind["tailwind.config.js"]:::ui
    end

    %% Yew WASM UI
    subgraph "Yew WASM UI" 
        MainRS["src/main.rs"]:::ui
        AppRS["src/app.rs"]:::ui
        ComponentsGroup["src/components"]:::ui
        Helpers["src/helpers.rs"]:::ui
    end

    %% Tauri Runtime
    subgraph "Tauri Runtime"
        TauriMain["src-tauri/src/main.rs"]:::backend
        TauriConf["src-tauri/tauri.conf.json"]:::backend
    end

    %% Rust Backend (API Layer)
    subgraph "Rust Backend (API Layer)"
        BuildRS["src-tauri/build.rs"]:::backend
        BackendMain["src-tauri/src/main.rs"]:::backend
        BackendCargo["src-tauri/Cargo.toml"]:::backend
        Icon["src-tauri/icons/icon.icns"]:::backend
    end

    %% OS Services
    subgraph "OS Services"
        FS["File System"]:::external
        Notifications["Notifications"]:::external
        Clipboard["Clipboard"]:::external
    end

    %% Interactions
    User -->|"interacts"| IndexHTML
    IndexHTML -->|"loads WASM"| MainRS
    MainRS -->|"uses components"| ComponentsGroup
    ComponentsGroup -->|"renders UI"| AppRS
    AppRS -->|"calls helpers"| Helpers

    MainRS -->|"invoke RPC"| TauriMain
    TauriMain -->|"handles commands"| BackendMain
    BackendMain -->|"calls OS APIs"| FS
    BackendMain -->|"calls OS APIs"| Notifications
    BackendMain -->|"calls OS APIs"| Clipboard
    BackendMain -->|"emit events"| MainRS

    %% Build Pipeline
    CargoTOML & TauriCargo & TrunkTOML & Makefile -->|"build"| MainRS
    CargoTOML & TauriCargo & TrunkTOML & Makefile -->|"build"| BackendMain

    %% Click Events
    click CargoTOML "https://github.com/zephyrus21/tauri-timer/blob/master/Cargo.toml"
    click TauriCargo "https://github.com/zephyrus21/tauri-timer/blob/master/src-tauri/Cargo.toml"
    click TrunkTOML "https://github.com/zephyrus21/tauri-timer/blob/master/Trunk.toml"
    click Makefile "https://github.com/zephyrus21/tauri-timer/tree/master/Makefile"
    click IndexHTML "https://github.com/zephyrus21/tauri-timer/blob/master/index.html"
    click OutputCSS "https://github.com/zephyrus21/tauri-timer/blob/master/output.css"
    click InputCSS "https://github.com/zephyrus21/tauri-timer/blob/master/input.css"
    click StylesCSS "https://github.com/zephyrus21/tauri-timer/blob/master/styles.css"
    click Tailwind "https://github.com/zephyrus21/tauri-timer/blob/master/tailwind.config.js"
    click MainRS "https://github.com/zephyrus21/tauri-timer/blob/master/src/main.rs"
    click AppRS "https://github.com/zephyrus21/tauri-timer/blob/master/src/app.rs"
    click ComponentsGroup "https://github.com/zephyrus21/tauri-timer/tree/master/src/components/"
    click Helpers "https://github.com/zephyrus21/tauri-timer/blob/master/src/helpers.rs"
    click TauriMain "https://github.com/zephyrus21/tauri-timer/blob/master/src-tauri/src/main.rs"
    click TauriConf "https://github.com/zephyrus21/tauri-timer/blob/master/src-tauri/tauri.conf.json"
    click BuildRS "https://github.com/zephyrus21/tauri-timer/blob/master/src-tauri/build.rs"
    click BackendMain "https://github.com/zephyrus21/tauri-timer/blob/master/src-tauri/src/main.rs"
    click BackendCargo "https://github.com/zephyrus21/tauri-timer/blob/master/src-tauri/Cargo.toml"
    click Icon "https://github.com/zephyrus21/tauri-timer/blob/master/src-tauri/icons/icon.icns"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#004085,color:#004085
    classDef backend fill:#d4edda,stroke:#155724,color:#155724
    classDef config fill:#e2e3e5,stroke:#6c757d,color:#383d41
    classDef external fill:#fff3cd,stroke:#856404,color:#856404
    classDef user fill:#f8d7da,stroke:#721c24,color:#721c24
```
