# maneesana/video-streaming-cpp-backend architecture

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

- Interactive diagram: https://gitdiagram.com/maneesana/video-streaming-cpp-backend
- Repository: https://github.com/maneesana/video-streaming-cpp-backend

## Overview

##### Main Components
- Backend Service: The core application code is found in the src/ directory (for example, App.cpp, AppComponent.hpp, SwaggerComponent.hpp, controllers like MyController, and DTO definitions).
- Web Framework & API Layer: Oat++ is used to construct your REST endpoints (note the controllers and Swagger integration), which should be represented as part of your API layer.
- External Dependencies/Libraries: Note the external/ folder which includes submodules for oatpp, oatpp-postgresql, and oatpp-swagger. These represent the integral libraries enabling web server functionalities, database communication, and API documentation respectively.
- Deployment & Configuration: Include components for deployment (dockerfile, docker-compose.yml, deployment scripts in .github/workflows and deploy.sh). Also, acknowledge configuration elements like resources/config.json, build.sh, and configure.sh.

##### Relationships and Interactions
- Client/API Interaction: Start with a client (or end-user) making an HTTP request that hits one or more endpoints in your backend.
- API Routing: The request is processed by controllers (src/controller) which delegate business logic.
- Data Transfer Objects: DTOs (defined in src/dto) enable communication of structured data between layers.
- Swagger Integration: The SwaggerComponent shown in src/SwaggerComponent.hpp auto-generates API documentation, which could be denoted as an external service or part of the API layer.
- Deployment Flow: Display how build and deployment scripts (configure.sh, build.sh, run.sh, docker-compose.yml) lead to the actual deployed containerized service.

##### Architectural Patterns
- Separation of Concerns: Distinguish clearly between API (web layer), business logic (controllers and application components), data structures (DTOs), and persistence (database).
- Modular Design: The use of separate directories for controllers, DTOs, and integration libraries indicates a modular layout. This modularity allows you to highlight how each component interacts via clearly defined interfaces.
- DevOps & Automation: The presence of GitHub workflows and shell scripts for building/deploying denotes CI/CD pipelines.

##### Incorporate Relevant Technologies/Frameworks
- Oat++: Emphasize that the web framework underpins the server and API capabilities.
- PostgreSQL: Show the database system handling storage and queries.
- C++ 17: Indicate the programming language environment the application is built on.
- Docker: Illustrate how Docker (dockerfile and docker-compose.yml) packages the application for deployment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client & API Interaction"
        Client["Client (HTTP Request)"]:::client
    end

    subgraph "API Layer"
        WebServer["Web Server (Oat++ Framework)"]:::api
        Controller["Video Streaming Controller"]:::controller
        SwaggerDoc["Swagger Documentation"]:::swagger
    end

    subgraph "Application Logic"
        Backend["Backend Service"]:::backend
        DTO["Data Transfer Objects (DTOs)"]:::dto
    end

    subgraph "Data Access Layer"
        Database["Database (PostgreSQL)"]:::database
        SQLInit["SQL Initialization Script"]:::sql
    end

    subgraph "External Dependencies & Libraries"
        Oatpp["Oat++ Library"]:::external
        OatppPostgres["Oat++-PostgreSQL Library"]:::external
        OatppSwagger["Oat++-Swagger Library"]:::external
    end

    subgraph "Deployment & Configuration"
        Dockerfile["Dockerfile"]:::deploy
        DockerCompose["docker-compose.yml"]:::deploy
        DeployScript["deploy.sh"]:::deploy
        GitHubWorkflow["GitHub Workflow"]:::deploy
        RunScript["run.sh"]:::deploy
        Config["Configuration File"]:::deploy
        BuildScript["build.sh"]:::deploy
        ConfigureScript["configure.sh"]:::deploy
    end

    Client -->|"HTTP"| WebServer
    WebServer -->|"routes"| Controller
    WebServer -->|"auto-docs"| SwaggerDoc
    Controller -->|"business logic"| Backend
    SwaggerDoc -->|"document"| Backend
    Backend -->|"utilizes"| DTO
    Controller -->|"queries"| Database
    Backend -->|"communicates with"| Database
    SQLInit -->|"initializes"| Database

    Backend -->|"depends_on"| Oatpp
    Controller -->|"depends_on"| Oatpp
    Controller -->|"uses"| OatppPostgres
    SwaggerDoc -->|"integrates"| OatppSwagger

    Dockerfile -->|"builds"| Backend
    DockerCompose -->|"deploys"| Backend
    DeployScript -->|"deploys"| Backend
    GitHubWorkflow -->|"triggers"| BuildScript
    RunScript -->|"runs"| Backend
    Config -->|"configures"| Backend
    BuildScript -->|"compiles"| Backend
    ConfigureScript -->|"sets_up"| Backend

    classDef client fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef api fill:#FAD7A0,stroke:#9A7D0A,stroke-width:2px;
    classDef controller fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef backend fill:#D5F5E3,stroke:#239B56,stroke-width:2px;
    classDef dto fill:#FCF3CF,stroke:#B7950B,stroke-width:2px;
    classDef database fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
    classDef sql fill:#F1948A,stroke:#922B21,stroke-width:2px;
    classDef external fill:#D6EAF8,stroke:#2E86C1,stroke-width:2px;
    classDef deploy fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px;

    click Backend "https://github.com/maneesana/video-streaming-cpp-backend/tree/main/src/"
    click Controller "https://github.com/maneesana/video-streaming-cpp-backend/tree/main/src/controller"
    click SwaggerDoc "https://github.com/maneesana/video-streaming-cpp-backend/blob/main/src/SwaggerComponent.hpp"
    click DTO "https://github.com/maneesana/video-streaming-cpp-backend/tree/main/src/dto"
    click SQLInit "https://github.com/maneesana/video-streaming-cpp-backend/blob/main/sql/001_init.sql"
    click Oatpp "https://github.com/maneesana/video-streaming-cpp-backend/tree/main/external/oatpp"
    click OatppPostgres "https://github.com/maneesana/video-streaming-cpp-backend/tree/main/external/oatpp-postgresql"
    click OatppSwagger "https://github.com/maneesana/video-streaming-cpp-backend/tree/main/external/oatpp-swagger"
    click Dockerfile "https://github.com/maneesana/video-streaming-cpp-backend/tree/main/dockerfile"
    click DockerCompose "https://github.com/maneesana/video-streaming-cpp-backend/blob/main/docker-compose.yml"
    click DeployScript "https://github.com/maneesana/video-streaming-cpp-backend/blob/main/deploy.sh"
    click GitHubWorkflow "https://github.com/maneesana/video-streaming-cpp-backend/blob/main/.github/workflows/deploy.yml"
    click RunScript "https://github.com/maneesana/video-streaming-cpp-backend/blob/main/run.sh"
    click Config "https://github.com/maneesana/video-streaming-cpp-backend/blob/main/resources/config.json"
    click BuildScript "https://github.com/maneesana/video-streaming-cpp-backend/blob/main/build.sh"
    click ConfigureScript "https://github.com/maneesana/video-streaming-cpp-backend/blob/main/configure.sh"
```
