# lucianofa/imersao19 architecture

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

- Interactive diagram: https://gitdiagram.com/lucianofa/imersao19
- Repository: https://github.com/lucianofa/imersao19

## Overview

##### Main Components Identification

The system consists of several key services:
- Frontend (NextJS application)
- Backend API (Django)
- Video Processing Service (Golang)
- Message Broker (RabbitMQ)
- Database (PostgreSQL)
- Reverse Proxy/Load Balancer (Nginx)
- Storage System (implied by media handling)

##### Component Relationships

- HTTP/REST calls between components
- Message queue publish/subscribe patterns
- Database connections
- Media streaming paths

##### Specific Implementation Details

Specialized sections showing:
- Video processing pipeline:
- Upload flow
- Chunking process
- Conversion process
- Streaming delivery
- Authentication flow
- Media delivery optimization

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        FE[Frontend]
        VP["Video Player"]:::frontend
        VL["Videos List"]:::frontend
        SB["Search Bar"]:::frontend
        PP["Video Playback Page"]:::frontend
    end

    subgraph "API Gateway"
        NG["Nginx Proxy"]:::proxy
    end

    subgraph "Application Services"
        subgraph "Django Backend"
            API["Core API"]:::backend
            VM["Video Models"]:::backend
            AS["API Serializers"]:::backend
            CS["Core Services"]:::backend
            VPC["Video Processing Consumer"]:::backend
            CUC["Chunks Upload Consumer"]:::backend
            RMQ_D["RabbitMQ Integration"]:::backend
        end

        subgraph "Golang Services"
            VC["Video Converter"]:::processor
            SP["Chunk Splitter"]:::processor
            CT["Converter Tasks"]:::processor
            RMQ_G["RabbitMQ Integration"]:::processor
        end
    end

    subgraph "Message Queue"
        RMQ["RabbitMQ Broker"]:::queue
    end

    subgraph "Storage"
        DB[(PostgreSQL)]:::database
        MS["Media Storage"]:::storage
        VC_CHUNKS["Video Chunks"]:::storage
        UP_STORE["Upload Storage"]:::storage
    end

    %% Component Relationships
    FE --> VP & VL & SB & PP
    VP & VL & SB & PP --> NG
    NG --> API
    API --> VM & AS & CS
    CS --> RMQ_D
    RMQ_D --> RMQ
    RMQ --> RMQ_G
    RMQ_G --> VC & SP
    VC --> CT
    CT --> VC_CHUNKS
    VPC & CUC --> MS
    API --> DB
    SP --> UP_STORE

    %% Styling
    classDef frontend fill:#2196F3,stroke:#1565C0,color:white
    classDef proxy fill:#78909C,stroke:#455A64,color:white
    classDef backend fill:#4CAF50,stroke:#2E7D32,color:white
    classDef processor fill:#FF9800,stroke:#EF6C00,color:white
    classDef queue fill:#FFC107,stroke:#FFA000,color:black
    classDef database fill:#9C27B0,stroke:#6A1B9A,color:white
    classDef storage fill:#795548,stroke:#4E342E,color:white

    %% Click Events
    click VP "https://github.com/lucianofa/imersao19/blob/main/nextjs/src/components/VideoPlayer.tsx"
    click VL "https://github.com/lucianofa/imersao19/blob/main/nextjs/src/components/VideosList.tsx"
    click SB "https://github.com/lucianofa/imersao19/blob/main/nextjs/src/components/Navbar/SearchBar.tsx"
    click PP "https://github.com/lucianofa/imersao19/blob/main/nextjs/src/app/[slug]/play/page.tsx"
    click API "https://github.com/lucianofa/imersao19/blob/main/django/core/api.py"
    click VM "https://github.com/lucianofa/imersao19/blob/main/django/core/models.py"
    click AS "https://github.com/lucianofa/imersao19/blob/main/django/core/serializers.py"
    click CS "https://github.com/lucianofa/imersao19/blob/main/django/core/services.py"
    click VC "https://github.com/lucianofa/imersao19/blob/main/golang/cmd/videoconverter/main.go"
    click SP "https://github.com/lucianofa/imersao19/blob/main/golang/cmd/splitchunks/main.go"
    click CT "https://github.com/lucianofa/imersao19/blob/main/golang/internal/converter/task.go"
    click RMQ_G "https://github.com/lucianofa/imersao19/blob/main/golang/pkg/rabbitmq/rabbitmq.go"
    click RMQ_D "https://github.com/lucianofa/imersao19/blob/main/django/core/rabbitmq.py"
    click VPC "https://github.com/lucianofa/imersao19/blob/main/django/core/management/commands/consumer_register_processed_video_path.py"
    click CUC "https://github.com/lucianofa/imersao19/blob/main/django/core/management/commands/consumer_upload_chunks_to_external_storage.py"
    click VC_CHUNKS "https://github.com/lucianofa/imersao19/tree/main/django/core/fixtures/media/video-test/"
    click UP_STORE "https://github.com/lucianofa/imersao19/tree/main/golang/mediatest/media/uploads/"
    click NG "https://github.com/lucianofa/imersao19/blob/main/nginx/nginx.conf"
```
