# h-ssiqueira/invest architecture

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

- Interactive diagram: https://gitdiagram.com/h-ssiqueira/invest
- Repository: https://github.com/h-ssiqueira/invest

## Overview

Invest is a Spring application for simulating and storing Brazilian fixed-income investments and serving SELIC/IPCA rates. The main flow is an API client submitting investment requests, which the investment service validates and persists or sends through investment-type-specific calculations before returning results. Separate rate endpoints expose stored rate data and trigger rate updates; the README also documents startup and daily rate refreshes from Kaggle. Edges are limited to relationships shown in sampled files, the source index, or README; unsampled wiring is not inferred.

Main entry points: [`src/main/java/com/hss/investment/application/service/RateServiceImpl.java`](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/service/RateServiceImpl.java) (Rate service), [`src/main/java/com/hss/investment/application/service/calculation/service/InvestmentCalculationService.java`](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/service/calculation/service/InvestmentCalculationService.java) (Calculation base), [`src/main/java/com/hss/investment/application/service/InvestmentServiceImpl.java`](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/service/InvestmentServiceImpl.java) (Investment service), [`src/main/java/com/hss/investment/endpoint/RateController.java`](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/endpoint/RateController.java) (Rate endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API boundary"]
  node_investment_api["Investment endpoints"]
  node_rate_api["Rate endpoints"]
  node_errors["Error handling"]
end

subgraph group_investment["Investment domain"]
  node_investment_service["Investment service"]
  node_investment_model["Investment model<br/>[Investment.java]"]
  node_investment_store[("Investment storage")]
end

subgraph group_calculation["Simulation calculations"]
  node_calc_dispatch["Calculation dispatch"]
  node_calc_core["Calculation base"]
  node_prefixed_calc["Prefixed calculation"]
  node_inflation_calc["Inflation calculation"]
  node_postfixed_calc["Postfixed calculation"]
  node_math_library["Precision math"]
end

subgraph group_rates["Rates and persistence"]
  node_rate_service["Rate service"]
  node_rate_updater["Kaggle updater"]
  node_ipca_store[("IPCA storage")]
  node_selic_store[("SELIC storage")]
  node_holiday_store[("Holiday storage")]
  node_ipca_model["IPCA records<br/>[Ipca.java]"]
  node_selic_model["SELIC records<br/>[Selic.java]"]
end

node_client(("API client"))
node_kaggle[("Kaggle dataset")]

node_client -->|"requests"| node_investment_api
node_investment_api -->|"delegates"| node_investment_service
node_client -->|"requests"| node_rate_api
node_rate_api -->|"delegates"| node_rate_service
node_investment_service -->|"reads/writes"| node_investment_store
node_investment_service -->|"creates"| node_investment_model
node_investment_service -->|"dispatches"| node_calc_dispatch
node_calc_core -->|"permits"| node_prefixed_calc
node_calc_core -->|"permits"| node_inflation_calc
node_calc_core -->|"permits"| node_postfixed_calc
node_calc_core -->|"uses"| node_math_library
node_postfixed_calc -->|"reads holidays"| node_holiday_store
node_rate_service -->|"reads/writes"| node_ipca_store
node_rate_service -->|"reads/writes"| node_selic_store
node_rate_service -->|"maps rates"| node_ipca_model
node_rate_service -->|"maps rates"| node_selic_model
node_rate_api -->|"triggers"| node_rate_updater
node_rate_updater -.->|"fetches dataset"| node_kaggle

click node_investment_api "https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/endpoint/InvestmentController.java"
click node_rate_api "https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/endpoint/RateController.java"
click node_errors "https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/exception/ControllerExceptionAdvice.java"
click node_investment_service "https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/service/InvestmentServiceImpl.java"
click node_investment_model "https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/persistence/entity/Investment.java"
click node_investment_store "https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/persistence/InvestmentRepository.java"
click node_calc_dispatch "https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/service/calculation/InvestmentCalculationDelegator.java"
click node_calc_core "https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/service/calculation/service/InvestmentCalculationService.java"
click node_prefixed_calc "https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/service/calculation/service/InvestmentPrefixedCalculationService.java"
click node_inflation_calc "https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/service/calculation/service/InvestmentInflationCalculationService.java"
click node_postfixed_calc "https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/service/calculation/service/InvestmentPostfixedCalculationService.java"
click node_math_library "https://github.com/h-ssiqueira/invest/tree/master/src/main/java/org/nevec/rjm"
click node_rate_service "https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/service/RateServiceImpl.java"
click node_rate_updater "https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/service/RateKaggleUpdaterImpl.java"
click node_ipca_store "https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/persistence/IpcaRepository.java"
click node_selic_store "https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/persistence/SelicRepository.java"
click node_holiday_store "https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/persistence/HolidayRepository.java"
click node_ipca_model "https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/persistence/entity/Ipca.java"
click node_selic_model "https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/persistence/entity/Selic.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_investment_api,node_rate_api,node_errors,node_client toneBlue
class node_investment_service,node_investment_model,node_investment_store,node_kaggle toneAmber
class node_calc_dispatch,node_calc_core,node_prefixed_calc,node_inflation_calc,node_postfixed_calc,node_math_library toneMint
class node_rate_service,node_rate_updater,node_ipca_store,node_selic_store,node_holiday_store,node_ipca_model,node_selic_model toneRose
```

## Components

### API boundary

- [Investment endpoints](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/endpoint/InvestmentController.java): `src/main/java/com/hss/investment/endpoint/InvestmentController.java`
- [Rate endpoints](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/endpoint/RateController.java): `src/main/java/com/hss/investment/endpoint/RateController.java`
- [Error handling](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/exception/ControllerExceptionAdvice.java): `src/main/java/com/hss/investment/application/exception/ControllerExceptionAdvice.java`

### Investment domain

- [Investment service](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/service/InvestmentServiceImpl.java): `src/main/java/com/hss/investment/application/service/InvestmentServiceImpl.java`
- [Investment model](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/persistence/entity/Investment.java): `src/main/java/com/hss/investment/application/persistence/entity/Investment.java`
- [Investment storage](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/persistence/InvestmentRepository.java): `src/main/java/com/hss/investment/application/persistence/InvestmentRepository.java`

### Simulation calculations

- [Calculation dispatch](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/service/calculation/InvestmentCalculationDelegator.java): `src/main/java/com/hss/investment/application/service/calculation/InvestmentCalculationDelegator.java`
- [Calculation base](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/service/calculation/service/InvestmentCalculationService.java): `src/main/java/com/hss/investment/application/service/calculation/service/InvestmentCalculationService.java`
- [Prefixed calculation](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/service/calculation/service/InvestmentPrefixedCalculationService.java): `src/main/java/com/hss/investment/application/service/calculation/service/InvestmentPrefixedCalculationService.java`
- [Inflation calculation](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/service/calculation/service/InvestmentInflationCalculationService.java): `src/main/java/com/hss/investment/application/service/calculation/service/InvestmentInflationCalculationService.java`
- [Postfixed calculation](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/service/calculation/service/InvestmentPostfixedCalculationService.java): `src/main/java/com/hss/investment/application/service/calculation/service/InvestmentPostfixedCalculationService.java`
- [Precision math](https://github.com/h-ssiqueira/invest/tree/master/src/main/java/org/nevec/rjm): `src/main/java/org/nevec/rjm`

### Rates and persistence

- [Rate service](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/service/RateServiceImpl.java): `src/main/java/com/hss/investment/application/service/RateServiceImpl.java`
- [Kaggle updater](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/service/RateKaggleUpdaterImpl.java): `src/main/java/com/hss/investment/application/service/RateKaggleUpdaterImpl.java`
- [IPCA storage](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/persistence/IpcaRepository.java): `src/main/java/com/hss/investment/application/persistence/IpcaRepository.java`
- [SELIC storage](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/persistence/SelicRepository.java): `src/main/java/com/hss/investment/application/persistence/SelicRepository.java`
- [Holiday storage](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/persistence/HolidayRepository.java): `src/main/java/com/hss/investment/application/persistence/HolidayRepository.java`
- [IPCA records](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/persistence/entity/Ipca.java): `src/main/java/com/hss/investment/application/persistence/entity/Ipca.java`
- [SELIC records](https://github.com/h-ssiqueira/invest/blob/master/src/main/java/com/hss/investment/application/persistence/entity/Selic.java): `src/main/java/com/hss/investment/application/persistence/entity/Selic.java`

### Other components

- **API client**
- **Kaggle dataset**

## Connections

- API client → Investment endpoints: requests (evidence: `src/main/java/com/hss/investment/endpoint/InvestmentController.java`)
- Investment endpoints → Investment service: delegates (evidence: `src/main/java/com/hss/investment/endpoint/InvestmentController.java`)
- API client → Rate endpoints: requests (evidence: `src/main/java/com/hss/investment/endpoint/RateController.java`)
- Rate endpoints → Rate service: delegates (evidence: `src/main/java/com/hss/investment/endpoint/RateController.java`)
- Investment service → Investment storage: reads/writes (evidence: `src/main/java/com/hss/investment/application/service/InvestmentServiceImpl.java`)
- Investment service → Investment model: creates (evidence: `src/main/java/com/hss/investment/application/service/InvestmentServiceImpl.java`)
- Investment service → Calculation dispatch: dispatches (evidence: `src/main/java/com/hss/investment/application/service/InvestmentServiceImpl.java`)
- Calculation base → Prefixed calculation: permits (evidence: `src/main/java/com/hss/investment/application/service/calculation/service/InvestmentCalculationService.java`)
- Calculation base → Inflation calculation: permits (evidence: `src/main/java/com/hss/investment/application/service/calculation/service/InvestmentCalculationService.java`)
- Calculation base → Postfixed calculation: permits (evidence: `src/main/java/com/hss/investment/application/service/calculation/service/InvestmentCalculationService.java`)
- Calculation base → Precision math: uses (evidence: `src/main/java/com/hss/investment/application/service/calculation/service/InvestmentCalculationService.java`)
- Postfixed calculation → Holiday storage: reads holidays (evidence: `src/main/java/com/hss/investment/application/service/calculation/service/InvestmentPostfixedCalculationService.java`)
- Rate service → IPCA storage: reads/writes (evidence: `src/main/java/com/hss/investment/application/service/RateServiceImpl.java`)
- Rate service → SELIC storage: reads/writes (evidence: `src/main/java/com/hss/investment/application/service/RateServiceImpl.java`)
- Rate service → IPCA records: maps rates (evidence: `src/main/java/com/hss/investment/application/service/RateServiceImpl.java`)
- Rate service → SELIC records: maps rates (evidence: `src/main/java/com/hss/investment/application/service/RateServiceImpl.java`)
- Rate endpoints → Kaggle updater: triggers (evidence: `src/main/java/com/hss/investment/endpoint/RateController.java`)
- Kaggle updater → Kaggle dataset: fetches dataset (evidence: `README.md`)
