# lee-edgar/synology_web architecture

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

- Interactive diagram: https://gitdiagram.com/lee-edgar/synology_web
- Repository: https://github.com/lee-edgar/synology_web

## Overview

##### Main Components Identification

a) Frontend Layer (Streamlit)
- Main layout components (Dashboard, Portfolio, Profile, Story, Study)
- Session management and styling components
- Utils package for data handling

b) Backend Layer (FastAPI)
- API endpoints organization
- Service layer for business logic
- Schemas and models components

c) Infrastructure Layer
- Synology NAS Server
- MySQL Database

**[Client Browsers] → [Streamlit Frontend] → [FastAPI Backend] → [MySQL Database]**
- ↑                     ↑
- Synology NAS Server ─┘

**[Layout Components]**
- Dashboard
- Portfolio
- Profile
- Story
- Study
- ↓
**[Utils & Services]**
- Data Management
- Session Handling
- Styling

**[API Endpoints]**
- Career API
- Healthcare API
- Content API
- ↓
**[Services]**
- Bollinger Band Service
- Data Processing
- ↓
**[Models & Schemas]**

##### Data Flow Representation

Specific data flows for:
- CGM data processing path
- Portfolio content management
- Blog post handling
- User session management

##### Integration Points

Integration between:
- Streamlit frontend and FastAPI backend
- FastAPI and MySQL database
- Synology NAS hosting both frontend and backend

##### Additional Elements

Include:
- API documentation endpoint (FastAPI OpenAPI docs)
- Authentication flow (planned JWT implementation)
- Data visualization components
- Session management system

This system design should effectively communicate both the current implementation and the planned future enhancements mentioned in the README.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Layer"]
        Browser["Web Browsers"]
    end

    subgraph Frontend["Frontend Layer"]
        StreamlitApp["Main Streamlit App"]:::frontend
        click StreamlitApp "https://github.com/lee-edgar/synology_web/blob/main/app/main.py"

        subgraph Layout["Layout Components"]
            Dashboard["Dashboard"]:::frontend
            Portfolio["Portfolio"]:::frontend
            Profile["Profile"]:::frontend
            Story["Story"]:::frontend
            Study["Study"]:::frontend

            click Dashboard "https://github.com/lee-edgar/synology_web/blob/main/app/layout/dashboard.py"
            click Portfolio "https://github.com/lee-edgar/synology_web/blob/main/app/layout/portfolio_layout.py"
            click Profile "https://github.com/lee-edgar/synology_web/blob/main/app/layout/profile_layout.py"
            click Story "https://github.com/lee-edgar/synology_web/blob/main/app/layout/story_layout.py"
            click Study "https://github.com/lee-edgar/synology_web/blob/main/app/layout/study_layout.py"
        end

        subgraph Utils["Utils & Services"]
            DataMgmt["Data Management"]:::frontend
            DataHandler["Data Handler"]:::frontend
            NetUtils["Network Utilities"]:::frontend
            StreamUtils["Streamlit Utilities"]:::frontend

            click DataMgmt "https://github.com/lee-edgar/synology_web/blob/main/app/utils/data_manager.py"
            click DataHandler "https://github.com/lee-edgar/synology_web/blob/main/app/utils/data_agent.py"
            click NetUtils "https://github.com/lee-edgar/synology_web/blob/main/app/utils/net_utils.py"
            click StreamUtils "https://github.com/lee-edgar/synology_web/blob/main/app/utils/streamlit_utils.py"
        end

        subgraph Style["Styling"]
            StyleDef["Style Definitions"]:::frontend
            CSS["CSS Styling"]:::frontend

            click StyleDef "https://github.com/lee-edgar/synology_web/blob/main/app/style/style.py"
            click CSS "https://github.com/lee-edgar/synology_web/blob/main/app/style/style.css"
        end

        subgraph Session["Session Management"]
            HealthSession["Healthcare Session"]:::frontend
            click HealthSession "https://github.com/lee-edgar/synology_web/blob/main/app/session/channel_healthcare_session_service.py"
        end
    end

    subgraph Backend["Backend Layer"]
        FastAPI["FastAPI Application"]:::backend
        click FastAPI "https://github.com/lee-edgar/synology_web/blob/main/backend/main.py"

        subgraph APIs["API Endpoints"]
            CareerAPI["Career API"]:::backend
            HealthAPI["Healthcare API"]:::backend
            ContentAPI["Content API"]:::backend

            click CareerAPI "https://github.com/lee-edgar/synology_web/blob/main/backend/api/career.py"
            click HealthAPI "https://github.com/lee-edgar/synology_web/blob/main/backend/api/channel_healthcare_api.py"
            click ContentAPI "https://github.com/lee-edgar/synology_web/blob/main/backend/api/content.py"
        end

        subgraph Services["Services"]
            BollingerService["Bollinger Band Analysis"]:::backend
            click BollingerService "https://github.com/lee-edgar/synology_web/blob/main/backend/service/bollinger_band_service.py"
        end

        subgraph Models["Models & Schemas"]
            BaseModel["Base Model"]:::backend
            CareerModel["Career Model"]:::backend
            HealthModel["Healthcare Model"]:::backend
            CareerSchema["Career Schema"]:::backend
            HealthSchema["Healthcare Schema"]:::backend

            click BaseModel "https://github.com/lee-edgar/synology_web/blob/main/backend/models/base.py"
            click CareerModel "https://github.com/lee-edgar/synology_web/blob/main/backend/models/carrer.py"
            click HealthModel "https://github.com/lee-edgar/synology_web/blob/main/backend/models/channel_healthcare_model.py"
            click CareerSchema "https://github.com/lee-edgar/synology_web/blob/main/backend/schemas/carrer.py"
            click HealthSchema "https://github.com/lee-edgar/synology_web/blob/main/backend/schemas/channel_healthcare_schemas.py"
        end

        DBSession["Database Session"]:::backend
        click DBSession "https://github.com/lee-edgar/synology_web/blob/main/backend/db/session.py"
    end

    subgraph Infrastructure["Infrastructure Layer"]
        SynologyNAS["Synology NAS Server"]:::infra
        MySQL["MySQL Database"]:::infra
    end

    %% Connections
    Browser --> StreamlitApp
    StreamlitApp --> Layout
    StreamlitApp --> Utils
    StreamlitApp --> Style
    StreamlitApp --> Session
    StreamlitApp --> FastAPI
    FastAPI --> APIs
    APIs --> Services
    APIs --> Models
    Services --> DBSession
    DBSession --> MySQL
    SynologyNAS --> MySQL

    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef infra fill:#e67e22,stroke:#d35400,color:white

    %% Legend
    subgraph Legend
        Frontend_L["Frontend Component"]:::frontend
        Backend_L["Backend Component"]:::backend
        Infra_L["Infrastructure Component"]:::infra
    end
```
