# miw-upm/goa architecture

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

- Interactive diagram: https://gitdiagram.com/miw-upm/goa
- Repository: https://github.com/miw-upm/goa

## Overview

1. **What this repository is**
   - This is not the application source code itself. It is a support repository for a teaching example of the GOA legal-office platform.
   - Its main purpose is to document architecture and provide deployment/database configuration artifacts for the broader system.

2. **System being described**
   - The target system is a law-firm management application split into:
     - an **Angular front-end**
     - a **microservices back-end**
   - The README explicitly says the back-end uses both **3-layer** and **hexagonal** architectural styles, so different services may be structured differently but share the same overall platform.

3. **Main runtime subsystems**
   - The back-end is composed of several independently deployed services:
     - **GOA User**
     - **GOA Engagement**
     - **GOA Billing**
     - **GOA Document**
     - **GOA Support**
     - **GOA AI1 / GOA AI2**
   - Supporting infrastructure services include:
     - **GOA Gateway**
     - **GOA Eureka**
   - The gateway acts as the public entry point, while Eureka provides service discovery for the microservices.

4. **Request flow**
   - Typical traffic path is:
     - browser/client → **Angular front-end**
     - front-end → **Gateway**
     - gateway → targeted microservice
     - microservice → its database
   - Service-to-service resolution is likely handled through **Eureka**, which fits the microservice discovery model described in the README.

5. **Security boundary**
   - Security is based on **OAuth2** and **OpenID Connect**.
   - The README indicates both authentication flows are implemented in the API, so the back-end is not just a resource server; it also participates in identity-related responsibilities.
   - This means the authentication/authorization boundary sits at the API layer rather than in the front-end.

6. **Persistence layer**
   - Persistence uses **JPA** with **Hibernate** on top of **PostgreSQL**.
   - The `database/docker-compose-db.yml` file suggests local database provisioning is containerized for development/testing.
   - The architecture is therefore database-backed rather than event-driven or file-based.

7. **Deployment and ingress**
   - The `deploy/` directory shows the operational edge of the system:
     - `nginx-conf-miwupm.txt`
     - `nginx-conf-ocanabogados.txt`
     - `cd-update-nginx-config.yml`
   - This indicates **Nginx** is used as the reverse proxy / public ingress layer, with different configs for different environments or hostnames.
   - `deploy/instance-lightsail.md` shows the system is deployed on **AWS Lightsail** in at least one setup.

8. **Environment-specific concerns**
   - The presence of separate Nginx configs for `miwupm` and `ocanabogados` implies this repo supports multiple deployment targets or branding variants.
   - The README’s AWS badges and system version endpoints suggest the services expose health/version endpoints used for operational visibility.

9. **Operational/teaching focus**
   - The repo is clearly educational: it supports MDW/BETCA coursework and demonstrates microservices, layered/hexagonal design, persistence, and OAuth2/OIDC in one example.
   - The architecture file `architecture/rest-project-duplicate.md` likely captures the design rationale for one of the REST service patterns used in the system.

10. **What to draw in an architecture diagram**
   - Show the **browser** on the left, the **Angular front-end**, then **Nginx/Gateway** as the public entry path.
   - Behind that, show the **microservices** as separate bounded contexts, each with its own **PostgreSQL-backed persistence**.
   - Add **Eureka** as the discovery/control-plane service and **OAuth2/OIDC** as the authentication authority/integration point.
   - Place the `database/` and `deploy/` artifacts as supporting infrastructure around the runtime system, not as application components themselves.

Main entry points: [`README.md`](https://github.com/miw-upm/goa/blob/main/README.md) (README), [`database/docker-compose-db.yml`](https://github.com/miw-upm/goa/blob/main/database/docker-compose-db.yml) (DB compose), [`architecture/rest-project-duplicate.md`](https://github.com/miw-upm/goa/blob/main/architecture/rest-project-duplicate.md) (Arch note), [`deploy/nginx-conf-miwupm.txt`](https://github.com/miw-upm/goa/blob/main/deploy/nginx-conf-miwupm.txt) (Nginx config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client_edge["Client & Edge"]
  node_browser(("Browser<br/>client"))
  node_angular["Angular UI<br/>frontend"]
  node_nginx["Nginx<br/>reverse-proxy"]
end

subgraph group_services["Microservices"]
  node_gateway["Gateway"]
  node_eureka[("Eureka<br/>discovery")]
  node_oauth{{"OAuth2 / OIDC<br/>identity"}}
  node_user_svc["User<br/>microservice"]
  node_engagement_svc["Engagement<br/>microservice"]
  node_billing_svc["Billing<br/>microservice"]
  node_document_svc["Document<br/>microservice"]
  node_support_svc["Support<br/>microservice"]
  node_ai_svc["AI services<br/>microservice"]
end

subgraph group_data["Persistence"]
  node_postgres[("PostgreSQL<br/>database")]
  node_db_compose["DB compose<br/>infra-config"]
end

subgraph group_support["Repo Artifacts"]
  node_arch_doc["Arch note<br/>documentation"]
  node_deploy_nginx_miwupm["Nginx config<br/>deploy-config"]
  node_deploy_nginx_ocana["Nginx config<br/>deploy-config"]
  node_deploy_update_nginx["CI update<br/>deploy-pipeline"]
  node_lightsail["Lightsail<br/>deployment-notes"]
  node_readme["README<br/>overview<br/>[README.md]"]
end

node_browser -->|"uses"| node_angular
node_angular -->|"routes through"| node_nginx
node_nginx -->|"proxies to"| node_gateway
node_gateway -->|"calls"| node_user_svc
node_gateway -->|"calls"| node_engagement_svc
node_gateway -->|"calls"| node_billing_svc
node_gateway -->|"calls"| node_document_svc
node_gateway -->|"calls"| node_support_svc
node_gateway -->|"calls"| node_ai_svc
node_gateway -->|"authenticates"| node_oauth
node_user_svc -->|"registers with"| node_eureka
node_engagement_svc -->|"registers with"| node_eureka
node_billing_svc -->|"registers with"| node_eureka
node_document_svc -->|"registers with"| node_eureka
node_support_svc -->|"registers with"| node_eureka
node_ai_svc -->|"registers with"| node_eureka
node_user_svc -->|"persists to"| node_postgres
node_engagement_svc -->|"persists to"| node_postgres
node_billing_svc -->|"persists to"| node_postgres
node_document_svc -->|"persists to"| node_postgres
node_support_svc -->|"persists to"| node_postgres
node_ai_svc -->|"persists to"| node_postgres
node_db_compose -.->|"provisions"| node_postgres
node_readme -.->|"describes"| node_gateway
node_readme -.->|"describes"| node_eureka
node_arch_doc -.->|"documents"| node_gateway
node_deploy_nginx_miwupm -.->|"configures"| node_nginx
node_deploy_nginx_ocana -.->|"configures"| node_nginx
node_deploy_update_nginx -.->|"updates"| node_nginx
node_lightsail -.->|"deploys"| node_nginx

click node_db_compose "https://github.com/miw-upm/goa/blob/main/database/docker-compose-db.yml"
click node_arch_doc "https://github.com/miw-upm/goa/blob/main/architecture/rest-project-duplicate.md"
click node_deploy_nginx_miwupm "https://github.com/miw-upm/goa/blob/main/deploy/nginx-conf-miwupm.txt"
click node_deploy_nginx_ocana "https://github.com/miw-upm/goa/blob/main/deploy/nginx-conf-ocanabogados.txt"
click node_deploy_update_nginx "https://github.com/miw-upm/goa/blob/main/deploy/cd-update-nginx-config.yml"
click node_lightsail "https://github.com/miw-upm/goa/blob/main/deploy/instance-lightsail.md"
click node_readme "https://github.com/miw-upm/goa/blob/main/README.md"

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_angular,node_nginx toneBlue
class node_gateway,node_eureka,node_oauth,node_user_svc,node_engagement_svc,node_billing_svc,node_document_svc,node_support_svc,node_ai_svc toneAmber
class node_postgres,node_db_compose toneMint
class node_arch_doc,node_deploy_nginx_miwupm,node_deploy_nginx_ocana,node_deploy_update_nginx,node_lightsail,node_readme toneRose
```

## Components

### Client & Edge

Browser, front-end, and public ingress path

- **Browser**: client · User access point
- **Angular UI**: frontend · Single-page client application
- **Nginx**: reverse-proxy · Public ingress and environment-specific routing

### Microservices

Business services and platform control-plane

- **Gateway**: api-gateway · API entry point to backend services
- **Eureka**: discovery · Service registry and discovery control plane
- **OAuth2 / OIDC**: identity · Authentication and authorization boundary
- **User**: microservice · User and identity-related service
- **Engagement**: microservice · Client engagement management
- **Billing**: microservice · Billing and accounting service
- **Document**: microservice · Document handling service
- **Support**: microservice · Support and case service
- **AI services**: microservice · AI-backed assistant services

### Persistence

Database layer and local provisioning

- **PostgreSQL**: database · Relational persistence backend
- [DB compose](https://github.com/miw-upm/goa/blob/main/database/docker-compose-db.yml): infra-config · Local database provisioning stack · `database/docker-compose-db.yml`

### Repo Artifacts

Documentation and deployment configuration in this support repository

- [Arch note](https://github.com/miw-upm/goa/blob/main/architecture/rest-project-duplicate.md): documentation · Architecture rationale for the REST service pattern · `architecture/rest-project-duplicate.md`
- [Nginx config](https://github.com/miw-upm/goa/blob/main/deploy/nginx-conf-miwupm.txt): deploy-config · MiwUPM ingress configuration · `deploy/nginx-conf-miwupm.txt`
- [Nginx config](https://github.com/miw-upm/goa/blob/main/deploy/nginx-conf-ocanabogados.txt): deploy-config · Ocanabogados ingress configuration · `deploy/nginx-conf-ocanabogados.txt`
- [CI update](https://github.com/miw-upm/goa/blob/main/deploy/cd-update-nginx-config.yml): deploy-pipeline · Workflow to update Nginx configuration · `deploy/cd-update-nginx-config.yml`
- [Lightsail](https://github.com/miw-upm/goa/blob/main/deploy/instance-lightsail.md): deployment-notes · AWS Lightsail deployment guidance · `deploy/instance-lightsail.md`
- [README](https://github.com/miw-upm/goa/blob/main/README.md): overview · Repository overview and system context · `README.md`

## Connections

- Browser → Angular UI: uses · Users access the Angular client
- Angular UI → Nginx: routes through · Client traffic reaches the public ingress
- Nginx → Gateway: proxies to · Ingress forwards API requests to the gateway
- Gateway → User: calls · Gateway routes requests to user management
- Gateway → Engagement: calls · Gateway routes requests to engagement
- Gateway → Billing: calls · Gateway routes requests to billing
- Gateway → Document: calls · Gateway routes requests to documents
- Gateway → Support: calls · Gateway routes requests to support
- Gateway → AI services: calls · Gateway routes requests to AI services
- Gateway → OAuth2 / OIDC: authenticates · API layer enforces OAuth2 and OpenID Connect flows
- User → Eureka: registers with · Services use discovery for runtime lookup
- Engagement → Eureka: registers with · Services use discovery for runtime lookup
- Billing → Eureka: registers with · Services use discovery for runtime lookup
- Document → Eureka: registers with · Services use discovery for runtime lookup
- Support → Eureka: registers with · Services use discovery for runtime lookup
- AI services → Eureka: registers with · Services use discovery for runtime lookup
- User → PostgreSQL: persists to · Each service uses relational persistence
- Engagement → PostgreSQL: persists to · Each service uses relational persistence
- Billing → PostgreSQL: persists to · Each service uses relational persistence
- Document → PostgreSQL: persists to · Each service uses relational persistence
- Support → PostgreSQL: persists to · Each service uses relational persistence
- AI services → PostgreSQL: persists to · Each service uses relational persistence
- DB compose → PostgreSQL: provisions · Local compose file provisions the database
- README → Gateway: describes · Repository documentation explains the entry path
- README → Eureka: describes · Repository documentation explains discovery
- Arch note → Gateway: documents · Architecture note captures REST service design
- Nginx config → Nginx: configures · Environment-specific ingress configuration
- Nginx config → Nginx: configures · Environment-specific ingress configuration
- CI update → Nginx: updates · CI workflow refreshes Nginx configuration
- Lightsail → Nginx: deploys · Deployment notes cover Lightsail setup
