# juanpfrancos/events-architecture architecture

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

- Interactive diagram: https://gitdiagram.com/juanpfrancos/events-architecture
- Repository: https://github.com/juanpfrancos/events-architecture

## Overview

##### Main Components
- API Gateway: Acts as the central entry point, exposing a GraphQL interface (with queries and mutations for events and notifications). It aggregates data from the underlying microservices.
- Authentication Service: Handles user registration and authentication operations. Contains its own DB (and migrations via Alembic) to manage credentials and session data.
- Event Management Service: Manages the CRUD operations for events. It interfaces with a relational database for storing event details and also synchronizes data to Elasticsearch for search operations.
- Notification Service: Responsible for sending message notifications. This service likely interacts with messaging endpoints (using REST endpoints) and is exposed via API documentation like Swagger/Redoc.
- Databases and Search Infrastructure:
- SQL Databases (PostgreSQL) backing the Auth and Event services.
- Elasticsearch (with optional Kibana) used to provide full-text search and filtering over event data.
- Docker Environment: The entire architecture is containerized with Docker and coordinated via docker-compose.

##### Depicting Relationships and Interactions
- The API Gateway directs incoming GraphQL queries to the respective microservice (Auth, Events, Notifications).
- The Auth Service processes login/registration requests.
- The Events Service handles event creation, updates, and queries, and synchronizes event data to Elasticsearch.
- The Notification Service sends alerts or messages as requested via the API.
- External actors if desired, such as clients (browsers/Postman or Swagger/Redoc-based API exploration).

##### Architectural Patterns and Design Principles
- Microservices Pattern: Each service is self-contained with its own codebase, database configurations (including Alembic migrations for auth and events), and Docker container definitions.
- API Gateway Pattern: Centralized routing for GraphQL operations, serving as the liaison between clients and back-end services.
- Containerization & Orchestration: Emphasize Docker Compose’s role in bootstrapping the entire ecosystem.
- Integration with External Search Engine: Highlight the role of Elasticsearch (and optionally Kibana) for search capabilities.

##### Final Assembly
- Inside the microservices group, illustrate their specific interconnections:
- Auth and Event Services can point to their respective SQL databases.
- Notification Service may simply call out to external messaging systems.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client Layer"
        Client["Client (Browser/Postman/Swagger)"]:::client
    end

    subgraph "API Gateway Layer"
        APIGateway["API Gateway – GraphQL"]:::gateway
    end

    subgraph "Service Layer"
        Auth["Auth Service – User Management / Alembic"]:::service
        Events["Event Service – CRUD & Elasticsearch Sync"]:::service
        Notify["Notification Service – Messaging & API Docs"]:::service
    end

    subgraph "Data Layer"
        AuthDB["Auth PostgreSQL DB"]:::database
        EventsDB["Events PostgreSQL DB"]:::database
        Elastic["Elasticsearch Cluster"]:::search
    end

    subgraph "Containerization"
        Docker["Docker Compose Orchestration"]:::docker
    end

    Client -->|"GraphQLqueries/mutations"| APIGateway
    APIGateway -->|"RoutesRequests"| Auth
    APIGateway -->|"RoutesRequests"| Events
    APIGateway -->|"RoutesRequests"| Notify

    Auth -->|"DBOperations"| AuthDB
    Events -->|"CRUDOperations"| EventsDB
    Events -->|"DataSync"| Elastic

    Docker -->|"Orchestrates"| APIGateway
    Docker -->|"Orchestrates"| Auth
    Docker -->|"Orchestrates"| Events
    Docker -->|"Orchestrates"| Notify

    click APIGateway "https://github.com/juanpfrancos/events-architecture/tree/main/api_gateway/"
    click Auth "https://github.com/juanpfrancos/events-architecture/tree/main/auth_service/"
    click Events "https://github.com/juanpfrancos/events-architecture/tree/main/events_service/"
    click Notify "https://github.com/juanpfrancos/events-architecture/tree/main/notification_service/"
    click Docker "https://github.com/juanpfrancos/events-architecture/blob/main/docker-compose.yml"

    classDef client fill:#FFDFBA,stroke:#FF8C00,stroke-width:2px;
    classDef gateway fill:#C0E8F8,stroke:#007ACC,stroke-width:2px;
    classDef service fill:#B3D9FF,stroke:#0056b3,stroke-width:2px;
    classDef database fill:#C7F9CC,stroke:#3D9970,stroke-width:2px;
    classDef search fill:#E0E0E0,stroke:#808080,stroke-width:2px;
    classDef docker fill:#E2CEF6,stroke:#7D3C98,stroke-width:2px;
```
