# lucorral/pp3-ecommerce-microservices architecture

> Architecture diagram of the GitHub repository lucorral/pp3-ecommerce-microservices, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lucorral/pp3-ecommerce-microservices
- Repository: https://github.com/lucorral/pp3-ecommerce-microservices

## Overview

This is an Express API gateway for an ecommerce microservices system. The frontend sends requests to the gateway, which authenticates protected requests and proxies user, catalog, and order operations to their respective services. Order creation and cancellation also coordinate order and inventory calls. The README documents JWT authentication, internal service tokens, and the three upstream services; excerpts show selected routes and coordination logic, so other route-level details are not expanded here.

Main entry points: [`src/app.js`](https://github.com/lucorral/pp3-ecommerce-microservices/blob/arquitectura-microservicios/src/app.js) (Gateway routes), [`src/server.js`](https://github.com/lucorral/pp3-ecommerce-microservices/blob/arquitectura-microservicios/src/server.js) (Server bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Gateway runtime"]
  node_server["Server bootstrap<br/>[server.js]"]
  node_gateway["Gateway routes<br/>[app.js]"]
  node_health["Health checks<br/>[app.js]"]
end

subgraph group_identity["Identity and users"]
  node_auth["JWT authentication<br/>[app.js]"]
  node_user_routes["User routes<br/>[app.js]"]
end

subgraph group_commerce["Commerce APIs"]
  node_catalog_routes["Catalog routes<br/>[app.js]"]
  node_order_routes["Order routes<br/>[app.js]"]
end

subgraph group_coordination["Order coordination"]
  node_order_workflow["Order and stock workflow<br/>[app.js]"]
end

node_frontend(("Frontend"))
node_users_service["Users API"]
node_catalog_service["Catalog API"]
node_orders_service["Orders API"]

node_frontend -->|"sends requests"| node_gateway
node_server -->|"creates app"| node_gateway
node_gateway -->|"routes health checks"| node_health
node_gateway -->|"applies middleware"| node_auth
node_gateway -->|"routes user requests"| node_user_routes
node_gateway -->|"routes catalog requests"| node_catalog_routes
node_gateway -->|"routes order requests"| node_order_routes
node_user_routes -->|"proxies requests"| node_users_service
node_catalog_routes -->|"proxies requests"| node_catalog_service
node_order_routes -->|"proxies requests"| node_orders_service
node_order_routes -->|"creates and cancels"| node_order_workflow
node_order_workflow -->|"updates orders"| node_orders_service
node_order_workflow -->|"moves stock"| node_catalog_service

click node_server "https://github.com/lucorral/pp3-ecommerce-microservices/blob/arquitectura-microservicios/src/server.js"
click node_gateway "https://github.com/lucorral/pp3-ecommerce-microservices/blob/arquitectura-microservicios/src/app.js"
click node_health "https://github.com/lucorral/pp3-ecommerce-microservices/blob/arquitectura-microservicios/src/app.js"
click node_auth "https://github.com/lucorral/pp3-ecommerce-microservices/blob/arquitectura-microservicios/src/app.js"
click node_user_routes "https://github.com/lucorral/pp3-ecommerce-microservices/blob/arquitectura-microservicios/src/app.js"
click node_catalog_routes "https://github.com/lucorral/pp3-ecommerce-microservices/blob/arquitectura-microservicios/src/app.js"
click node_order_routes "https://github.com/lucorral/pp3-ecommerce-microservices/blob/arquitectura-microservicios/src/app.js"
click node_order_workflow "https://github.com/lucorral/pp3-ecommerce-microservices/blob/arquitectura-microservicios/src/app.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_server,node_gateway,node_health,node_frontend,node_users_service toneBlue
class node_auth,node_user_routes toneAmber
class node_catalog_routes,node_order_routes,node_catalog_service,node_orders_service toneMint
class node_order_workflow toneRose
```

## Components

### Gateway runtime

- [Server bootstrap](https://github.com/lucorral/pp3-ecommerce-microservices/blob/arquitectura-microservicios/src/server.js): `src/server.js`
- [Gateway routes](https://github.com/lucorral/pp3-ecommerce-microservices/blob/arquitectura-microservicios/src/app.js): `src/app.js`
- [Health checks](https://github.com/lucorral/pp3-ecommerce-microservices/blob/arquitectura-microservicios/src/app.js): `src/app.js`

### Identity and users

- [JWT authentication](https://github.com/lucorral/pp3-ecommerce-microservices/blob/arquitectura-microservicios/src/app.js): `src/app.js`
- [User routes](https://github.com/lucorral/pp3-ecommerce-microservices/blob/arquitectura-microservicios/src/app.js): `src/app.js`

### Commerce APIs

- [Catalog routes](https://github.com/lucorral/pp3-ecommerce-microservices/blob/arquitectura-microservicios/src/app.js): `src/app.js`
- [Order routes](https://github.com/lucorral/pp3-ecommerce-microservices/blob/arquitectura-microservicios/src/app.js): `src/app.js`

### Order coordination

- [Order and stock workflow](https://github.com/lucorral/pp3-ecommerce-microservices/blob/arquitectura-microservicios/src/app.js): `src/app.js`

### Other components

- **Frontend**
- **Users API**
- **Catalog API**
- **Orders API**

## Connections

- Frontend → Gateway routes: sends requests (evidence: `README.md`)
- Server bootstrap → Gateway routes: creates app (evidence: `src/server.js`)
- Gateway routes → Health checks: routes health checks (evidence: `src/app.js`)
- Gateway routes → JWT authentication: applies middleware (evidence: `src/app.js`)
- Gateway routes → User routes: routes user requests (evidence: `src/app.js`)
- Gateway routes → Catalog routes: routes catalog requests (evidence: `src/app.js`)
- Gateway routes → Order routes: routes order requests (evidence: `src/app.js`)
- User routes → Users API: proxies requests (evidence: `src/app.js`)
- Catalog routes → Catalog API: proxies requests (evidence: `src/app.js`)
- Order routes → Orders API: proxies requests (evidence: `src/app.js`)
- Order routes → Order and stock workflow: creates and cancels (evidence: `src/app.js`)
- Order and stock workflow → Orders API: updates orders (evidence: `src/app.js`)
- Order and stock workflow → Catalog API: moves stock (evidence: `src/app.js`)
