# carlosmoreda/si-aom architecture

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

- Interactive diagram: https://gitdiagram.com/carlosmoreda/si-aom
- Repository: https://github.com/carlosmoreda/si-aom

## Overview

SI-AOM is a web application for managing customers, projects, budgets, production costs and cost forecasts. Users authenticate, then work through role-aware operational modules; the frontend sends requests to a FastAPI backend, which exposes domain APIs backed by PostgreSQL. Budget details and recorded costs support comparison and dashboard analysis, while a separate ML capability predicts costs. The graph preserves README capabilities and indexed modules; several backend routes and frontend modules were not excerpted, so their internal call paths are not asserted.

Main entry points: [`backend/app/main.py`](https://github.com/carlosmoreda/si-aom/blob/main/backend/app/main.py) (FastAPI application), [`frontend/src/services/apiClient.js`](https://github.com/carlosmoreda/si-aom/blob/main/frontend/src/services/apiClient.js) (API client), [`frontend/src/components/DashboardPage.jsx`](https://github.com/carlosmoreda/si-aom/blob/main/frontend/src/components/DashboardPage.jsx) (Dashboard and modules), [`frontend/src/App.jsx`](https://github.com/carlosmoreda/si-aom/blob/main/frontend/src/App.jsx) (Application shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["Application shell<br/>[App.jsx]"]
  node_auth["Authentication<br/>[useAuth.js]"]
  node_dashboard_ui["Dashboard and modules<br/>[DashboardPage.jsx]"]
  node_client_module["Customer management<br/>[ClientesModule.jsx]"]
  node_budget_module["Budget management"]
  node_actual_module["Actual costs"]
  node_api_client["API client<br/>[apiClient.js]"]
end

subgraph group_api["API and persistence"]
  node_backend["FastAPI application<br/>[main.py]"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_customer_routes["Customer routes<br/>[clientes.py]"]
  node_budget_routes["Budget routes<br/>[orcamentos.py]"]
  node_actual_routes["Actual-cost routes<br/>[realizado.py]"]
  node_database["Database session<br/>[database.py]"]
  node_postgres[("PostgreSQL")]
end

subgraph group_operations["Operational data"]
  node_customer_data[("Customer records<br/>[cliente.py]")]
  node_budget_service["Budget calculations"]
end

subgraph group_insights["Analysis and forecasts"]
  node_comparison["Budget comparison"]
  node_dashboard["Operational dashboard<br/>[dashboard.py]"]
  node_ml_routes["ML prediction API<br/>[ml.py]"]
  node_ml_service["ML forecasting<br/>[ml_service.py]"]
  node_etl["Budget dataset export<br/>[dataset.py]"]
  node_training["Random forest training"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"loads session"| node_auth
node_app -->|"renders"| node_dashboard_ui
node_auth -->|"requests authentication"| node_api_client
node_dashboard_ui -->|"renders"| node_client_module
node_dashboard_ui -->|"renders"| node_budget_module
node_dashboard_ui -->|"renders"| node_actual_module
node_client_module -->|"requests data"| node_api_client
node_budget_module -->|"requests data"| node_api_client
node_actual_module -->|"requests data"| node_api_client
node_api_client -->|"sends HTTP requests"| node_backend
node_backend -->|"registers"| node_auth_routes
node_backend -->|"registers"| node_customer_routes
node_backend -->|"registers"| node_budget_routes
node_backend -->|"registers"| node_actual_routes
node_backend -->|"registers"| node_dashboard
node_backend -->|"registers"| node_ml_routes
node_customer_routes -->|"reads and writes"| node_customer_data
node_customer_routes -->|"uses session"| node_database
node_database -->|"connects to"| node_postgres
node_budget_routes -->|"delegates"| node_budget_service
node_actual_routes -.->|"supports comparison"| node_comparison
node_dashboard -.->|"summarizes costs"| node_comparison
node_ml_routes -.->|"delegates"| node_ml_service
node_ml_service -->|"uses dataset export"| node_etl
node_ml_service -->|"uses training logic"| node_training
node_etl -->|"queries data"| node_database

click node_app "https://github.com/carlosmoreda/si-aom/blob/main/frontend/src/App.jsx"
click node_auth "https://github.com/carlosmoreda/si-aom/blob/main/frontend/src/hooks/useAuth.js"
click node_dashboard_ui "https://github.com/carlosmoreda/si-aom/blob/main/frontend/src/components/DashboardPage.jsx"
click node_client_module "https://github.com/carlosmoreda/si-aom/blob/main/frontend/src/modules/ClientesModule.jsx"
click node_budget_module "https://github.com/carlosmoreda/si-aom/blob/main/frontend/src/modules/OrcamentosModule.jsx"
click node_actual_module "https://github.com/carlosmoreda/si-aom/blob/main/frontend/src/modules/RealizadoModule.jsx"
click node_api_client "https://github.com/carlosmoreda/si-aom/blob/main/frontend/src/services/apiClient.js"
click node_backend "https://github.com/carlosmoreda/si-aom/blob/main/backend/app/main.py"
click node_auth_routes "https://github.com/carlosmoreda/si-aom/blob/main/backend/app/routers/auth.py"
click node_customer_routes "https://github.com/carlosmoreda/si-aom/blob/main/backend/app/routers/clientes.py"
click node_budget_routes "https://github.com/carlosmoreda/si-aom/blob/main/backend/app/routers/orcamentos.py"
click node_actual_routes "https://github.com/carlosmoreda/si-aom/blob/main/backend/app/routers/realizado.py"
click node_database "https://github.com/carlosmoreda/si-aom/blob/main/backend/app/database.py"
click node_customer_data "https://github.com/carlosmoreda/si-aom/blob/main/backend/app/models/cliente.py"
click node_budget_service "https://github.com/carlosmoreda/si-aom/blob/main/backend/app/services/orcamento_service.py"
click node_comparison "https://github.com/carlosmoreda/si-aom/blob/main/backend/app/services/comparacao_service.py"
click node_dashboard "https://github.com/carlosmoreda/si-aom/blob/main/backend/app/routers/dashboard.py"
click node_ml_routes "https://github.com/carlosmoreda/si-aom/blob/main/backend/app/routers/ml.py"
click node_ml_service "https://github.com/carlosmoreda/si-aom/blob/main/backend/app/services/ml_service.py"
click node_etl "https://github.com/carlosmoreda/si-aom/blob/main/backend/app/etl/dataset.py"
click node_training "https://github.com/carlosmoreda/si-aom/blob/main/backend/app/ml/train_random_forest.py"

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_app,node_auth,node_dashboard_ui,node_client_module,node_budget_module,node_actual_module,node_api_client,node_user toneBlue
class node_backend,node_auth_routes,node_customer_routes,node_budget_routes,node_actual_routes,node_database,node_postgres toneAmber
class node_customer_data,node_budget_service toneMint
class node_comparison,node_dashboard,node_ml_routes,node_ml_service,node_etl,node_training toneRose
```

## Components

### Web application

- [Application shell](https://github.com/carlosmoreda/si-aom/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Authentication](https://github.com/carlosmoreda/si-aom/blob/main/frontend/src/hooks/useAuth.js): `frontend/src/hooks/useAuth.js`
- [Dashboard and modules](https://github.com/carlosmoreda/si-aom/blob/main/frontend/src/components/DashboardPage.jsx): `frontend/src/components/DashboardPage.jsx`
- [Customer management](https://github.com/carlosmoreda/si-aom/blob/main/frontend/src/modules/ClientesModule.jsx): `frontend/src/modules/ClientesModule.jsx`
- [Budget management](https://github.com/carlosmoreda/si-aom/blob/main/frontend/src/modules/OrcamentosModule.jsx): `frontend/src/modules/OrcamentosModule.jsx`
- [Actual costs](https://github.com/carlosmoreda/si-aom/blob/main/frontend/src/modules/RealizadoModule.jsx): `frontend/src/modules/RealizadoModule.jsx`
- [API client](https://github.com/carlosmoreda/si-aom/blob/main/frontend/src/services/apiClient.js): `frontend/src/services/apiClient.js`

### API and persistence

- [FastAPI application](https://github.com/carlosmoreda/si-aom/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication routes](https://github.com/carlosmoreda/si-aom/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Customer routes](https://github.com/carlosmoreda/si-aom/blob/main/backend/app/routers/clientes.py): `backend/app/routers/clientes.py`
- [Budget routes](https://github.com/carlosmoreda/si-aom/blob/main/backend/app/routers/orcamentos.py): `backend/app/routers/orcamentos.py`
- [Actual-cost routes](https://github.com/carlosmoreda/si-aom/blob/main/backend/app/routers/realizado.py): `backend/app/routers/realizado.py`
- [Database session](https://github.com/carlosmoreda/si-aom/blob/main/backend/app/database.py): `backend/app/database.py`
- **PostgreSQL**

### Operational data

- [Customer records](https://github.com/carlosmoreda/si-aom/blob/main/backend/app/models/cliente.py): `backend/app/models/cliente.py`
- [Budget calculations](https://github.com/carlosmoreda/si-aom/blob/main/backend/app/services/orcamento_service.py): `backend/app/services/orcamento_service.py`

### Analysis and forecasts

- [Budget comparison](https://github.com/carlosmoreda/si-aom/blob/main/backend/app/services/comparacao_service.py): `backend/app/services/comparacao_service.py`
- [Operational dashboard](https://github.com/carlosmoreda/si-aom/blob/main/backend/app/routers/dashboard.py): `backend/app/routers/dashboard.py`
- [ML prediction API](https://github.com/carlosmoreda/si-aom/blob/main/backend/app/routers/ml.py): `backend/app/routers/ml.py`
- [ML forecasting](https://github.com/carlosmoreda/si-aom/blob/main/backend/app/services/ml_service.py): `backend/app/services/ml_service.py`
- [Budget dataset export](https://github.com/carlosmoreda/si-aom/blob/main/backend/app/etl/dataset.py): `backend/app/etl/dataset.py`
- [Random forest training](https://github.com/carlosmoreda/si-aom/blob/main/backend/app/ml/train_random_forest.py): `backend/app/ml/train_random_forest.py`

### Other components

- **User**

## Connections

- User → Application shell: uses (evidence: `README.md`)
- Application shell → Authentication: loads session (evidence: `frontend/src/App.jsx`)
- Application shell → Dashboard and modules: renders (evidence: `frontend/src/App.jsx`)
- Authentication → API client: requests authentication
- Dashboard and modules → Customer management: renders (evidence: `frontend/src/components/DashboardPage.jsx`)
- Dashboard and modules → Budget management: renders (evidence: `frontend/src/components/DashboardPage.jsx`)
- Dashboard and modules → Actual costs: renders (evidence: `frontend/src/components/DashboardPage.jsx`)
- Customer management → API client: requests data
- Budget management → API client: requests data
- Actual costs → API client: requests data
- API client → FastAPI application: sends HTTP requests (evidence: `README.md`)
- FastAPI application → Authentication routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Customer routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Budget routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Actual-cost routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Operational dashboard: registers (evidence: `backend/app/main.py`)
- FastAPI application → ML prediction API: registers (evidence: `backend/app/main.py`)
- Customer routes → Customer records: reads and writes (evidence: `backend/app/routers/clientes.py`)
- Customer routes → Database session: uses session (evidence: `backend/app/routers/clientes.py`)
- Database session → PostgreSQL: connects to (evidence: `backend/app/database.py`)
- Budget routes → Budget calculations: delegates (evidence: `backend/app/services/orcamento_service.py`)
- Actual-cost routes → Budget comparison: supports comparison
- Operational dashboard → Budget comparison: summarizes costs
- ML prediction API → ML forecasting: delegates
- ML forecasting → Budget dataset export: uses dataset export (evidence: `backend/app/services/ml_service.py`)
- ML forecasting → Random forest training: uses training logic (evidence: `backend/app/services/ml_service.py`)
- Budget dataset export → Database session: queries data (evidence: `backend/app/etl/dataset.py`)
