# sgalle16/legosplatform architecture

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

- Interactive diagram: https://gitdiagram.com/sgalle16/legosplatform
- Repository: https://github.com/sgalle16/legosplatform

## Overview

##### Project Type and Purpose
- LEGO's Platform is a multifaceted, containerized, microservices-based system.
- It features a full-stack application that includes a frontend (built with Angular), multiple backend microservices (such as api-gateway, api-tickets, and tickets-manage-ms), and a messaging system built on Kafka.
- The project emphasizes modular, independently deployable services orchestrated via Docker (Dockerfiles and docker-compose files are present) and integrated CI/CD pipelines (GitHub workflows).

##### Analyzing the File Structure
- Top-Level Directories:
- api-gateway: Contains the API routing layer that likely accepts incoming requests and routes them to the appropriate microservice.
- api-tickets: Likely handles ticket-related operations, built in Python with its own requirements file.
- tickets-manage-ms: A microservice responsible for managing tickets, including authentication middleware, route definitions, and a Firebase configuration.
- frontend: An Angular-based client application that has its own Dockerfile, build configurations (angular.json, tsconfig files), and specific UI components for login and dashboard.
- kafka: Implements a Kafka-based messaging system with producers, consumers, and configuration files.
- database: Contains Docker compose definitions and an initialization SQL script, suggesting this component hosts the project’s persistent data.
- CI/CD Integration:
- The .github/workflows directory has multiple YAML files indicating continuous integration pipelines for the different services.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    subgraph "User Interface Layer"
        client["Client/Browser"]:::external
        frontendUI["Frontend (Angular)"]:::frontend
    end
    client -->|"HTTP"| frontendUI

    %% Backend Services
    subgraph "Backend Services"
        apiGateway["API Gateway (Node.js)"]:::backend
        apiTickets["api-tickets Service (Python)"]:::backend
        ticketsManage["tickets-manage-ms Service (Node.js/TypeScript)"]:::backend
    end
    frontendUI -->|"HTTP(s)"| apiGateway
    apiGateway -->|"Routes"| apiTickets
    apiGateway -->|"Routes"| ticketsManage

    %% Messaging and Persistence
    subgraph "Messaging and Persistence"
        kafkaService["Kafka Messaging System"]:::messaging
        databaseStore["Database"]:::database
    end
    apiGateway -->|"Publishes"| kafkaService
    apiTickets -->|"Publishes/Consumes"| kafkaService
    ticketsManage -->|"Publishes/Consumes"| kafkaService

    apiTickets -->|"CRUD"| databaseStore
    ticketsManage -->|"CRUD"| databaseStore

    %% External Integration
    firebaseExt["Firebase External"]:::external
    ticketsManage -->|"AuthWith"| firebaseExt

    %% CI/CD Pipeline
    cicdPipe["CI/CD Pipeline"]:::cicd
    cicdPipe --- client
    cicdPipe --- frontendUI
    cicdPipe --- apiGateway
    cicdPipe --- apiTickets
    cicdPipe --- ticketsManage
    cicdPipe --- kafkaService
    cicdPipe --- databaseStore

    %% Styles
    classDef frontend fill:#f9c74f,stroke:#f9844a,stroke-width:2px;
    classDef backend fill:#90be6d,stroke:#43aa8b,stroke-width:2px;
    classDef messaging fill:#f94144,stroke:#f3722c,stroke-width:2px;
    classDef database fill:#277da1,stroke:#577590,stroke-width:2px;
    classDef cicd fill:#4d908e,stroke:#007f5f,stroke-width:2px;
    classDef external fill:#9d4edd,stroke:#5a3e85,stroke-width:2px;

    %% Click Events
    click frontendUI "https://github.com/sgalle16/legosplatform/tree/master/frontend/"
    click apiGateway "https://github.com/sgalle16/legosplatform/tree/master/api-gateway/"
    click apiTickets "https://github.com/sgalle16/legosplatform/tree/master/api-tickets/"
    click ticketsManage "https://github.com/sgalle16/legosplatform/tree/master/tickets-manage-ms/"
    click kafkaService "https://github.com/sgalle16/legosplatform/tree/master/kafka/"
    click databaseStore "https://github.com/sgalle16/legosplatform/tree/master/database/"
    click cicdPipe "https://github.com/sgalle16/legosplatform/tree/master/.github/workflows/"
```
