# mcvyp/tauri-desk architecture

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

- Interactive diagram: https://gitdiagram.com/mcvyp/tauri-desk
- Repository: https://github.com/mcvyp/tauri-desk

## Overview

##### Project type and purpose
- This is a desktop “timer” application built on Tauri.
- The frontend UI is a React/TypeScript single-page app (in the app folder) styled with Tailwind and built by Vite.
- The backend is a lightweight Rust application (in src-tauri) that bundles the web UI into a native desktop shell, exposes OS APIs (notifications, timing), and handles commands from the UI.

##### File structure
- Top-level:
- .eslintrc.cjs, tsconfig.json, vite.config.ts, tailwind.config.ts, postcss.config.js – frontend linting, typing, build configurations
- package.json / package-lock.json – frontend dependencies and scripts
- public/ – static assets for the web UI
- app/ – React code
- components/ (Timer UI component)
- entry.client.tsx / entry.server.tsx – Tauri’s client/server entry points for hydration
- routes/ – single route for the timer
- src-tauri/ – Rust backend
- Cargo.toml / Cargo.lock – Rust dependencies
- src/main.rs – Tauri application initialization, command handlers
- src/lib.rs – (optional) shared Rust modules
- tauri.conf.json – Tauri configuration (permissions, bundle settings)
- build.rs – any custom build steps
- capabilities/default.json – allowed OS APIs

##### README
- Confirms the sole purpose: “A timer for Desktop.”
- A single screenshot; no further architecture details.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend UI Layer
    subgraph "Frontend UI Layer" 
        direction TB
        UI["React/TypeScript UI (app/)"]:::frontend
        TC["Timer Component"]:::frontend
        EntryClient["entry.client.tsx"]:::frontend
        EntryServer["entry.server.tsx"]:::frontend
        Root["root.tsx"]:::frontend
        Routes["routes/_index.tsx"]:::frontend
        Styles["index.css"]:::frontend
        ViteCfg["vite.config.ts"]:::frontend
        TailwindCfg["tailwind.config.ts"]:::frontend
        PostCSS["postcss.config.js"]:::frontend
        TSConfig["tsconfig.json"]:::frontend
        Package["package.json"]:::frontend
        Lock["package-lock.json"]:::frontend
        Public["public/"]:::frontend
    end

    %% Build Pipeline
    subgraph "Build Pipeline"
        direction TB
        ViteBuild["Vite Build"]:::infra
        TauriBundle["Tauri CLI Bundle"]:::infra
    end

    %% Native Host Layer
    subgraph "Native Host Layer"
        direction TB
        TauriConf["tauri.conf.json"]:::native
        BuildRs["build.rs"]:::native
        Capabilities["capabilities/default.json"]:::native
        Icons["icons/icon.icns"]:::native
    end

    %% Rust Backend Code
    subgraph "Rust Backend Code"
        direction TB
        MainRs["src/main.rs"]:::native
        LibRs["src/lib.rs"]:::native
    end

    %% Rust Dependency Management
    subgraph "Rust Dependency Management"
        direction TB
        CargoToml["Cargo.toml"]:::native
        CargoLock["Cargo.lock"]:::native
        GitIgnore[".gitignore"]:::native
    end

    %% Operating System Services
    subgraph "Operating System Services"
        direction TB
        OS_Timer["OS Timer API"]:::os
        OS_Notif["OS Notification API"]:::os
    end

    %% User Interaction Flow
    User["User"]:::external
    User -->|"interacts with"| UI
    UI -->|"invoke(command)"| MainRs
    MainRs -->|"start/stop timer"| OS_Timer
    MainRs -->|"send notification"| OS_Notif
    OS_Timer -->|"timer event"| MainRs
    MainRs -->|"callback(event)"| UI

    %% Build Flow
    ViteCfg --> ViteBuild
    TailwindCfg --> ViteBuild
    PostCSS --> ViteBuild
    TSConfig --> ViteBuild
    ViteBuild --> Public
    Public --> TauriBundle
    Package --> ViteBuild
    Lock --> ViteBuild
    TauriConf --> TauriBundle
    BuildRs --> TauriBundle
    Capabilities --> TauriBundle
    Icons --> TauriBundle
    CargoToml --> TauriBundle
    CargoLock --> TauriBundle
    MainRs --> TauriBundle
    LibRs --> TauriBundle
    GitIgnore --> TauriBundle
    TauriBundle -->|"produces"| App["Desktop Executable"]:::external

    %% Click Events
    click UI "https://github.com/mcvyp/tauri-desk/tree/main/app/"
    click TC "https://github.com/mcvyp/tauri-desk/blob/main/app/components/timer.tsx"
    click EntryClient "https://github.com/mcvyp/tauri-desk/blob/main/app/entry.client.tsx"
    click EntryServer "https://github.com/mcvyp/tauri-desk/blob/main/app/entry.server.tsx"
    click Root "https://github.com/mcvyp/tauri-desk/blob/main/app/root.tsx"
    click Routes "https://github.com/mcvyp/tauri-desk/blob/main/app/routes/_index.tsx"
    click Styles "https://github.com/mcvyp/tauri-desk/blob/main/app/index.css"
    click ViteCfg "https://github.com/mcvyp/tauri-desk/blob/main/vite.config.ts"
    click TailwindCfg "https://github.com/mcvyp/tauri-desk/blob/main/tailwind.config.ts"
    click PostCSS "https://github.com/mcvyp/tauri-desk/blob/main/postcss.config.js"
    click TSConfig "https://github.com/mcvyp/tauri-desk/blob/main/tsconfig.json"
    click Package "https://github.com/mcvyp/tauri-desk/blob/main/package.json"
    click Lock "https://github.com/mcvyp/tauri-desk/blob/main/package-lock.json"
    click Public "https://github.com/mcvyp/tauri-desk/tree/main/public/"
    click TauriConf "https://github.com/mcvyp/tauri-desk/blob/main/src-tauri/tauri.conf.json"
    click BuildRs "https://github.com/mcvyp/tauri-desk/blob/main/src-tauri/build.rs"
    click Capabilities "https://github.com/mcvyp/tauri-desk/blob/main/src-tauri/capabilities/default.json"
    click Icons "https://github.com/mcvyp/tauri-desk/blob/main/src-tauri/icons/icon.icns"
    click MainRs "https://github.com/mcvyp/tauri-desk/blob/main/src-tauri/src/main.rs"
    click LibRs "https://github.com/mcvyp/tauri-desk/blob/main/src-tauri/src/lib.rs"
    click CargoToml "https://github.com/mcvyp/tauri-desk/blob/main/src-tauri/Cargo.toml"
    click CargoLock "https://github.com/mcvyp/tauri-desk/blob/main/src-tauri/Cargo.lock"
    click GitIgnore "https://github.com/mcvyp/tauri-desk/blob/main/src-tauri/.gitignore"

    %% Styles
    classDef frontend fill:#add8e6,stroke:#333,stroke-width:1px
    classDef native fill:#90ee90,stroke:#333,stroke-width:1px
    classDef os fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef infra fill:#f0e68c,stroke:#333,stroke-width:1px
    classDef external fill:#ffffff,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
```
