# andresbiso/2025_1c_tfg architecture

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

- Interactive diagram: https://gitdiagram.com/andresbiso/2025_1c_tfg
- Repository: https://github.com/andresbiso/2025_1c_tfg

## Overview

##### Project type and purpose
- This is a multi-tier full-stack application that combines:
- A React (Vite) frontend (“client”)
- A Node.js + Express backend API (“server”)
- A Python + Flask microservice for chatbot logic (“bot-server”)
- A Python “bot” component that integrates with Telegram
- Several supporting services (MongoDB, MinIO, Mailpit, DiceBear avatars, Mongo-Express UI)
- Purpose: deliver an e-learning platform with course management, user profiles, payments, notifications (email + Telegram), file storage, rating/reviews, and a CLI/Telegram bot.

##### File structure
- Top-level directories:
- client/ — React single-page frontend
- server/ — Express REST API, controllers, routes, models, integrations, mail, middleware
- bot-server/ — Flask app exposing endpoints the bot uses (e.g., scheduling jobs)
- bot/ — Python Telegram Bot logic (commands, message handling, QR, database handler, jobs)
- docker-compose.yaml — orchestrates all containers
- Key patterns:
- Microservices (bot, bot-server, server)
- MVC‐like layering in Node.js (controllers/models/routes)
- Service modules for integrations (Telegram, email, file uploads)
- Docker container per component

##### Extract additional insights from README
- Technologies: Node.js, Python, React
- Services spun up via Docker: MongoDB, Mongo-Express, MinIO (API & WebUI), Mailpit (SMTP & WebUI), DiceBear

## Diagram (Mermaid)

```mermaid
graph TB
    %% External User
    User["User Web Browser"]:::external

    %% Docker Compose Network
    subgraph "Docker Compose Network"
        direction TB

        %% Frontend
        React["React Frontend (Vite SPA)"]:::frontend
        click React "https://github.com/andresbiso/2025_1c_tfg/blob/main/client/src/main.jsx"

        %% Backend API
        subgraph "Express API Server" 
            direction TB
            API["Node.js + Express"]:::backend
            click API "https://github.com/andresbiso/2025_1c_tfg/blob/main/server/server.js"

            subgraph "Layers"
                direction TB
                Routes["Routes"]:::backend
                Controllers["Controllers"]:::backend
                Models["Models"]:::backend
            end

            Integrations["Integrations Module"]:::backend
            click Integrations "https://github.com/andresbiso/2025_1c_tfg/tree/main/server/integrations/routes/"

            MailTemplates["Mail Templates"]:::backend
            Middleware["Middleware"]:::backend
            Utils["Utils"]:::backend
        end

        %% Bot-Server
        BotServer["Python Flask Bot-Server"]:::backend
        click BotServer "https://github.com/andresbiso/2025_1c_tfg/blob/main/bot-server/main.py"
        click BotServerCompose "https://github.com/andresbiso/2025_1c_tfg/blob/main/bot-server/docker-compose.yaml"

        %% Telegram Bot
        TelegramBot["Python Telegram Bot"]:::backend
        click TelegramBot "https://github.com/andresbiso/2025_1c_tfg/blob/main/bot/main.py"
        click BotCompose "https://github.com/andresbiso/2025_1c_tfg/blob/main/bot/docker-compose.yaml"

        %% Data Stores
        MongoDB["MongoDB"]:::datastore
        MinIO["MinIO Object Storage"]:::datastore
        Mailpit["Mailpit SMTP & Web UI"]:::datastore
        MongoExpress["Mongo-Express UI"]:::datastore

        %% External Integrations
        DiceBear["DiceBear Avatar Service"]:::integration
        TelegramCloud["Telegram Cloud API"]:::integration
    end

    %% Documentation & Orchestration
    Docs["Architecture Diagram (draw.io)"]:::docs
    click Docs "https://github.com/andresbiso/2025_1c_tfg/blob/main/docs/diagrama_arquitectura/diagrama_arquitectura.drawio"
    Compose["Docker Compose"]:::orchestration
    click Compose "https://github.com/andresbiso/2025_1c_tfg/blob/main/docker-compose.yaml"

    %% Flows
    User -->|"loads SPA"| React
    React -->|"REST API"| API
    React -->|"avatars"| DiceBear

    API -->|"CRUD"| MongoDB
    API -->|"upload/download"| MinIO
    API -->|"SMTP"| Mailpit
    API -->|"notify via Telegram"| BotServer
    API -->|"integrate module"| Integrations

    BotServer -->|"job data"| MongoDB
    TelegramBot -->|"polling/webhooks"| TelegramCloud
    BotServer -->|"calls bot"| TelegramBot

    User -->|"admin UI"| MongoExpress

    %% Orchestration links
    Compose --> React
    Compose --> API
    Compose --> BotServer
    Compose --> TelegramBot
    Compose --> MongoDB
    Compose --> MinIO
    Compose --> Mailpit
    Compose --> MongoExpress

    Docs --- Compose

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#000,color:#000;
    classDef backend fill:#d4edda,stroke:#000,color:#000;
    classDef datastore fill:#fff3cd,stroke:#000,color:#000;
    classDef integration fill:#f5c6cb,stroke:#000,color:#000;
    classDef external fill:#e2e3e5,stroke:#000,color:#000;
    classDef docs fill:#d1ecf1,stroke:#000,color:#000;
    classDef orchestration fill:#f8d7da,stroke:#000,color:#000;
```
