# unizar-30246-webengineering/lab6-microservices architecture

> Architecture diagram of the GitHub repository unizar-30246-webengineering/lab6-microservices, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/unizar-30246-webengineering/lab6-microservices
- Repository: https://github.com/unizar-30246-webengineering/lab6-microservices

## Overview

This repository implements a four-service account lookup application: a browser user searches through the MVC web service, which calls the accounts REST API; Eureka provides service discovery and Config Server supplies centralized configuration. The graph preserves the account search stages and the documented operational services. Source excerpts show the web-to-API and controller-to-repository calls; Eureka and Config Server relationships are documented in the README and application comments. Other templates and service wiring are represented at subsystem level where their implementation was not sampled.

Main entry points: [`web/src/main/java/web/web/WebAccountsController.java`](https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/web/src/main/java/web/web/WebAccountsController.java) (Web account routes), [`web/src/main/java/web/service/WebAccountsService.java`](https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/web/src/main/java/web/service/WebAccountsService.java) (Accounts client), [`config/src/main/kotlin/Application.kt`](https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/config/src/main/kotlin/Application.kt) (Config Server), [`accounts/src/main/kotlin/web/AccountsController.kt`](https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/accounts/src/main/kotlin/web/AccountsController.kt) (Account REST routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_web_controller["Web account routes"]
  node_search_criteria["Search validation"]
  node_web_service["Accounts client"]
  node_web_config["Client configuration"]
  node_web_account["Account DTO<br/>[Account.java]"]
  node_web_views["MVC templates"]
  node_web_app["Web service runtime<br/>[WebServer.java]"]
end

subgraph group_accounts["Accounts API"]
  node_accounts_controller["Account REST routes"]
  node_account_repository["Account repository"]
  node_account_model["Account entity<br/>[Account.kt]"]
  node_not_found["Not-found response"]
  node_account_database[("In-memory HSQLDB")]
  node_accounts_app["Accounts service runtime<br/>[Application.kt]"]
end

subgraph group_platform["Service platform"]
  node_eureka["Eureka registry<br/>[Application.kt]"]
end

subgraph group_configuration["Configuration"]
  node_config_server["Config Server<br/>[Application.kt]"]
  node_service_configs["Service configuration"]
end

node_visitor(("Browser user"))

node_visitor -->|"searches"| node_web_controller
node_web_controller -->|"validates"| node_search_criteria
node_web_controller -->|"requests accounts"| node_web_service
node_web_controller -->|"renders views"| node_web_views
node_web_config -->|"creates client"| node_web_service
node_web_service -->|"maps response"| node_web_account
node_web_service -->|"calls REST API"| node_accounts_controller
node_accounts_controller -->|"queries"| node_account_repository
node_accounts_controller -->|"throws on missing"| node_not_found
node_account_repository -->|"queries entity"| node_account_model
node_account_repository -.->|"reads"| node_account_database
node_accounts_app -->|"registers with"| node_eureka
node_web_app -->|"discovers services"| node_eureka
node_config_server -->|"registers with"| node_eureka
node_config_server -->|"serves"| node_service_configs
node_accounts_app -->|"fetches configuration"| node_config_server
node_web_app -.->|"fetches configuration"| node_config_server

click node_web_controller "https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/web/src/main/java/web/web/WebAccountsController.java"
click node_search_criteria "https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/web/src/main/java/web/model/SearchCriteria.java"
click node_web_service "https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/web/src/main/java/web/service/WebAccountsService.java"
click node_web_config "https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/web/src/main/java/web/config/WebServerConfiguration.java"
click node_web_account "https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/web/src/main/java/web/model/Account.java"
click node_web_views "https://github.com/unizar-30246-webengineering/lab6-microservices/tree/main/web/src/main/resources/templates"
click node_accounts_controller "https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/accounts/src/main/kotlin/web/AccountsController.kt"
click node_account_repository "https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/accounts/src/main/kotlin/repository/AccountRepository.kt"
click node_account_model "https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/accounts/src/main/kotlin/model/Account.kt"
click node_not_found "https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/accounts/src/main/kotlin/web/AccountNotFoundException.kt"
click node_eureka "https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/discovery/src/main/kotlin/Application.kt"
click node_config_server "https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/config/src/main/kotlin/Application.kt"
click node_service_configs "https://github.com/unizar-30246-webengineering/lab6-microservices/tree/main/config/config"
click node_accounts_app "https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/accounts/src/main/kotlin/Application.kt"
click node_web_app "https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/web/src/main/java/web/WebServer.java"

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_web_controller,node_search_criteria,node_web_service,node_web_config,node_web_account,node_web_views,node_web_app,node_visitor toneBlue
class node_accounts_controller,node_account_repository,node_account_model,node_not_found,node_account_database,node_accounts_app toneAmber
class node_eureka toneMint
class node_config_server,node_service_configs toneRose
```

## Components

### Web interface

- [Web account routes](https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/web/src/main/java/web/web/WebAccountsController.java): `web/src/main/java/web/web/WebAccountsController.java`
- [Search validation](https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/web/src/main/java/web/model/SearchCriteria.java): `web/src/main/java/web/model/SearchCriteria.java`
- [Accounts client](https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/web/src/main/java/web/service/WebAccountsService.java): `web/src/main/java/web/service/WebAccountsService.java`
- [Client configuration](https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/web/src/main/java/web/config/WebServerConfiguration.java): `web/src/main/java/web/config/WebServerConfiguration.java`
- [Account DTO](https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/web/src/main/java/web/model/Account.java): `web/src/main/java/web/model/Account.java`
- [MVC templates](https://github.com/unizar-30246-webengineering/lab6-microservices/tree/main/web/src/main/resources/templates): `web/src/main/resources/templates`
- [Web service runtime](https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/web/src/main/java/web/WebServer.java): `web/src/main/java/web/WebServer.java`

### Accounts API

- [Account REST routes](https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/accounts/src/main/kotlin/web/AccountsController.kt): `accounts/src/main/kotlin/web/AccountsController.kt`
- [Account repository](https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/accounts/src/main/kotlin/repository/AccountRepository.kt): `accounts/src/main/kotlin/repository/AccountRepository.kt`
- [Account entity](https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/accounts/src/main/kotlin/model/Account.kt): `accounts/src/main/kotlin/model/Account.kt`
- [Not-found response](https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/accounts/src/main/kotlin/web/AccountNotFoundException.kt): `accounts/src/main/kotlin/web/AccountNotFoundException.kt`
- **In-memory HSQLDB**
- [Accounts service runtime](https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/accounts/src/main/kotlin/Application.kt): `accounts/src/main/kotlin/Application.kt`

### Service platform

- [Eureka registry](https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/discovery/src/main/kotlin/Application.kt): `discovery/src/main/kotlin/Application.kt`

### Configuration

- [Config Server](https://github.com/unizar-30246-webengineering/lab6-microservices/blob/main/config/src/main/kotlin/Application.kt): `config/src/main/kotlin/Application.kt`
- [Service configuration](https://github.com/unizar-30246-webengineering/lab6-microservices/tree/main/config/config): `config/config`

### Other components

- **Browser user**

## Connections

- Browser user → Web account routes: searches (evidence: `README.md`)
- Web account routes → Search validation: validates (evidence: `web/src/main/java/web/web/WebAccountsController.java`)
- Web account routes → Accounts client: requests accounts (evidence: `web/src/main/java/web/web/WebAccountsController.java`)
- Web account routes → MVC templates: renders views (evidence: `web/src/main/java/web/web/WebAccountsController.java`)
- Client configuration → Accounts client: creates client (evidence: `web/src/main/java/web/config/WebServerConfiguration.java`)
- Accounts client → Account DTO: maps response (evidence: `web/src/main/java/web/service/WebAccountsService.java`)
- Accounts client → Account REST routes: calls REST API (evidence: `web/src/main/java/web/service/WebAccountsService.java`)
- Account REST routes → Account repository: queries (evidence: `accounts/src/main/kotlin/web/AccountsController.kt`)
- Account REST routes → Not-found response: throws on missing (evidence: `accounts/src/main/kotlin/web/AccountsController.kt`)
- Account repository → Account entity: queries entity (evidence: `accounts/src/main/kotlin/repository/AccountRepository.kt`)
- Account repository → In-memory HSQLDB: reads (evidence: `README.md`)
- Accounts service runtime → Eureka registry: registers with (evidence: `accounts/src/main/kotlin/Application.kt`)
- Web service runtime → Eureka registry: discovers services
- Config Server → Eureka registry: registers with (evidence: `config/src/main/kotlin/Application.kt`)
- Config Server → Service configuration: serves (evidence: `README.md`)
- Accounts service runtime → Config Server: fetches configuration (evidence: `accounts/src/main/kotlin/Application.kt`)
- Web service runtime → Config Server: fetches configuration (evidence: `README.md`)
