# myrception/wombat architecture

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

- Interactive diagram: https://gitdiagram.com/myrception/wombat
- Repository: https://github.com/myrception/wombat

## Overview

##### Main Components
- Frontend/UI Layer:
- Bridge/Integration Layer:
- The project uses Wails (notable through the “wails.json” file and the “frontend/wailsjs” directory) to integrate the Go backend with the frontend. This layer bridges the Svelte frontend and the Go-based application logic.
- Backend/Business Logic Layer:
- The “internal/app” directory houses Go code that implements the core application logic (API handling, events, gRPC communication wrappers, TLS configuration, etc.).
- The “internal/server” folder holds the gRPC service implementations, including protobuf definitions (both .proto and auto-generated .pb.go files) that represent the RPC schema.
- Application Entry Point & Configuration:
- The “main.go” file, along with “go.mod” and “go.sum”, indicates a single binary built with Go. The project also includes configuration files (wails.json, info.plist for macOS) and deployment scripts in the “.github” directory.

##### Relationships and Interactions
- The Frontend (Svelte components) communicates with the Backend via the Wails bridge. This connection is managed in the “frontend/wailsjs” section, which contains both TypeScript and JavaScript files offering the API interfaces.
- The Backend “internal/app” acts as the intermediary:
– It processes user actions, handles event logic, and manages state and data flow.
– It invokes gRPC calls by interfacing with the “internal/server” code.
- The “internal/server” implements the low-level gRPC logic, including parsing .proto files and interacting with remote or local gRPC endpoints.
- Assets and configuration files provide static resources and deployment instructions across different operating systems (macOS, Linux, Windows).

##### Architectural Patterns and Design Principles
- Separation of Concerns: Clear division between the UI (frontend) and the application logic (backend), with a dedicated integration layer (Wails).
- RPC and Protobuf Integration: Use of .proto files and generated code in “internal/server” shows adherence to gRPC and protobuf standards.
- Cross-Platform Desktop Integration: Through Wails, bridging Go and web technologies (Svelte) for native desktop experiences.

##### Important Technologies and Frameworks
- Svelte for building the reactive and component-based UI.
- Go for backend application logic, including gRPC service implementations.
- Wails for bridging the frontend and backend in a desktop application context.
- gRPC, Protocol Buffers, and TLS configurations to support various RPC interactions.
- Rollup for bundling the frontend code and managing dependencies.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External User
    User["User"]:::external

    %% Frontend Layer
    subgraph "Frontend Layer"
        FUI["Svelte UI Components"]:::frontend
        Controls["Controls"]:::frontend
        Views["Views"]:::frontend
        Icons["Icons"]:::frontend
    end
    FUI --> Controls
    FUI --> Views
    FUI --> Icons
    User -->|"UserInput"| FUI

    %% Bridge/Integration Layer
    Wails["Wails Integration Layer"]:::bridge
    FUI -->|"Dispatch"| Wails

    %% Backend Layer
    subgraph "Backend Layer"
        AL["Application Logic"]:::backend
        GRPC["gRPC Services Layer"]:::grpc
    end
    Wails -->|"Invoke"| AL
    AL -->|"gRPCRequest"| GRPC
    GRPC -->|"gRPCResponse"| AL
    AL -->|"ReturnData"| Wails
    Wails -->|"UIUpdate"| FUI

    %% Configuration & Deployment
    subgraph "Configuration & Deployment"
        Entry["Main Entry Point"]:::entry
        Deployment["Deployment Files (.github)"]:::config
        ConfigFiles["Config Files (go.mod,go.sum,info.plist)"]:::config
    end
    Entry -->|"Initialize"| AL
    Entry --> Deployment
    Entry --> ConfigFiles

    %% Click Events
    click FUI "https://github.com/myrception/wombat/tree/master/frontend"
    click Wails "https://github.com/myrception/wombat/tree/master/frontend/wailsjs"
    click AL "https://github.com/myrception/wombat/tree/master/internal/app"
    click GRPC "https://github.com/myrception/wombat/tree/master/internal/server"
    click Entry "https://github.com/myrception/wombat/blob/master/main.go"
    click Deployment "https://github.com/myrception/wombat/blob/master/.github"
    click ConfigFiles "https://github.com/myrception/wombat/blob/master/go.mod"

    %% Styles
    classDef external fill:#FFCC00,stroke:#333,stroke-width:2px;
    classDef frontend fill:#AED6F1,stroke:#333,stroke-width:2px;
    classDef bridge fill:#D2B4DE,stroke:#333,stroke-width:2px;
    classDef backend fill:#A9DFBF,stroke:#333,stroke-width:2px;
    classDef grpc fill:#F9E79F,stroke:#333,stroke-width:2px;
    classDef entry fill:#F5B7B1,stroke:#333,stroke-width:2px;
    classDef config fill:#FAD7A0,stroke:#333,stroke-width:2px;
```
