# uinstinct/pobo architecture

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

- Interactive diagram: https://gitdiagram.com/uinstinct/pobo
- Repository: https://github.com/uinstinct/pobo

## Overview

##### Main Components
- Frontend Application – Found mainly in the “src” folder. This contains modules such as components (buttons, inputs, number inputs, switches), screens (app, home, session, settings), and utilities. It represents the UI built using Leptos.
- Tauri Backend – Located in the “src-tauri” directory. It manages the native desktop aspects of the application (commands, tray menu interactions, state management, etc.). Note the separation of “derive-macro” as a sub-module that likely supports compile-time macros.
- Configuration & Build Tools – Files such as Cargo.toml, Trunk.toml, index.html, global.scss, tailwind.config.js, and others indicate the build and styling configurations for the app.

##### Relationships & Interactions
- The frontend (Leptos-based UI) interacts with the Tauri backend via Tauri’s API (possibly using native command invocations) to access system functionalities.
- The build process uses Trunk (with Trunk.toml) to bundle and serve frontend assets (index.html, SCSS, etc.) into a format that the Tauri backend then displays.
- Configuration files and shared settings are used to keep the frontend and backend in sync regarding build parameters, styling (Tailwind), and native integrations.

##### Architectural Patterns & Principles
- Separation of Concerns – The clear split between UI (Leptos in “src”) and native desktop operations (Tauri’s Rust code in “src-tauri”).
- Modular Design – Both the frontend and backend are modularized into components/screens and command/state management respectively.
- Build Pipeline & Configuration Management – Usage of Trunk (for asset bundling) and Cargo for Rust dependencies; configuration files tie these layers together.
- Integration Coupling – The communication via Tauri’s bridge demonstrates a controlled coupling between the web view and native backend.

##### Relevant Technologies, Frameworks, & Libraries
- Tauri – For native desktop capabilities and bridging the gap between Rust and web UI.
- Leptos – For building reactive UI components in Rust.
- Rust/Cargo – Underlying language and package management system.
- Trunk – To bundle and serve frontend assets.
- Tailwind & SCSS – For UI styling.
- (Additional context from .vscode and GitHub config files indicate recommended toolings for development.)

##### Specific Elements
- UI Layer (“src”): Components (UI elements), Screens, Utilities.
- Backend Layer (“src-tauri”): Main Application (main.rs), Command handlers, State management, Tray Menu, Helper functions.
- Build & Configuration: Cargo, Trunk, Public Assets, Global/SCSS styles, Tailwind setup.
- From the UI components to the Tauri backend components to indicate invocation of native commands.
- From configurations and build scripts to both the UI and backend to show how the build pipeline feeds the application.
- Frontend vs. Backend modules.
- Configuration/build process vs. runtime components.
- Clear textual labels that point out “Leptos UI”, “Tauri Backend”, “Build Pipeline”, “Public Assets”, etc.

##### Final Advice

This approach should give you (and any other principal software engineer involved) a transparent picture of how the application is structured across its frontend and backend, and how their interactions form the complete desktop application system. Happy diagramming!

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Leptos UI Layer
    subgraph "Leptos UI"
        U1["Components"]:::ui
        U2["Components UI"]:::ui
        subgraph "Screens"
            U3["App Screen"]:::ui
            U4["Home Screen"]:::ui
            U5["Session Screen"]:::ui
            U6["Settings Screen"]:::ui
        end
        U7["Utilities"]:::ui
    end

    %% Tauri Backend Layer
    subgraph "Tauri Backend"
        B1["Main Application"]:::backend
        B2["Command Handlers"]:::backend
        B3["State Management (state.rs)"]:::backend
        B3b["Store (store.rs)"]:::backend
        B4["Tray Menu"]:::backend
        B5["Helper Functions"]:::backend
        B6["Compile-Time Macro Support"]:::backend
    end

    %% Configuration & Build Tools
    subgraph "Configuration & Build"
        C1a["Cargo.toml"]:::build
        C1b["Tauri Cargo.toml"]:::build
        C2a["Trunk.toml"]:::build
        C2b["Build.rs"]:::build
        C3a["global.scss"]:::build
        C3b["tailwind.config.js"]:::build
        C3c["index.html"]:::build
    end

    %% Public Assets
    subgraph "Public Assets"
        P1["Public Icons"]:::assets
        P2["Tauri Icons"]:::assets
    end

    %% Interactions between UI and Backend
    U1 -->|"invokes"| B2
    U3 -->|"invokeCmd"| B2
    U7 -->|"utilize"| B2

    %% Build Pipeline feeding UI and Backend
    C2a -->|"bundleToUI"| U1
    C2b -->|"loadNative"| B1
    C1a -->|"configures"| B1
    C1b -->|"configures"| B1
    C3a -->|"styles"| U1
    C3b -->|"styles"| U1
    C3c -->|"html"| U1

    %% Public Assets used by UI and Backend
    P1 -->|"usedBy"| U1
    P2 -->|"usedBy"| B1

    %% Click Events for Leptos UI
    click U1 "https://github.com/uinstinct/pobo/tree/main/src/components"
    click U2 "https://github.com/uinstinct/pobo/tree/main/src/components/ui"
    click U3 "https://github.com/uinstinct/pobo/tree/main/src/screens/app"
    click U4 "https://github.com/uinstinct/pobo/tree/main/src/screens/home"
    click U5 "https://github.com/uinstinct/pobo/tree/main/src/screens/session"
    click U6 "https://github.com/uinstinct/pobo/tree/main/src/screens/settings"
    click U7 "https://github.com/uinstinct/pobo/tree/main/src/utils"

    %% Click Events for Tauri Backend
    click B1 "https://github.com/uinstinct/pobo/blob/main/src-tauri/src/main.rs"
    click B2 "https://github.com/uinstinct/pobo/blob/main/src-tauri/src/commands.rs"
    click B3 "https://github.com/uinstinct/pobo/blob/main/src-tauri/src/state.rs"
    click B3b "https://github.com/uinstinct/pobo/blob/main/src-tauri/src/store.rs"
    click B4 "https://github.com/uinstinct/pobo/blob/main/src-tauri/src/tray_menu.rs"
    click B5 "https://github.com/uinstinct/pobo/tree/main/src-tauri/src/helpers"
    click B6 "https://github.com/uinstinct/pobo/blob/main/src-tauri/derive-macro/src/lib.rs"

    %% Click Events for Configuration & Build
    click C1a "https://github.com/uinstinct/pobo/blob/main/Cargo.toml"
    click C1b "https://github.com/uinstinct/pobo/blob/main/src-tauri/Cargo.toml"
    click C2a "https://github.com/uinstinct/pobo/blob/main/Trunk.toml"
    click C2b "https://github.com/uinstinct/pobo/blob/main/src-tauri/build.rs"
    click C3a "https://github.com/uinstinct/pobo/blob/main/global.scss"
    click C3b "https://github.com/uinstinct/pobo/blob/main/tailwind.config.js"
    click C3c "https://github.com/uinstinct/pobo/blob/main/index.html"

    %% Click Events for Public Assets
    click P1 "https://github.com/uinstinct/pobo/tree/main/public/icons"
    click P2 "https://github.com/uinstinct/pobo/tree/main/src-tauri/icons"

    %% Styles
    classDef ui fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef backend fill:#ABEBC6,stroke:#1E8449,stroke-width:2px;
    classDef build fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef assets fill:#FADBD8,stroke:#922B21,stroke-width:2px;
```
