# strahe/curio-dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/strahe/curio-dashboard
- Repository: https://github.com/strahe/curio-dashboard

## Overview

##### Main Components
- Backend Service: Represented by the Go application (e.g., “cmd” package with main.go, configuration in config/ and db/ packages), which includes:
- GraphQL API Layer: The “graph” directory contains resolvers, schema definitions, loaders, and types that leverage gqlgen.
- Configuration & Initialization: The “cmd” and “config” directories manage application startup, configuration (via config.go), and utility functions.
- Database Integration: Note the “db” folder (e.g., db/harmony.go) handling interactions with the underlying (YugabyteDB) or other databases.
- Internal Helpers: The “types” directory and assorted utilities support core functionality.
- Frontend Application: Represented by the “ui” directory. This is a Vue-based SPA containing:
- UI Components, Layouts, and Widgets: Organized in subfolders (components, layouts, views, etc.) that drive the user-facing portion.
- State Management and Routing: Present in “ui/src/stores” and “ui/src/router,” respectively.
- Build/Configuration Files: Such as package.json, tsconfig, and vite.config.mts that define the frontend build process.
- External Dependencies & Services:
- Curio Node API: The application requires a reachable Curio web API endpoint.
- YugabyteDB: Used as the distributed database for the Curio cluster.
- Prometheus (Optional): For metrics collection and real-time monitoring.
- Lotus Daemon: For blockchain data retrieval.

##### Component Relationships and Data Flow
- The Backend processes incoming API requests and, using its resolvers and loaders, queries data from internal modules (e.g., DB, configuration) and relays these to the frontend.
- External Services are initiated by the backend:
- For example, calls to the Curio Node and Lotus daemon should be shown as outbound connections from the backend layer.
- Database interactions (with YugabyteDB) and optionally Prometheus metrics collection are separate but integral parts of the system.

##### Architectural Patterns
- GraphQL API design: Show the “GraphQL Layer” that comprises schemas, resolvers (several files under graph/resolvers), and loaders for efficient data fetching.
- Separation of concerns in the project structure (backend core business logic vs. frontend UI components).
- That the API and UI are loosely coupled, which promotes scalability and maintainability.

##### Relevant Technologies and Frameworks
- Programming Language: Go (for the backend) and Vue/TypeScript (for the frontend).
- GraphQL: Make clear the significant role of gqlgen for generating the API.
- Database & External Tools: Clearly label YugabyteDB, Curio Node API, Prometheus, and Lotus as external integrations.
- Containerization and CI/CD: Optionally, represent how Docker (Dockerfile, ci.Dockerfile, GitHub workflows, etc.) encapsulates and automates building and deployment.

##### Be Detailed in Capturing Key Elements
- As many underlying components as possible while grouping modules logically (e.g., all GraphQL-related files under “GraphQL API Layer”).
- Don’t overlook ancillary elements such as CI/CD pipelines (GitHub Actions, Makefile) since they yield insights into the development and deployment pipeline.
- That each external service (Curio Node, YugabyteDB, Prometheus, Lotus) is connected to the correct part of the system and clearly labeled.

- Clearly labeled components (Frontend, Backend/GraphQL, Configuration, Database, External Services).
- A layout that separates the concerns of UI, API, and external integrations.

This detailed approach will give stakeholders a clear understanding of the system’s internal structure, integration points, and high-level design principles.

Happy diagramming!

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI / Frontend
    subgraph "UI / Frontend"
        UI["Curio Dashboard UI (Vue.js)"]:::frontend
    end

    %% Backend Service Layer
    subgraph "Backend Service"
        BA["Main Application (Go)"]:::backend
        CI["Configuration & Initialization"]:::backend
        GA["GraphQL API Layer (gqlgen)"]:::backend
        DB["Database Integration (Connector)"]:::backend
        IH["Internal Helpers"]:::backend
    end

    %% External Services Layer
    subgraph "External Services"
        CN["Curio Node API"]:::external
        YD["YugabyteDB"]:::external
        PM["Prometheus"]:::external
        LD["Lotus Daemon"]:::external
    end

    %% CI/CD & Containerization Layer
    subgraph "CI/CD & Containerization"
        CCD["CI/CD & Containerization"]:::ci
    end

    %% Data Flow Connections
    UI -->|"GraphQL_call"| GA

    CI -->|"init_ready"| BA
    BA -->|"expose_API"| GA
    BA -->|"handles_db"| DB
    BA -->|"uses_helpers"| IH

    GA -->|"call_node"| CN
    GA -->|"metrics"| PM
    DB -->|"query_db"| YD
    BA -->|"blockchain_data"| LD

    CCD -->|"deploys"| BA

    %% Click Events
    click BA "https://github.com/strahe/curio-dashboard/blob/main/cmd/main.go"
    click CI "https://github.com/strahe/curio-dashboard/blob/main/config/config.go"
    click GA "https://github.com/strahe/curio-dashboard/tree/main/graph"
    click DB "https://github.com/strahe/curio-dashboard/blob/main/db/harmony.go"
    click IH "https://github.com/strahe/curio-dashboard/tree/main/types"
    click UI "https://github.com/strahe/curio-dashboard/tree/main/ui"
    click CCD "https://github.com/strahe/curio-dashboard/tree/main/Dockerfile"

    %% Styles
    classDef frontend fill:#AEDFF7,stroke:#333,stroke-width:2px;
    classDef backend fill:#C3F7C0,stroke:#333,stroke-width:2px;
    classDef external fill:#F7D6AE,stroke:#333,stroke-width:2px;
    classDef ci fill:#E0BBE4,stroke:#333,stroke-width:2px;
```
