# fvenegas-v/nexus_tcg architecture

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

- Interactive diagram: https://gitdiagram.com/fvenegas-v/nexus_tcg
- Repository: https://github.com/fvenegas-v/nexus_tcg

## Overview

##### Project type and purpose
- Nexus TCG is a full-stack, cross-platform mobile application (Flutter) backed by a monolithic Django REST API.
- It connects trading-card-game players into communities, supports posts/comments/reactions, and computes user reputation with anti-gaming protections.

##### File structure
- Top-level “lib/” holds the Flutter front-end, organized by core (config, models, providers, services, widgets) and feature modules (auth, communities, posts, reputation, etc.).
- Top-level “backend/” is a Django project with apps: communities, users, games, nexus_api (project settings), Celery tasks, management commands, media storage, templates, and tests.
- Infrastructure/config files: Dockerfile(.dev), docker-compose.yml, GitHub Actions workflows, .env.example, and docs in docs/specs and docs/uml.

##### README for additional insights
- README explicitly lists technologies: Flutter/Dart on front, Django/DRF on back, SQLite dev vs PostgreSQL prod, Redis/Celery for async tasks, JWT auth, CI/CD via GitHub Actions, Docker Compose multi-service setup, adminer, and email via SMTP.
- It even sketches the folder layout for frontend.

##### Details to capture
- Frontend modules and state providers (optional detail)
- Celery tasks for image processing, anti-gaming, email sending
- Data flows for media uploads (HTTP → Django → file storage under media/ → served back)
- Authentication flow (Login → JWT issued → subsequent API calls)
- CI/CD flow (GitHub Actions → Docker images → staging)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client Tier"
        direction TB
        FlutterApp["Flutter Client"]:::frontend
        FlutterApp -->|"HTTP(S) requests"| DjangoAPI
    end

    subgraph "Server Tier"
        direction TB
        DjangoAPI["Django REST API"]:::service
        DjangoAPI -->|"CRUD operations"| PostgreSQL
        DjangoAPI -->|"Cache & broker"| Redis
        DjangoAPI -->|"Enqueue tasks"| CeleryWorker
        subgraph "Backend Apps"
            direction TB
            CommunitiesApp["Communities App"]:::service
            UsersApp["Users App"]:::service
            GamesApp["Games App"]:::service
            DjangoAPI --> CommunitiesApp
            DjangoAPI --> UsersApp
            DjangoAPI --> GamesApp
        end
    end

    subgraph "Task Tier"
        direction TB
        CeleryWorker["Celery Worker & Scheduler"]:::service
        CeleryWorker -->|"Write results"| PostgreSQL
        CeleryWorker -->|"Broker"| Redis
        CeleryWorker -->|"Send emails"| SMTP
    end

    subgraph "Data Tier"
        direction TB
        PostgreSQL[(PostgreSQL)]:::data
        Redis[(Redis Cache/Broker)]:::data
    end

    subgraph "External Services"
        direction TB
        SMTP["SMTP Email Service"]:::external
        Adminer["Adminer (DB UI)"]:::external
        Adminer -->|"Inspect DB"| PostgreSQL
    end

    subgraph "CI/CD & Infrastructure"
        direction TB
        GitHubActions["GitHub Actions CI/CD"]:::infra
        DockerCompose["Docker Compose"]:::infra
        GitHubActions -->|"Build & Test"| DockerCompose
        DockerCompose -->|"Deploy services"| DjangoAPI
        DockerCompose -->|"Deploy services"| Redis
        DockerCompose -->|"Deploy services"| PostgreSQL
        DockerCompose -->|"Deploy services"| CeleryWorker
        DockerCompose -->|"Deploy services"| Adminer
    end

    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px;
    classDef service fill:#90EE90,stroke:#333,stroke-width:1px;
    classDef data fill:#FFA500,stroke:#333,stroke-width:1px;
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px;
    classDef infra fill:#DDA0DD,stroke:#333,stroke-width:1px;

    click FlutterApp "https://github.com/fvenegas-v/nexus_tcg/blob/main/lib/main.dart"
    click FlutterApp "https://github.com/fvenegas-v/nexus_tcg/blob/main/lib/app.dart"
    click FlutterApp "https://github.com/fvenegas-v/nexus_tcg/tree/main/lib/core/"
    click FlutterApp "https://github.com/fvenegas-v/nexus_tcg/tree/main/lib/features/"
    click FlutterApp "https://github.com/fvenegas-v/nexus_tcg/tree/main/android/"
    click FlutterApp "https://github.com/fvenegas-v/nexus_tcg/tree/main/ios/"
    click FlutterApp "https://github.com/fvenegas-v/nexus_tcg/tree/main/web/"

    click DjangoAPI "https://github.com/fvenegas-v/nexus_tcg/blob/main/backend/nexus_api/settings.py"
    click DjangoAPI "https://github.com/fvenegas-v/nexus_tcg/blob/main/backend/nexus_api/urls.py"
    click DjangoAPI "https://github.com/fvenegas-v/nexus_tcg/blob/main/backend/nexus_api/asgi.py"
    click DjangoAPI "https://github.com/fvenegas-v/nexus_tcg/blob/main/backend/nexus_api/wsgi.py"

    click CommunitiesApp "https://github.com/fvenegas-v/nexus_tcg/tree/main/backend/communities/"
    click UsersApp "https://github.com/fvenegas-v/nexus_tcg/tree/main/backend/users/"
    click GamesApp "https://github.com/fvenegas-v/nexus_tcg/tree/main/backend/games/"

    click CeleryWorker "https://github.com/fvenegas-v/nexus_tcg/blob/main/backend/nexus_api/celery.py"
    click CeleryWorker "https://github.com/fvenegas-v/nexus_tcg/blob/main/backend/nexus_tcg/celery.py"
    click CeleryWorker "https://github.com/fvenegas-v/nexus_tcg/blob/main/backend/users/tasks.py"
    click CeleryWorker "https://github.com/fvenegas-v/nexus_tcg/blob/main/backend/core/utils/image_processor.py"

    click DockerCompose "https://github.com/fvenegas-v/nexus_tcg/blob/main/docker-compose.yml"
    click DockerCompose "https://github.com/fvenegas-v/nexus_tcg/blob/main/backend/Dockerfile.dev"
    click GitHubActions "https://github.com/fvenegas-v/nexus_tcg/tree/main/.github/workflows/"
    click SMTP "https://github.com/fvenegas-v/nexus_tcg/tree/main/backend/templates/emails/"
    click SMTP "https://github.com/fvenegas-v/nexus_tcg/blob/main/backend/templates/reset_password.html"

    click Adminer "https://github.com/fvenegas-v/nexus_tcg/blob/main/docker-compose.yml"
```
