# pixelweb-co/apienviosmicroservices architecture

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

- Interactive diagram: https://gitdiagram.com/pixelweb-co/apienviosmicroservices
- Repository: https://github.com/pixelweb-co/apienviosmicroservices

## Overview

##### Main Architectural Components
- API Gateway: Represented by gateway_api (with its nginx.conf), this component will route incoming requests to the proper microservices.
- Microservices: There are several services including:
- accounts_api (handles account-related operations)
- ofertas_api (manages offer-related functionality, which leverages RabbitMQ messaging in its services)
- solicitudes_api (manages request/solicitud operations)
- socket_service (handles real-time operations with socket communications, uses redis and RabbitMQ)
- calificar_service (a Java-based service for "calificar", possibly handling ratings or evaluations)
- micro_service_template (a template for quickly spinning up new services)
- update_service (manages update checks for the system)
- cluster_service_monitor (likely monitors the health or status of the clustered microservices)
- Auxiliary Components:
- A testing component (e.g., testing/socketConnect.html) possibly used for system testing and integration tests.
- Configuration files (such as .env files, Dockerfiles, docker-compose.yml) that assist with deployment and environment configuration.

##### Out Component Relationships and Data Flow
- For each microservice, represent them as independent components (possibly within their own Docker containers as indicated by their Dockerfiles and a shared docker-compose file).
- Integration of the calificar_service (Java application) with the rest of the system, likely communicating with other services via REST endpoints or even messaging if required.
- Cluster_service_monitor as a monitoring component that observes the health and performance of these services.

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% API Gateway Layer
    subgraph "API Gateway Layer"
        APIGateway["API Gateway"]:::gateway
    end

    %% Microservices Layer
    subgraph "Microservices Layer"
        Accounts["Accounts Microservice"]:::service
        Ofertas["Ofertas Microservice"]:::service
        Solicitudes["Solicitudes Microservice"]:::service
        Socket["Socket Service"]:::service
        Calificar["Calificar Service (Java)"]:::java
        Template["Microservice Template"]:::service
        Update["Update Service"]:::service
    end

    %% Messaging & Cache Layer
    subgraph "Messaging & Cache"
        RabbitMQ["RabbitMQ Messaging Bus"]:::mq
        OfertasMQ["Ofertas MQ Integration"]:::service
        SolicitudesMQ["Solicitudes MQ Integration"]:::service
        SocketMQ["Socket MQ Integration"]:::service
        SocketRedis["Socket Redis Integration"]:::redis
    end

    %% Monitoring Layer
    subgraph "Monitoring"
        Cluster["Cluster Service Monitor"]:::monitor
    end

    %% Testing Layer
    subgraph "Testing"
        Testing["Socket Connect Tester"]:::testing
    end

    %% Connections: API Gateway routes to microservices (synchronous REST calls)
    APIGateway -->|"REST"| Accounts
    APIGateway -->|"REST"| Ofertas
    APIGateway -->|"REST"| Solicitudes
    APIGateway -->|"REST"| Socket
    APIGateway -->|"REST"| Calificar
    APIGateway -->|"REST"| Template
    APIGateway -->|"REST"| Update

    %% Microservices asynchronous messaging connections
    Ofertas -->|"async"| OfertasMQ
    Solicitudes -->|"async"| SolicitudesMQ
    Socket -->|"async"| SocketMQ

    OfertasMQ -->|"async"| RabbitMQ
    SolicitudesMQ -->|"async"| RabbitMQ
    SocketMQ -->|"async"| RabbitMQ

    %% Socket Service cache integration
    Socket -->|"cache"| SocketRedis

    %% Monitoring connections (health checks)
    Cluster ---|"monitors"| APIGateway
    Cluster ---|"monitors"| Accounts
    Cluster ---|"monitors"| Ofertas
    Cluster ---|"monitors"| Solicitudes
    Cluster ---|"monitors"| Socket
    Cluster ---|"monitors"| Calificar
    Cluster ---|"monitors"| Template
    Cluster ---|"monitors"| Update

    %% Testing connection
    Testing -->|"tests"| Socket

    %% Click Events
    click APIGateway "https://github.com/pixelweb-co/apienviosmicroservices/blob/main/gateway_api/nginx.conf"
    click Accounts "https://github.com/pixelweb-co/apienviosmicroservices/tree/main/accounts_api/"
    click Ofertas "https://github.com/pixelweb-co/apienviosmicroservices/tree/main/ofertas_api/"
    click OfertasMQ "https://github.com/pixelweb-co/apienviosmicroservices/blob/main/ofertas_api/services/rabbitMq.js"
    click Solicitudes "https://github.com/pixelweb-co/apienviosmicroservices/tree/main/solicitudes_api/"
    click SolicitudesMQ "https://github.com/pixelweb-co/apienviosmicroservices/blob/main/solicitudes_api/services/rabbitMq.js"
    click Socket "https://github.com/pixelweb-co/apienviosmicroservices/tree/main/socket_service/"
    click SocketMQ "https://github.com/pixelweb-co/apienviosmicroservices/blob/main/socket_service/services/rabbitMq.js"
    click SocketRedis "https://github.com/pixelweb-co/apienviosmicroservices/blob/main/socket_service/services/redis.js"
    click Calificar "https://github.com/pixelweb-co/apienviosmicroservices/tree/main/calificar_service/"
    click Template "https://github.com/pixelweb-co/apienviosmicroservices/tree/main/micro_service_template/"
    click Update "https://github.com/pixelweb-co/apienviosmicroservices/tree/main/update_service/"
    click Cluster "https://github.com/pixelweb-co/apienviosmicroservices/tree/main/cluster_service_monitor/"
    click Testing "https://github.com/pixelweb-co/apienviosmicroservices/blob/main/testing/socketConnect.html"

    %% Styles
    classDef gateway fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef service fill:#d4edda,stroke:#155724,stroke-width:1px;
    classDef java fill:#ffeeba,stroke:#856404,stroke-width:1px;
    classDef mq fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef redis fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef monitor fill:#fff3cd,stroke:#856404,stroke-width:1px;
    classDef testing fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
```
