# ecg301997/arquitecturasoa architecture

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

- Interactive diagram: https://gitdiagram.com/ecg301997/arquitecturasoa
- Repository: https://github.com/ecg301997/arquitecturasoa

## Overview

##### Project type and purpose
- This is a Node.js Service-Oriented Architecture (SOA) application composed of five standalone microservices (auth, billing, clients, inventory, orders).
- Each service exposes a REST API via Express, persists data in its own MongoDB (via Mongoose), and uses dotenv for configuration.

##### File structure
- Top-level directories:
- auth, billing, clients, inventory, orders – each is a self-contained service.
- Inside each:
– app.js: sets up Express middleware and routes
– server.js: bootstraps the HTTP server and DB connection
– config/db.js: MongoDB connection logic
– controllers/: request handlers
– models/: Mongoose schemas
– routes/: route definitions
– .env.example: env-var template
- No shared library; each service is individually deployable.

##### README
- Confirms the SOA pattern and lists the responsibilities of each service.
- No API gateway or message bus is currently in place – services communicate over HTTP.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Client
    Client["External Client<br/>(Web/Mobile)"]:::client

    %% Services
    subgraph "Auth Service"
        AuthService["Auth Service<br/>Express + Mongoose"]:::service
        AuthDB[(AuthDB)]:::db
    end

    subgraph "Clients Service"
        ClientsService["Clients Service<br/>Express + Mongoose"]:::service
        ClientsDB[(ClientsDB)]:::db
    end

    subgraph "Inventory Service"
        InventoryService["Inventory Service<br/>Express + Mongoose"]:::service
        InventoryDB[(InventoryDB)]:::db
    end

    subgraph "Orders Service"
        OrdersService["Orders Service<br/>Express + Mongoose"]:::service
        OrdersDB[(OrdersDB)]:::db
    end

    subgraph "Billing Service"
        BillingService["Billing Service<br/>Express + Mongoose"]:::service
        BillingDB[(BillingDB)]:::db
    end

    %% Connections from Client
    Client -->|POST /login| AuthService
    Client -->|GET /clients| ClientsService
    Client -->|GET /products| InventoryService
    Client -->|POST /orders| OrdersService
    Client -->|POST /billing| BillingService

    %% Inter-service calls by Orders Service
    OrdersService -->|GET /products/:id| InventoryService
    OrdersService -->|GET /clients/:id| ClientsService
    OrdersService -->|POST /billing| BillingService

    %% Service to DB
    AuthService --> AuthDB
    ClientsService --> ClientsDB
    InventoryService --> InventoryDB
    OrdersService --> OrdersDB
    BillingService --> BillingDB

    %% Legend
    subgraph Legend
        LegendService["Service"]:::service
        LegendDB["Database"]:::db
        LegendClient["External Client"]:::client
    end

    %% Click events
    click AuthService "https://github.com/ecg301997/arquitecturasoa/tree/master/auth/"
    click ClientsService "https://github.com/ecg301997/arquitecturasoa/tree/master/clients/"
    click InventoryService "https://github.com/ecg301997/arquitecturasoa/tree/master/inventory/"
    click OrdersService "https://github.com/ecg301997/arquitecturasoa/tree/master/orders/"
    click BillingService "https://github.com/ecg301997/arquitecturasoa/tree/master/billing/"

    classDef service fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef db fill:#FFA500,stroke:#000,stroke-width:1px;
    classDef client fill:#90EE90,stroke:#000,stroke-width:1px;
```
