# materkey/white-label-builder architecture

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

- Interactive diagram: https://gitdiagram.com/materkey/white-label-builder
- Repository: https://github.com/materkey/white-label-builder

## Overview

##### Main Components Identification

a) Frontend Layer:
- React/Redux application (static_src directory)
- Material UI components
- WebSocket client (Centrifugo client)

b) Backend Layer:
- Django web server
- Authentication system (VK OAuth2)
- REST API endpoints
- WebSocket server (Centrifugo)

c) Task Processing Layer:
- Celery workers
- Redis (message broker & result backend)

d) Build System:
- Android app builder
- Gradle build system
- Resource customization system

##### Component Relationships

a) Data Flow:
- User → Frontend → Backend → Celery Workers → Android Builder
- WebSocket real-time updates: Centrifugo → Frontend
- Authentication flow: Frontend → VK OAuth2 → Backend

b) Key Dependencies:
- Celery ↔ Redis
- Django ↔ Celery
- Frontend ↔ Centrifugo
- Backend ↔ Centrifugo

##### Specific Elements

a) Client Side:
**[Browser]**
- React/Redux App
- Material UI Components
- WebSocket Client

b) Server Side:
**[Django Backend]**
- REST API
- Authentication
- Task Management

c) Processing:
**[Build System]**
- Celery Workers
- Android Builder
- Resource Customizer

##### Process Flow Representation

Main workflow:

##### Technical Details to Highlight

- Webpack bundling process
- Celery task distribution
- Centrifugo real-time messaging
- Redis data flow
- OAuth2 authentication flow

Remember to include version information for major components and mark potential scaling points, as this is a distributed system designed with scalability in mind.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef processing fill:#e67e22,stroke:#d35400,color:white
    classDef storage fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white

    %% Client Zone
    subgraph Browser
        ReactApp["React/Redux App"]:::frontend
        MaterialUI["Material UI Components"]:::frontend
        WSClient["WebSocket Client"]:::frontend
        StateManagement["State Management"]:::frontend
    end

    %% Application Zone
    subgraph WebServer
        DjangoCore["Django Core"]:::backend
        RestAPI["REST API"]:::backend
        AuthSystem["Authentication System"]:::backend
        WSServer["Centrifugo Server"]:::backend
        AppConfig["App Configuration"]:::backend
        DataModels["Data Models"]:::backend
    end

    %% Processing Zone
    subgraph TaskProcessing
        CeleryWorkers["Celery Workers"]:::processing
        AndroidBuilder["Android Builder"]:::processing
        ResourceCustomizer["Resource Customizer"]:::processing
    end

    %% Storage Zone
    Redis[(Redis)]:::storage

    %% External Services Zone
    VKOAuth["VK OAuth2"]:::external

    %% Relationships
    ReactApp --> RestAPI
    ReactApp --> WSClient
    WSClient --> WSServer
    MaterialUI --> ReactApp
    StateManagement --> ReactApp
    
    RestAPI --> CeleryWorkers
    DjangoCore --> RestAPI
    AuthSystem --> VKOAuth
    DjangoCore --> AuthSystem
    DjangoCore --> WSServer
    DjangoCore --> DataModels
    AppConfig --> DjangoCore
    
    CeleryWorkers --> Redis
    CeleryWorkers --> AndroidBuilder
    AndroidBuilder --> ResourceCustomizer
    
    %% Click events for component mapping
    click ReactApp "https://github.com/materkey/white-label-builder/tree/master/whitelabelbuilder/static_src/"
    click MaterialUI "https://github.com/materkey/white-label-builder/tree/master/whitelabelbuilder/static_src/components/"
    click StateManagement "https://github.com/materkey/white-label-builder/tree/master/whitelabelbuilder/static_src/actions/"
    click AuthSystem "https://github.com/materkey/white-label-builder/blob/master/whitelabelbuilder/core/views.py"
    click DjangoCore "https://github.com/materkey/white-label-builder/tree/master/whitelabelbuilder/core/"
    click RestAPI "https://github.com/materkey/white-label-builder/blob/master/whitelabelbuilder/whitelabel/views.py"
    click WSServer "https://github.com/materkey/white-label-builder/tree/master/centrifugo/"
    click CeleryWorkers "https://github.com/materkey/white-label-builder/blob/master/whitelabelbuilder/whitelabelbuilder/celery.py"
    click AndroidBuilder "https://github.com/materkey/white-label-builder/blob/master/whitelabelbuilder/build.sh"
    click AppConfig "https://github.com/materkey/white-label-builder/blob/master/whitelabelbuilder/whitelabelbuilder/settings.py"
    click DataModels "https://github.com/materkey/white-label-builder/blob/master/whitelabelbuilder/whitelabel/models.py"

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Component"]:::backend
        Processing["Processing Component"]:::processing
        Storage["Storage Component"]:::storage
        External["External Service"]:::external
    end
```
