# shinwon-kang/candbc-gui-rs architecture

> Architecture diagram of the GitHub repository shinwon-kang/candbc-gui-rs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shinwon-kang/candbc-gui-rs
- Repository: https://github.com/shinwon-kang/candbc-gui-rs

## Overview

##### Main Components

a) Frontend Layer (SvelteKit):
- UI Components (src/lib/)
- Routing System (src/routes/)
- State Management (src/lib/stores.js)
- Theme System (Light/Dark mode)

b) Backend Layer (Rust/Tauri):
- DBC Parser Module (src-tauri/src/dbc/)
- File System Interface
- IPC (Inter-Process Communication) Bridge

c) Core Features:
- DBC File Processing
- Message Viewing
- Information Display

**┌─ User Interface Layer ─────────────────┐**
- ┌─────────────┐ ┌────────────────────┐ │
- Main View  │ │  Information View  │ │
- ┘ └────────────────────┘ │
- ┬────────────────────┘
- ↕ (SvelteKit State Management)
**┌───────────────────┴────────────────────┐**
- ┌─────────────┐      ┌──────────────┐  │
- Tauri     │ ←──→ │  IPC Bridge │  │
- ┘      └──────────────┘  │
- ┬────────────────────┘
- ↕
**┌───────────────────┴────────────────────┐**
- ┌─────────────┐      ┌──────────────┐  │
- DBC Parser  │ ←──→ │  File System │  │
- ┘      └──────────────┘  │
- ┘

##### Key Relationships to Highlight

a) Data Flow:
- File System → DBC Parser → IPC Bridge → Frontend State → UI Components

b) Component Interactions:
- Bidirectional communication between Tauri and SvelteKit
- File system operations
- Parser data flow

##### Important Technical Details

- Use of nom parser for DBC file parsing
- Separation between the main UI and information views
- Theme switching capability
- Message and signal processing flows

##### Implementation Notes

- The desktop application nature of the project
- The clear separation between frontend and backend
- The file processing pipeline
- The user interface organization

Remember to:
- Keep the component granularity at a meaningful level
- Both structural and behavioral aspects
- Version information handling
- Where theme switching occurs

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph UI
        MainView["Main View"]
        InfoView["Information View"]
        MessageTable["Message Table"]
        MessageCard["Message Card"]
        ThemeSwitch["Theme Switch"]
        UIComponents["UI Components"]
    end

    subgraph StateManagement
        Store["Store Management"]
        Router["Router"]
        CommonUtils["Common Utilities"]
    end

    subgraph TauriBridge
        IPC["IPC Bridge"]
        TauriCore["Tauri Core"]
    end

    subgraph Backend
        Parser["DBC Parser"]
        FileSystem["File System"]
        DBCStructs["DBC Data Structures"]
    end

    MainView --> MessageTable
    MainView --> MessageCard
    MainView --> ThemeSwitch
    InfoView --> UIComponents
    
    MessageTable --> Store
    MessageCard --> Store
    InfoView --> Store
    MainView --> Router
    InfoView --> Router
    
    Store --> IPC
    Router --> IPC
    CommonUtils --> Store
    
    IPC <--> TauriCore
    
    TauriCore --> Parser
    TauriCore --> FileSystem
    Parser --> DBCStructs
    FileSystem --> Parser

    %% Click events for component mapping
    click UIComponents "https://github.com/Shinwon-Kang/candbc-gui-rs/tree/main/src/lib/components/ui/"
    click MessageTable "https://github.com/Shinwon-Kang/candbc-gui-rs/blob/main/src/lib/MessageTable.svelte"
    click MessageCard "https://github.com/Shinwon-Kang/candbc-gui-rs/blob/main/src/lib/MessageCard.svelte"
    click InfoView "https://github.com/Shinwon-Kang/candbc-gui-rs/blob/main/src/lib/InfoView.svelte"
    click MainView "https://github.com/Shinwon-Kang/candbc-gui-rs/blob/main/src/routes/+page.svelte"
    click Router "https://github.com/Shinwon-Kang/candbc-gui-rs/tree/main/src/routes/"
    click Store "https://github.com/Shinwon-Kang/candbc-gui-rs/blob/main/src/lib/stores.js"
    click CommonUtils "https://github.com/Shinwon-Kang/candbc-gui-rs/blob/main/src/lib/common.js"
    click Parser "https://github.com/Shinwon-Kang/candbc-gui-rs/blob/main/src-tauri/src/dbc/parser.rs"
    click DBCStructs "https://github.com/Shinwon-Kang/candbc-gui-rs/blob/main/src-tauri/src/dbc/dbc.rs"
    click TauriCore "https://github.com/Shinwon-Kang/candbc-gui-rs/blob/main/src-tauri/src/main.rs"

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef state fill:#9b59b6,stroke:#8e44ad,color:white
    classDef bridge fill:#2ecc71,stroke:#27ae60,color:white
    classDef backend fill:#e67e22,stroke:#d35400,color:white

    class MainView,InfoView,MessageTable,MessageCard,ThemeSwitch,UIComponents frontend
    class Store,Router,CommonUtils state
    class IPC,TauriCore bridge
    class Parser,FileSystem,DBCStructs backend

    %% Legend
    subgraph Legend
        Frontend["Frontend (SvelteKit)"]:::frontend
        StateLayer["State Layer"]:::state
        BridgeLayer["Tauri Bridge"]:::bridge
        BackendLayer["Backend (Rust)"]:::backend
    end
```
