# atulmy/fullstack-event-driven-architecture architecture

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

- Interactive diagram: https://gitdiagram.com/atulmy/fullstack-event-driven-architecture
- Repository: https://github.com/atulmy/fullstack-event-driven-architecture

## Overview

##### Main Components
- API Microservices:
- API Core (projects/api/core): Handles central backend logic, routing, and core functionalities.
- API STT (projects/api/stt): Dedicated to speech-to-text functionalities.
- API TTS (projects/api/tts): Dedicated to text-to-speech functionalities.
- Front-end Applications:
- App Web (projects/app/web): Web version for end-users.
- App Console (projects/app/console): Console application for internal dashboards/administration.
- Site Web (projects/site/web): Likely a public-facing website.
- Shared Libraries/Packages:
- Common (packages/common): Contains shared configurations, utilities, and parameters that service different parts of the system.
- Model (packages/model): Contains domain models for blog, job, and user, ensuring consistency in data structures across services.
- UI (packages/ui): Provides shared UI components (React components, CSS/SCSS styling) that are used across front-end applications.
- Infrastructure and Integration:
- Database: Although not explicitly seen in the file tree, the README lists MongoDB as a prerequisite.
- Message Broker: Redis is used (primarily in development) for event handling between services, while the README notes that for production a more robust solution (e.g., RabbitMQ, Kafka) is suggested.
- Deployment/CI-CD: Dockerfiles for each service and workflows in the .github/workflows directory indicate containerization and automated deployment (e.g., GCP Cloud Run integration).

##### Relationships and Data Flow
- The API Services (Core, STT, and TTS) process and respond to business logic requests. They communicate with each other via event-driven mechanisms (through Redis in development) and may interface with the database.
- The front-end applications (App Web, App Console, and Site Web) interact with the API services via REST or GraphQL endpoints. They also use shared configurations from the common package.
- The shared packages (common, model, ui) serve as the foundational libraries that promote code reuse and consistency across both backend and frontend components.
- Deployment artifacts (Dockerfiles) encapsulate each service, and CI/CD pipelines (GitHub workflows) automate the build, test, and deployment processes.

##### Architectural Patterns and Design Principles
- Microservices Architecture: The system decomposes backend functionality into multiple services (core, stt, tts). Each microservice is independently managed, containerized, and deployed.
- Event-Driven Communication: As indicated by the usage of Redis for inter-service communication, events or messages are likely used to coordinate interactions between services.
- Layered/Modular Approach: The project separates concerns clearly—common logic in packages, domain models in the model package, UI components in the ui package, and dedicated front-end projects (app and site).
- Containerization and CI/CD: Dockerfiles for each service and integrated GitHub workflows support continuous deployment and scalability.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% API Microservices
    subgraph "API Microservices"
        apic["API Core Service"]:::backend
        apistt["API STT Service"]:::backend
        apitts["API TTS Service"]:::backend
    end

    %% Front-end Applications
    subgraph "Front-end Applications"
        webapp["App Web Frontend"]:::frontend
        consoleapp["App Console Frontend"]:::frontend
        siteweb["Site Web Application"]:::frontend
    end

    %% Shared Libraries
    subgraph "Shared Libraries"
        common["Shared Common Library"]:::shared
        model["Domain Models Package"]:::shared
        ui["UI Components Package"]:::shared
    end

    %% Infrastructure Components
    subgraph "Infrastructure"
        db["MongoDB Database"]:::database
        broker["Redis Message Broker\\n(Development; Production: RabbitMQ/Kafka)"]:::infrastructure
    end

    %% Deployment and CI/CD
    cicd["CI/CD Pipeline & Docker Deployments"]:::cicd

    %% Relationships: Front-end to API Microservices (User Requests)
    webapp -->|"calls"| apic
    webapp -->|"calls"| apistt
    webapp -->|"calls"| apitts

    consoleapp -->|"calls"| apic
    consoleapp -->|"calls"| apistt
    consoleapp -->|"calls"| apitts

    siteweb -->|"calls"| apic
    siteweb -->|"calls"| apistt
    siteweb -->|"calls"| apitts

    %% API Microservices interactions with Infrastructure
    apic -->|"CRUD"| db
    apistt -->|"CRUD"| db
    apitts -->|"CRUD"| db

    apic -->|"emits_event"| broker
    broker -->|"distributes_event"| apistt
    broker -->|"distributes_event"| apitts

    %% API Microservices depend on Shared Libraries
    apic ---|"uses"| common
    apic ---|"uses"| model
    apic ---|"uses"| ui

    apistt ---|"uses"| common
    apistt ---|"uses"| model

    apitts ---|"uses"| common
    apitts ---|"uses"| model
    apitts ---|"uses"| ui

    %% Front-end Applications depend on Shared Libraries
    webapp ---|"uses"| common
    consoleapp ---|"uses"| common
    siteweb ---|"uses"| common

    %% Deployment relationships
    cicd -->|"deploys"| apic
    cicd -->|"deploys"| apistt
    cicd -->|"deploys"| apitts
    cicd -->|"deploys"| webapp
    cicd -->|"deploys"| consoleapp
    cicd -->|"deploys"| siteweb
    cicd -->|"builds"| common
    cicd -->|"builds"| model
    cicd -->|"builds"| ui

    %% Class definitions with color coding
    classDef backend fill:#f9c,stroke:#333,stroke-width:2px;
    classDef frontend fill:#bbf,stroke:#333,stroke-width:2px;
    classDef shared fill:#cff,stroke:#333,stroke-width:2px;
    classDef database fill:#dfe,stroke:#333,stroke-width:2px;
    classDef infrastructure fill:#fcc,stroke:#333,stroke-width:2px;
    classDef cicd fill:#ffd,stroke:#333,stroke-width:2px;

    %% Click Events for Component Mapping
    click apic "https://github.com/atulmy/fullstack-event-driven-architecture/tree/main/projects/api/core"
    click apistt "https://github.com/atulmy/fullstack-event-driven-architecture/tree/main/projects/api/stt"
    click apitts "https://github.com/atulmy/fullstack-event-driven-architecture/tree/main/projects/api/tts"
    click webapp "https://github.com/atulmy/fullstack-event-driven-architecture/tree/main/projects/app/web"
    click consoleapp "https://github.com/atulmy/fullstack-event-driven-architecture/tree/main/projects/app/console"
    click siteweb "https://github.com/atulmy/fullstack-event-driven-architecture/tree/main/projects/site/web"
    click common "https://github.com/atulmy/fullstack-event-driven-architecture/tree/main/packages/common"
    click model "https://github.com/atulmy/fullstack-event-driven-architecture/tree/main/packages/model"
    click ui "https://github.com/atulmy/fullstack-event-driven-architecture/tree/main/packages/ui"
    click cicd "https://github.com/atulmy/fullstack-event-driven-architecture/tree/main/.github/workflows"
```
