# gambaazul/dermanube architecture

> Architecture diagram of the GitHub repository gambaazul/dermanube, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gambaazul/dermanube
- Repository: https://github.com/gambaazul/dermanube

## Overview

#### Purpose and Entry Points
DermaNube is a dermatology-management platform: patients search specialists, reserve/cancel appointments, and trigger asynchronous notifications and document generation. Local composition starts through `docker-compose.yml`; the browser entry is `Aplicacion/Frontend/public/index.html`. AWS provisioning and activation are orchestrated by `Automatizacion/DesplegarBase.sh` and `Automatizacion/ActivarServicios.sh`.

#### Web Presentation and API Boundary
The static frontend is served by Nginx locally and, in AWS, from private S3 through CloudFront and WAF. Browser behavior and runtime endpoint configuration reside in `Aplicacion/Frontend/public/aplicacion.js` and `Aplicacion/Frontend/public/configuracion.js`; `Aplicacion/Frontend/nginx.conf` defines the container web-server boundary. Authenticated API requests pass through Cognito and API Gateway, which reaches an internal ALB via VPC Link rather than exposing services directly.

#### Core Domain Services
Two Node.js microservices run as ECS Fargate tasks and expose the application API:
- People/specialist management, initial data, DynamoDB persistence, and OpenSearch search: `Aplicacion/ServicioPersonas/src/Servidor.js`, `Aplicacion/ServicioPersonas/src/Aplicacion.js`, `Aplicacion/ServicioPersonas/src/RepositorioPersonas.js`.
- Appointment reservation/cancellation, transaction-oriented persistence, availability cache, and event publication: `Aplicacion/ServicioCitas/src/Servidor.js`, `Aplicacion/ServicioCitas/src/RepositorioCitas.js`, `Aplicacion/ServicioCitas/src/CacheHorarios.js`.

Service registration/discovery is supplied through Cloud Map. Images are defined by each service Dockerfile, including `Aplicacion/ServicioCitas/Dockerfile` and `Aplicacion/ServicioPersonas/Dockerfile`.

#### Persistence, Cache, and Search
DynamoDB is the system-of-record for persons and appointments. Redis/ElastiCache caches appointment schedules, while OpenSearch supports specialist queries. The services isolate these dependencies behind repository/cache modules rather than frontend access. AWS data, network, encryption, and container resources are principally declared in `Infraestructura/Terraform/Principal/Datos.tf`, `Infraestructura/Terraform/Principal/Red.tf`, and `Infraestructura/Terraform/Principal/Contenedores.tf`.

#### Asynchronous Processing
Appointment activity publishes FIFO events through SNS to separate SQS-backed paths. Notification handling is implemented as a Python handler, `Aplicacion/ProcesadorNotificaciones/Manejador.py`, intended for AWS Lambda. Document events are consumed by the Kubernetes worker, whose execution and generation logic are in `Aplicacion/TrabajadorDocumentos/src/Trabajador.js` and `Aplicacion/TrabajadorDocumentos/src/Documento.js`; its EKS deployment is `Infraestructura/Kubernetes/TrabajadorDocumentos.yml`. Generated documents are written to S3.

#### Observability and Operations
Both ECS services and the EKS worker emit metrics and logs; service-level metric/registration code is represented by `Aplicacion/ServicioCitas/src/Metricas.js` and `Aplicacion/ServicioPersonas/src/Registro.js`. Prometheus collects metrics, Loki stores logs, Alloy forwards telemetry, and Grafana provides dashboards/alerts: `Observabilidad/Prometheus/Prometheus.yml`, `Observabilidad/Loki/Loki.yml`, and `Observabilidad/Grafana/Tableros/ResumenDermaNube.json`.

#### Delivery, Governance, and AWS Control Plane
GitHub Actions performs CI, quality/security checks, and image publication; Jenkins coordinates continuous deployment: `.github/workflows/IntegracionContinua.yml` and `Jenkinsfile`. Terraform creates AWS foundations including Cognito/API access, messaging, observability, secrets, audit, backup, and budgets under `Infraestructura/Terraform/Principal/`; Ansible configures the automation host via `Infraestructura/Ansible/Playbooks/ConfigurarAutomatizacion.yml`. Checkov and OPA policy enforcement are rooted in `.checkov.yml` and `Politicas/Terraform/Seguridad.rego`.

Main entry points: [`Aplicacion/ServicioCitas/src/Servidor.js`](https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/ServicioCitas/src/Servidor.js) (Appointments service), [`Aplicacion/ServicioPersonas/src/Aplicacion.js`](https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/ServicioPersonas/src/Aplicacion.js) (People service), [`Infraestructura/Terraform/Principal/Contenedores.tf`](https://github.com/gambaazul/dermanube/blob/desarrollo/Infraestructura/Terraform/Principal/Contenedores.tf) (Terraform AWS foundation), [`Aplicacion/TrabajadorDocumentos/src/Trabajador.js`](https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/TrabajadorDocumentos/src/Trabajador.js) (Document worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_edge["Web edge"]
  node_browser["Browser application<br/>frontend<br/>[aplicacion.js]"]
  node_web_config["Endpoint configuration<br/>frontend config<br/>[configuracion.js]"]
  node_web_delivery["Nginx / S3 delivery<br/>static hosting<br/>[nginx.conf]"]
  node_api_access{{"Cognito + API Gateway<br/>API boundary"}}
end

subgraph group_services["Core services"]
  node_service_discovery["Cloud Map<br/>service discovery"]
  node_people_api["People service<br/>Node ECS service<br/>[Aplicacion.js]"]
  node_people_repository["People repository<br/>persistence adapter"]
  node_appointments_api["Appointments service<br/>Node ECS service<br/>[Servidor.js]"]
  node_appointment_repository["Appointment repository<br/>transaction adapter"]
  node_schedule_cache["Schedule cache<br/>Redis cache adapter<br/>[CacheHorarios.js]"]
  node_dynamodb[("DynamoDB<br/>system of record")]
  node_opensearch[("OpenSearch<br/>search index")]
  node_redis[("ElastiCache Redis<br/>availability cache")]
end

subgraph group_async["Async processing"]
  node_appointment_events["SNS FIFO events<br/>event topic"]
  node_notification_handler["Notification handler<br/>Python Lambda<br/>[Manejador.py]"]
  node_document_worker["Document worker<br/>Node EKS worker<br/>[Trabajador.js]"]
  node_document_storage[("Document S3<br/>object storage")]
end

subgraph group_operations["Platform operations"]
  node_observability["Prometheus, Loki, Grafana<br/>telemetry platform<br/>[Prometheus.yml]"]
  node_delivery_pipeline["CI/CD pipeline<br/>GitHub Actions + Jenkins"]
  node_terraform["Terraform AWS foundation<br/>infrastructure as code<br/>[Contenedores.tf]"]
  node_policy_controls["Policy controls<br/>Checkov + OPA<br/>[Seguridad.rego]"]
end

node_web_config -.->|"configures"| node_browser
node_web_delivery -->|"serves"| node_browser
node_browser -->|"authenticated API calls"| node_api_access
node_api_access -->|"routes via VPC Link / ALB"| node_people_api
node_api_access -->|"routes via VPC Link / ALB"| node_appointments_api
node_service_discovery -.->|"registers"| node_people_api
node_service_discovery -.->|"registers"| node_appointments_api
node_people_api -->|"uses"| node_people_repository
node_people_repository -->|"persists"| node_dynamodb
node_people_api -->|"indexes and queries"| node_opensearch
node_appointments_api -->|"uses"| node_appointment_repository
node_appointment_repository -->|"persists"| node_dynamodb
node_appointments_api -->|"uses"| node_schedule_cache
node_schedule_cache -->|"caches in"| node_redis
node_appointments_api -->|"publishes FIFO activity"| node_appointment_events
node_appointment_events -->|"notification queue path"| node_notification_handler
node_appointment_events -->|"document queue path"| node_document_worker
node_document_worker -->|"writes documents"| node_document_storage
node_people_api -.->|"metrics and logs"| node_observability
node_appointments_api -.->|"metrics and logs"| node_observability
node_document_worker -.->|"metrics and logs"| node_observability
node_delivery_pipeline -->|"deploys infrastructure"| node_terraform
node_policy_controls -.->|"validates"| node_terraform
node_terraform -.->|"provisions"| node_api_access
node_terraform -.->|"provisions"| node_service_discovery

click node_browser "https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/Frontend/public/aplicacion.js"
click node_web_config "https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/Frontend/public/configuracion.js"
click node_web_delivery "https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/Frontend/nginx.conf"
click node_people_api "https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/ServicioPersonas/src/Aplicacion.js"
click node_people_repository "https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/ServicioPersonas/src/RepositorioPersonas.js"
click node_appointments_api "https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/ServicioCitas/src/Servidor.js"
click node_appointment_repository "https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/ServicioCitas/src/RepositorioCitas.js"
click node_schedule_cache "https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/ServicioCitas/src/CacheHorarios.js"
click node_notification_handler "https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/ProcesadorNotificaciones/Manejador.py"
click node_document_worker "https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/TrabajadorDocumentos/src/Trabajador.js"
click node_observability "https://github.com/gambaazul/dermanube/blob/desarrollo/Observabilidad/Prometheus/Prometheus.yml"
click node_delivery_pipeline "https://github.com/gambaazul/dermanube/blob/desarrollo/.github/workflows/IntegracionContinua.yml"
click node_terraform "https://github.com/gambaazul/dermanube/blob/desarrollo/Infraestructura/Terraform/Principal/Contenedores.tf"
click node_policy_controls "https://github.com/gambaazul/dermanube/blob/desarrollo/Politicas/Terraform/Seguridad.rego"

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_browser,node_web_config,node_web_delivery,node_api_access toneBlue
class node_service_discovery,node_people_api,node_people_repository,node_appointments_api,node_appointment_repository,node_schedule_cache,node_dynamodb,node_opensearch,node_redis toneAmber
class node_appointment_events,node_notification_handler,node_document_worker,node_document_storage toneMint
class node_observability,node_delivery_pipeline,node_terraform,node_policy_controls toneRose
```

## Components

### Web edge

- [Browser application](https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/Frontend/public/aplicacion.js): frontend · Patient search and appointment workflows. · `Aplicacion/Frontend/public/aplicacion.js`
- [Endpoint configuration](https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/Frontend/public/configuracion.js): frontend config · `Aplicacion/Frontend/public/configuracion.js`
- [Nginx / S3 delivery](https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/Frontend/nginx.conf): static hosting · Nginx locally; private S3, CloudFront, and WAF in AWS. · `Aplicacion/Frontend/nginx.conf`
- **Cognito + API Gateway**: API boundary · Authenticated requests reach the internal load balancer through VPC Link.

### Core services

- **Cloud Map**: service discovery
- [People service](https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/ServicioPersonas/src/Aplicacion.js): Node ECS service · Manages people, specialists, and initial data. · `Aplicacion/ServicioPersonas/src/Aplicacion.js`
- [People repository](https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/ServicioPersonas/src/RepositorioPersonas.js): persistence adapter · `Aplicacion/ServicioPersonas/src/RepositorioPersonas.js`
- [Appointments service](https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/ServicioCitas/src/Servidor.js): Node ECS service · Reserves and cancels appointments and publishes activity. · `Aplicacion/ServicioCitas/src/Servidor.js`
- [Appointment repository](https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/ServicioCitas/src/RepositorioCitas.js): transaction adapter · `Aplicacion/ServicioCitas/src/RepositorioCitas.js`
- [Schedule cache](https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/ServicioCitas/src/CacheHorarios.js): Redis cache adapter · `Aplicacion/ServicioCitas/src/CacheHorarios.js`
- **DynamoDB**: system of record · Stores persons and appointments.
- **OpenSearch**: search index · Specialist queries.
- **ElastiCache Redis**: availability cache

### Async processing

- **SNS FIFO events**: event topic · Fans appointment activity into notification and document paths.
- [Notification handler](https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/ProcesadorNotificaciones/Manejador.py): Python Lambda · `Aplicacion/ProcesadorNotificaciones/Manejador.py`
- [Document worker](https://github.com/gambaazul/dermanube/blob/desarrollo/Aplicacion/TrabajadorDocumentos/src/Trabajador.js): Node EKS worker · Consumes document events and generates documents. · `Aplicacion/TrabajadorDocumentos/src/Trabajador.js`
- **Document S3**: object storage

### Platform operations

- [Prometheus, Loki, Grafana](https://github.com/gambaazul/dermanube/blob/desarrollo/Observabilidad/Prometheus/Prometheus.yml): telemetry platform · Collects metrics and logs and provides dashboards and alerts. · `Observabilidad/Prometheus/Prometheus.yml`
- [CI/CD pipeline](https://github.com/gambaazul/dermanube/blob/desarrollo/.github/workflows/IntegracionContinua.yml): GitHub Actions + Jenkins · Builds, checks, publishes images, and coordinates deployment. · `.github/workflows/IntegracionContinua.yml`
- [Terraform AWS foundation](https://github.com/gambaazul/dermanube/blob/desarrollo/Infraestructura/Terraform/Principal/Contenedores.tf): infrastructure as code · Provisions network, containers, access, messaging, and platform controls. · `Infraestructura/Terraform/Principal/Contenedores.tf`
- [Policy controls](https://github.com/gambaazul/dermanube/blob/desarrollo/Politicas/Terraform/Seguridad.rego): Checkov + OPA · Enforces infrastructure security policy. · `Politicas/Terraform/Seguridad.rego`

## Connections

- Endpoint configuration → Browser application: configures
- Nginx / S3 delivery → Browser application: serves
- Browser application → Cognito + API Gateway: authenticated API calls
- Cognito + API Gateway → People service: routes via VPC Link / ALB
- Cognito + API Gateway → Appointments service: routes via VPC Link / ALB
- Cloud Map → People service: registers
- Cloud Map → Appointments service: registers
- People service → People repository: uses
- People repository → DynamoDB: persists
- People service → OpenSearch: indexes and queries
- Appointments service → Appointment repository: uses
- Appointment repository → DynamoDB: persists
- Appointments service → Schedule cache: uses
- Schedule cache → ElastiCache Redis: caches in
- Appointments service → SNS FIFO events: publishes FIFO activity
- SNS FIFO events → Notification handler: notification queue path
- SNS FIFO events → Document worker: document queue path
- Document worker → Document S3: writes documents
- People service → Prometheus, Loki, Grafana: metrics and logs
- Appointments service → Prometheus, Loki, Grafana: metrics and logs
- Document worker → Prometheus, Loki, Grafana: metrics and logs
- CI/CD pipeline → Terraform AWS foundation: deploys infrastructure
- Policy controls → Terraform AWS foundation: validates
- Terraform AWS foundation → Cognito + API Gateway: provisions
- Terraform AWS foundation → Cloud Map: provisions
