# pedrobubuli/tp2_arqui_publico architecture

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

- Interactive diagram: https://gitdiagram.com/pedrobubuli/tp2_arqui_publico
- Repository: https://github.com/pedrobubuli/tp2_arqui_publico

## Overview

This repository migrates an arVault currency-exchange service to Azure. A client sends an exchange request with a DNI; the API validates the request, the exchange logic checks the rate and accounts, consults ARCA, reserves funds and performs transfers, then records the outcome in shared Redis. The graph also shows account/rate management and the documented Azure deployment pieces. Runtime calls are grounded in the sampled Node files; infrastructure relationships are documented in the README, but the Terraform and Ansible sources were not sampled.

Main entry points: [`node/store.js`](https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/node/store.js) (Redis store), [`node/exchange.js`](https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/node/exchange.js) (Exchange logic), [`node/arca.js`](https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/node/arca.js) (ARCA client), [`node/app.js`](https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/node/app.js) (Exchange API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and exchange"]
  node_api["Exchange API<br/>[app.js]"]
  node_logic["Exchange logic<br/>[exchange.js]"]
  node_arca_client["ARCA client<br/>[arca.js]"]
  node_config["Runtime config<br/>[config.js]"]
end

subgraph group_state["Shared state"]
  node_store["Redis store<br/>[store.js]"]
  node_accounts_seed["Account seed<br/>[accounts.json]"]
  node_rates_seed["Rate seed<br/>[rates.json]"]
  node_redis[("Shared Redis<br/>[redis.tf]")]
end

subgraph group_cloud["Azure infrastructure"]
  node_arca_service["ARCA service<br/>[arca.tf]"]
  node_vmss["Azure VM scale set<br/>[node.tf]"]
  node_jumpbox["VMSS jumpbox<br/>[jumpbox.tf]"]
end

node_client(("Exchange client"))
node_load_generator(("Load generator"))

node_client -.->|"sends requests"| node_api
node_load_generator -.->|"sends load"| node_api
node_api -->|"calls exchange"| node_logic
node_logic -->|"reads and writes"| node_store
node_logic -->|"validates DNI"| node_arca_client
node_arca_client -->|"reads endpoint"| node_config
node_store -->|"reads connection"| node_config
node_store -->|"loads seed"| node_accounts_seed
node_store -->|"loads seed"| node_rates_seed
node_store -->|"reads and writes"| node_redis
node_arca_client -.->|"POST validates"| node_arca_service
node_vmss -.->|"uses shared storage"| node_redis
node_jumpbox -.->|"administers instances"| node_vmss

click node_api "https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/node/app.js"
click node_logic "https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/node/exchange.js"
click node_arca_client "https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/node/arca.js"
click node_config "https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/node/config.js"
click node_store "https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/node/store.js"
click node_accounts_seed "https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/node/state/accounts.json"
click node_rates_seed "https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/node/state/rates.json"
click node_redis "https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/redis.tf"
click node_arca_service "https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/arca.tf"
click node_vmss "https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/node.tf"
click node_jumpbox "https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/jumpbox.tf"

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_api,node_logic,node_arca_client,node_config,node_client toneBlue
class node_store,node_accounts_seed,node_rates_seed,node_redis toneAmber
class node_arca_service,node_vmss,node_jumpbox toneMint
class node_load_generator toneIndigo
```

## Components

### API and exchange

- [Exchange API](https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/node/app.js): `node/app.js`
- [Exchange logic](https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/node/exchange.js): `node/exchange.js`
- [ARCA client](https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/node/arca.js): `node/arca.js`
- [Runtime config](https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/node/config.js): `node/config.js`

### Shared state

- [Redis store](https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/node/store.js): `node/store.js`
- [Account seed](https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/node/state/accounts.json): `node/state/accounts.json`
- [Rate seed](https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/node/state/rates.json): `node/state/rates.json`
- [Shared Redis](https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/redis.tf): `redis.tf`

### Azure infrastructure

- [ARCA service](https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/arca.tf): `arca.tf`
- [Azure VM scale set](https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/node.tf): `node.tf`
- [VMSS jumpbox](https://github.com/pedrobubuli/tp2_arqui_publico/blob/main/jumpbox.tf): `jumpbox.tf`

### Other components

- **Exchange client**
- **Load generator**

## Connections

- Exchange client → Exchange API: sends requests (evidence: `README.md`)
- Load generator → Exchange API: sends load (evidence: `README.md`)
- Exchange API → Exchange logic: calls exchange (evidence: `node/app.js`)
- Exchange logic → Redis store: reads and writes (evidence: `node/exchange.js`)
- Exchange logic → ARCA client: validates DNI (evidence: `node/exchange.js`)
- ARCA client → Runtime config: reads endpoint (evidence: `node/arca.js`)
- Redis store → Runtime config: reads connection (evidence: `node/store.js`)
- Redis store → Account seed: loads seed (evidence: `node/store.js`)
- Redis store → Rate seed: loads seed (evidence: `node/store.js`)
- Redis store → Shared Redis: reads and writes (evidence: `node/store.js`)
- ARCA client → ARCA service: POST validates (evidence: `README.md`)
- Azure VM scale set → Shared Redis: uses shared storage (evidence: `README.md`)
- VMSS jumpbox → Azure VM scale set: administers instances (evidence: `README.md`)
