# janufniarz/symbiot architecture

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

- Interactive diagram: https://gitdiagram.com/janufniarz/symbiot
- Repository: https://github.com/janufniarz/symbiot

## Overview

##### Project Type and Purpose
- This is a full-stack, modular system named “symbiot” composed of:
- A Flutter-based front-end (“symbiot_flutter”) delivering UI for chat, operations, settings, etc.
- A Python API server (“symbiot_server”) exposing REST endpoints and persisting data.
- A Python engine service (“symbiot_engine”) encapsulating core control logic, handlers, and connectors.
- A shared Python library (“symbiot_lib”) providing common components (endpoints, division logic, tool kits).
- A scraper module (“github_pretrained”) for pretraining data extraction from GitHub.
- PowerShell scripts and Docker compose for build, configuration, and deployment.

##### File-Structure Analysis
- Top-Level:
- docker-compose.yml — orchestration of services (server, engine, DB).
- symbiot_flutter/ — Flutter app (lib/, windows/, pubspec).
- symbiot_server/ — Python API server (config, control, database, endpoints, scrapers).
- symbiot_engine/ — Python engine (config, connection, control, run_engine).
- symbiot_lib/ — shared Python library (components, objects, tool_kits).
- github_pretrained/ — Scrapy project for GitHub crawling.
- Patterns:
- API-based layering in server (endpoints → control/services → repositories → DB).
- Engine uses handler-middleware pattern (endpoints → handlers → connectors).
- Shared library for reusable division and endpoint abstractions.

##### Key Insights from README
- The README only gives the project name; architecture must be inferred from structure.
- Docker compose suggests containerized deployment of server, engine, and likely a database.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Front-end
    subgraph "Flutter App: symbiot_flutter"
        direction TB
        style FlutterApp fill:#AED6F1,stroke:#2980B9,stroke-width:2px
        UI["Flutter UI (lib/ui/views)"]:::frontend
        Controllers["Controllers (lib/components/controllers)"]:::frontend
        ConnectionLayer["Connection Layer (lib/components/connection)"]:::frontend
        MainDart["main.dart"]:::frontend
        MainDart --> UI
        UI --> Controllers
        Controllers --> ConnectionLayer
    end

    %% Docker Network boundary
    subgraph "Docker Network"
        direction TB
        style DockerNet fill:none,stroke:#95A5A6,stroke-dasharray: 5 5
        %% API Server
        subgraph "API Server: symbiot_server"
            direction TB
            style APISrv fill:#ABEBC6,stroke:#27AE60,stroke-width:2px
            RunServer["run_server.py"]:::backend
            Endpoints["Endpoints"]:::backend
            ControlSvc["Control/Services"]:::backend
            Repositories["Repositories"]:::backend
            Entities["Entities/Converters"]:::backend
            RunServer --> Endpoints
            Endpoints --> ControlSvc
            ControlSvc --> Repositories
            Repositories --> Entities
            Repositories --> DB
        end

        %% Engine Service
        subgraph "Engine Service: symbiot_engine"
            direction TB
            style EngineSrv fill:#F9E79F,stroke:#F1C40F,stroke-width:2px
            RunEngine["run_engine.py"]:::engine
            EngEndpoints["Endpoints"]:::engine
            Handlers["Handlers"]:::engine
            Connectors["Connectors"]:::engine
            Middleware["Handler Provider"]:::engine
            RunEngine --> EngEndpoints
            EngEndpoints --> Handlers
            Handlers --> Connectors
            Handlers --> Middleware
        end

        %% Database
        DB[(Database)]:::db
    end

    %% Shared Library
    SharedLib["Shared Library: symbiot_lib"]:::lib
    SharedLibComp["Components"]:::lib
    SharedLibObj["Objects"]:::lib
    SharedLibKit["Tool Kits"]:::lib
    SharedLib --> SharedLibComp
    SharedLib --> SharedLibObj
    SharedLib --> SharedLibKit
    SharedLibComp -.-> APISrv
    SharedLibComp -.-> EngineSrv

    %% Scraper Module
    Scraper["Scraper: github_pretrained"]:::scraper
    Scraper --> DB

    %% DevOps / Build & Deployment
    DevOps["DevOps / PS Scripts: ps_scripts"]:::devops

    %% Interactions
    UI -->|HTTP/REST| RunServer
    APISrv -->|RPC/API| EngineSrv

    %% Click Events
    click MainDart "https://github.com/janufniarz/symbiot/blob/main/symbiot_flutter/lib/main.dart"
    click UI "https://github.com/janufniarz/symbiot/tree/main/symbiot_flutter/lib/ui/views/"
    click Controllers "https://github.com/janufniarz/symbiot/tree/main/symbiot_flutter/lib/components/controllers/"
    click ConnectionLayer "https://github.com/janufniarz/symbiot/tree/main/symbiot_flutter/lib/components/connection/"
    click RunServer "https://github.com/janufniarz/symbiot/blob/main/symbiot_server/run_server.py"
    click Endpoints "https://github.com/janufniarz/symbiot/tree/main/symbiot_server/endpoints/"
    click ControlSvc "https://github.com/janufniarz/symbiot/tree/main/symbiot_server/control/services/"
    click Repositories "https://github.com/janufniarz/symbiot/tree/main/symbiot_server/database/repositories/"
    click Entities "https://github.com/janufniarz/symbiot/tree/main/symbiot_server/database/converters/"
    click Scraper "https://github.com/janufniarz/symbiot/tree/main/github_pretrained/github_pretrained/"
    click RunEngine "https://github.com/janufniarz/symbiot/blob/main/symbiot_engine/run_engine.py"
    click EngEndpoints "https://github.com/janufniarz/symbiot/tree/main/symbiot_engine/connection/endpoints/"
    click Connectors "https://github.com/janufniarz/symbiot/tree/main/symbiot_engine/connection/connectors/"
    click Handlers "https://github.com/janufniarz/symbiot/tree/main/symbiot_engine/control/handlers/"
    click Middleware "https://github.com/janufniarz/symbiot/blob/main/symbiot_engine/control/middlewares/handler_provider.py"
    click SharedLibComp "https://github.com/janufniarz/symbiot/tree/main/symbiot_lib/components/"
    click SharedLibObj "https://github.com/janufniarz/symbiot/tree/main/symbiot_lib/objects/"
    click SharedLibKit "https://github.com/janufniarz/symbiot/tree/main/symbiot_lib/tool_kits/"
    click DevOps "https://github.com/janufniarz/symbiot/tree/main/ps_scripts/"

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#2980B9
    classDef backend fill:#ABEBC6,stroke:#27AE60
    classDef engine fill:#F9E79F,stroke:#F1C40F
    classDef lib fill:#D7DBDD,stroke:#566573
    classDef scraper fill:#FAD7A0,stroke:#B9770E
    classDef db fill:#A9DFBF,stroke:#196F3D,stroke-width:2px
    classDef devops fill:#E8DAEF,stroke:#8E44AD
```
