# tutora-zpi/microservices architecture

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

- Interactive diagram: https://gitdiagram.com/tutora-zpi/microservices
- Repository: https://github.com/tutora-zpi/microservices

## Overview

##### Project type and purpose
- This is a polyglot, domain-driven microservices system.
- It comprises several bounded contexts (“account”, “meeting”, “alerts”, plus future “ml” and “status” services) that communicate via REST, WebSocket/SSE/WebRTC, and an event bus (RabbitMQ).
- Each microservice is independently packaged (Spring Boot, NestJS, Go) and containerized with Docker Compose.

##### File structure
- Top-level folders:
- account (user-service, class-service)
- meeting (meeting-scheduler-service, board-service, chat-service, voice-service, voice-webrtc)
- alerts (notification-service)
- (ml / status – mentioned in README but not yet in tree)
- Each subfolder contains its own Dockerfile, env samples, and compose overrides.
- Persistence/backing stores vary by service: relational (PostgreSQL via Spring Flyway or Go migrations), NoSQL (MongoDB), Redis (for ephemeral meeting state), AWS S3 (avatars, voice blobs).
- RabbitMQ config appears in almost every service for event publishing & consuming.
- Authentication: JWT/OAuth2 in user-service, propagated by other services via RabbitMQ or via HTTP headers.

##### README for additional insights
- The README enumerates each domain:
– account: auth & class management
– meeting: scheduling, real-time board, chat, voice, WebRTC signaling
– alerts: notification dispatch
– ml: note generation from audio (future)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Clients and Auth
    Client["Client (Web/Mobile)"]:::external
    OAuth["OAuth2 Provider (Google)"]:::external

    %% Account Domain
    subgraph "Account Domain"
        direction TB
        US["User-Service\n(Spring Boot)"]:::account
        CS["Class-Service\n(Spring Boot)"]:::account
        PostgresA["PostgreSQL"]:::db
    end

    %% Meeting Domain
    subgraph "Meeting Domain"
        direction TB
        MS["Meeting-Scheduler-Service\n(Go)"]:::meeting
        BS["Board-Service\n(NestJS)"]:::meeting
        Chat["Chat-Service\n(NestJS)"]:::meeting
        VS["Voice-Service\n(Go)"]:::meeting
        WebRTC["Voice-WebRTC Signaling\n(Node.js)"]:::meeting
        Redis["Redis"]:::db
    end

    %% Alerts Domain
    subgraph "Alerts Domain"
        direction TB
        NS["Notification-Service\n(Go)"]:::alerts
        MongoA["MongoDB"]:::db
    end

    %% Event Bus and Storage
    Rabbit["RabbitMQ\n(Event Bus)"]:::infra
    S3["AWS S3"]:::external
    MongoM["MongoDB"]:::db
    PostgresM["PostgreSQL"]:::db

    %% CI/CD and Config
    Compose["Docker Compose\nOrchestration"]:::infra
    EnvSample[".env.sample"]:::infra
    Readme["README.md"]:::infra
    Gitignore[".gitignore"]:::infra

    %% Flows: Auth and REST
    Client -->|HTTP/OAuth2| US
    US -->|issues JWT| Client
    Client -->|HTTP/JWT| CS
    CS -->|REST| PostgresA
    US -->|REST| PostgresA

    %% Events and Messaging
    CS -->|"ClassInvitationCreatedEvent\n AMQP"| Rabbit
    US -->|"UserDetailsRequestedEvent\n AMQP"| Rabbit
    US -->|"UserDetailsRespondedEvent\n AMQP"| Rabbit

    MS -->|REST Scheduling| Rabbit
    MS -->|"MeetingStartedEvent\n AMQP"| Rabbit
    MS -->|"MeetingEndedEvent\n AMQP"| Rabbit
    MS -->|Redis| Redis

    BS -->|"subscribe MeetingStartedEvent\n AMQP"| Rabbit
    BS -->|WebSocket| Client

    Chat -->|"subscribe MeetingStartedEvent\n AMQP"| Rabbit
    Chat -->|WebSocket/HTTP| Client
    Chat -->|persist| MongoM

    VS -->|"subscribe MeetingStartedEvent/EndedEvent\n AMQP"| Rabbit
    VS -->|"metadata| PostgreSQL"| PostgresM
    VS -->|"recorded chunks"| S3
    VS -->|"VoiceSessionCreatedEvent\n AMQP"| Rabbit
    VS -->|WebRTC signaling| WebRTC

    WebRTC -->|WebRTC| Client

    NS -->|"subscribe domain events\n AMQP"| Rabbit
    NS -->|push/email| Client
    NS -->|persist| MongoA

    %% Infrastructure
    Client -.->|reads config| EnvSample
    Compose -.->|orchestrates| US
    Compose -.-> CS
    Compose -.-> MS
    Compose -.-> BS
    Compose -.-> Chat
    Compose -.-> VS
    Compose -.-> WebRTC
    Compose -.-> NS
    Compose -.-> Rabbit

    %% Click Events
    click US "https://github.com/tutora-zpi/microservices/tree/main/account/user-service"
    click CS "https://github.com/tutora-zpi/microservices/tree/main/account/class-service"
    click MS "https://github.com/tutora-zpi/microservices/tree/main/meeting/meeting-scheduler-service"
    click BS "https://github.com/tutora-zpi/microservices/tree/main/meeting/board-service"
    click Chat "https://github.com/tutora-zpi/microservices/tree/main/meeting/chat-service"
    click VS "https://github.com/tutora-zpi/microservices/tree/main/meeting/voice-service"
    click WebRTC "https://github.com/tutora-zpi/microservices/tree/main/meeting/voice-webrtc"
    click NS "https://github.com/tutora-zpi/microservices/tree/main/alerts/notification-service"
    click Compose "https://github.com/tutora-zpi/microservices/blob/main/compose.yml"
    click EnvSample "https://github.com/tutora-zpi/microservices/blob/main/.env.sample"
    click Readme "https://github.com/tutora-zpi/microservices/blob/main/README.md"
    click Gitignore "https://github.com/tutora-zpi/microservices/blob/main/.gitignore"

    %% Styles
    classDef account fill:#FFD700,stroke:#333,stroke-width:1px
    classDef meeting fill:#87CEFA,stroke:#333,stroke-width:1px
    classDef alerts fill:#FFB6C1,stroke:#333,stroke-width:1px
    classDef infra fill:#D3D3D3,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef external fill:#98FB98,stroke:#333,stroke-width:1px
    classDef db fill:#FFFFFF,stroke:#333,stroke-width:1px,stroke-dasharray: 2 2
```
