# mmaudet/ovh-cost-manager architecture

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

- Interactive diagram: https://gitdiagram.com/mmaudet/ovh-cost-manager
- Repository: https://github.com/mmaudet/ovh-cost-manager

## Overview

OVH Cost Manager imports OVHcloud billing and account data into local SQLite, then serves an account-aware API to a React dashboard for cost, infrastructure, trend, comparison, and carbon analysis. The map preserves documented dashboard branches and CLI exports alongside the sampled runtime layers. Several tab and server implementations were not excerpted, so their documented capabilities are shown, but uncertain internal call paths are omitted.

Main entry points: [`dashboard/src/pages/Dashboard.jsx`](https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/pages/Dashboard.jsx) (Dashboard shell), [`data/db.js`](https://github.com/mmaudet/ovh-cost-manager/blob/main/data/db.js) (SQLite database), [`server/index.js`](https://github.com/mmaudet/ovh-cost-manager/blob/main/server/index.js) (API server), [`data/import.js`](https://github.com/mmaudet/ovh-cost-manager/blob/main/data/import.js) (Data importer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Import and tools"]
  node_importer["Data importer<br/>[import.js]"]
end

subgraph group_backend["API and authentication"]
  node_server["API server<br/>[index.js]"]
  node_auth["OIDC authentication<br/>[routes.js]"]
  node_consumption["Consumption service<br/>[consumption.js]"]
end

subgraph group_data["Billing data"]
  node_database[("SQLite database<br/>[db.js]")]
  node_classification["Cost classification<br/>[classify.js]"]
  node_cloud_usage["Cloud usage<br/>[cloud-usage.js]"]
  node_months["Billing months<br/>[months.js]"]
  node_sql_conditions["Query conditions<br/>[sql-conditions.js]"]
end

subgraph group_dashboard["Dashboard analysis"]
  node_dashboard["Dashboard shell<br/>[Dashboard.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_account_state["Account selection<br/>[accounts.js]"]
  node_overview["Overview analysis<br/>[OverviewTab.jsx]"]
  node_comparison["Month comparison<br/>[useCompareTab.js]"]
  node_comparison_rows["Unfolded comparisons<br/>[UnfoldingRow.jsx]"]
  node_trends["Trend analysis<br/>[TrendsTab.jsx]"]
  node_public_cloud["Public Cloud<br/>[PublicCloudTab.jsx]"]
  node_web_cloud["Web Cloud<br/>[WebCloudTab.jsx]"]
  node_infrastructure["Infrastructure inventory"]
  node_backup["Backup analysis<br/>[BackupTab.jsx]"]
  node_carbon["Carbon footprint<br/>[CarbonTab.jsx]"]
  node_sorting["Sortable tables<br/>[SortableHeader.jsx]"]
end

subgraph group_exports["Exports and CLI"]
  node_cli["Invoice CLI<br/>[index.js]"]
  node_project_cli["Project bill tools"]
  node_csv["CSV and reports<br/>[csv.js]"]
end

node_operator(("Operator"))
node_ovh["OVHcloud API"]

node_operator -->|"starts import"| node_importer
node_importer -->|"fetches billing data"| node_ovh
node_importer -->|"stores imports"| node_database
node_operator -->|"opens dashboard"| node_server
node_dashboard -->|"requests data"| node_api_client
node_api_client -->|"calls API"| node_server
node_server -->|"queries"| node_database
node_server -->|"mounts authentication"| node_auth
node_server -->|"serves consumption"| node_consumption
node_project_cli -->|"reads bills"| node_database
node_dashboard -->|"shows tab"| node_overview
node_dashboard -->|"shows tab"| node_comparison
node_dashboard -->|"shows tab"| node_trends
node_dashboard -->|"shows tab"| node_public_cloud
node_dashboard -->|"shows tab"| node_web_cloud
node_dashboard -->|"shows tab"| node_infrastructure
node_dashboard -->|"shows tab"| node_backup
node_dashboard -->|"shows tab"| node_carbon
node_comparison -->|"fetches comparison data"| node_api_client
node_comparison -->|"uses unfolding rows"| node_comparison_rows
node_dashboard -->|"selects account"| node_account_state
node_overview -.->|"sorts tables"| node_sorting
node_infrastructure -->|"exports CSV"| node_csv
node_operator -->|"runs invoice tool"| node_cli
node_classification -->|"classifies bill lines"| node_database
node_cloud_usage -->|"supplies usage kinds"| node_database
node_months -->|"supports month queries"| node_database
node_sql_conditions -->|"builds query conditions"| node_database

click node_importer "https://github.com/mmaudet/ovh-cost-manager/blob/main/data/import.js"
click node_cli "https://github.com/mmaudet/ovh-cost-manager/blob/main/cli/index.js"
click node_project_cli "https://github.com/mmaudet/ovh-cost-manager/blob/main/cli/bills-by-project.js"
click node_server "https://github.com/mmaudet/ovh-cost-manager/blob/main/server/index.js"
click node_auth "https://github.com/mmaudet/ovh-cost-manager/blob/main/server/auth/routes.js"
click node_consumption "https://github.com/mmaudet/ovh-cost-manager/blob/main/server/consumption.js"
click node_database "https://github.com/mmaudet/ovh-cost-manager/blob/main/data/db.js"
click node_classification "https://github.com/mmaudet/ovh-cost-manager/blob/main/data/classify.js"
click node_cloud_usage "https://github.com/mmaudet/ovh-cost-manager/blob/main/data/cloud-usage.js"
click node_months "https://github.com/mmaudet/ovh-cost-manager/blob/main/data/months.js"
click node_sql_conditions "https://github.com/mmaudet/ovh-cost-manager/blob/main/data/sql-conditions.js"
click node_dashboard "https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/pages/Dashboard.jsx"
click node_api_client "https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/services/api.js"
click node_account_state "https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/utils/accounts.js"
click node_overview "https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/tabs/OverviewTab.jsx"
click node_comparison "https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/tabs/useCompareTab.js"
click node_comparison_rows "https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/components/UnfoldingRow.jsx"
click node_trends "https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/tabs/TrendsTab.jsx"
click node_public_cloud "https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/tabs/PublicCloudTab.jsx"
click node_web_cloud "https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/tabs/WebCloudTab.jsx"
click node_infrastructure "https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/tabs/InfrastructureTab.jsx"
click node_backup "https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/tabs/BackupTab.jsx"
click node_carbon "https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/tabs/CarbonTab.jsx"
click node_sorting "https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/components/SortableHeader.jsx"
click node_csv "https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/utils/csv.js"

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_importer toneBlue
class node_server,node_auth,node_consumption toneAmber
class node_database,node_classification,node_cloud_usage,node_months,node_sql_conditions,node_ovh toneMint
class node_dashboard,node_api_client,node_account_state,node_overview,node_comparison,node_comparison_rows,node_trends,node_public_cloud,node_web_cloud,node_infrastructure,node_backup,node_carbon,node_sorting toneRose
class node_cli,node_project_cli,node_csv,node_operator toneIndigo
```

## Components

### Import and tools

- [Data importer](https://github.com/mmaudet/ovh-cost-manager/blob/main/data/import.js): `data/import.js`

### API and authentication

- [API server](https://github.com/mmaudet/ovh-cost-manager/blob/main/server/index.js): `server/index.js`
- [OIDC authentication](https://github.com/mmaudet/ovh-cost-manager/blob/main/server/auth/routes.js): `server/auth/routes.js`
- [Consumption service](https://github.com/mmaudet/ovh-cost-manager/blob/main/server/consumption.js): `server/consumption.js`

### Billing data

- [SQLite database](https://github.com/mmaudet/ovh-cost-manager/blob/main/data/db.js): `data/db.js`
- [Cost classification](https://github.com/mmaudet/ovh-cost-manager/blob/main/data/classify.js): `data/classify.js`
- [Cloud usage](https://github.com/mmaudet/ovh-cost-manager/blob/main/data/cloud-usage.js): `data/cloud-usage.js`
- [Billing months](https://github.com/mmaudet/ovh-cost-manager/blob/main/data/months.js): `data/months.js`
- [Query conditions](https://github.com/mmaudet/ovh-cost-manager/blob/main/data/sql-conditions.js): `data/sql-conditions.js`

### Dashboard analysis

- [Dashboard shell](https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/pages/Dashboard.jsx): `dashboard/src/pages/Dashboard.jsx`
- [API client](https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/services/api.js): `dashboard/src/services/api.js`
- [Account selection](https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/utils/accounts.js): `dashboard/src/utils/accounts.js`
- [Overview analysis](https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/tabs/OverviewTab.jsx): `dashboard/src/tabs/OverviewTab.jsx`
- [Month comparison](https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/tabs/useCompareTab.js): `dashboard/src/tabs/useCompareTab.js`
- [Unfolded comparisons](https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/components/UnfoldingRow.jsx): `dashboard/src/components/UnfoldingRow.jsx`
- [Trend analysis](https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/tabs/TrendsTab.jsx): `dashboard/src/tabs/TrendsTab.jsx`
- [Public Cloud](https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/tabs/PublicCloudTab.jsx): `dashboard/src/tabs/PublicCloudTab.jsx`
- [Web Cloud](https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/tabs/WebCloudTab.jsx): `dashboard/src/tabs/WebCloudTab.jsx`
- [Infrastructure inventory](https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/tabs/InfrastructureTab.jsx): `dashboard/src/tabs/InfrastructureTab.jsx`
- [Backup analysis](https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/tabs/BackupTab.jsx): `dashboard/src/tabs/BackupTab.jsx`
- [Carbon footprint](https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/tabs/CarbonTab.jsx): `dashboard/src/tabs/CarbonTab.jsx`
- [Sortable tables](https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/components/SortableHeader.jsx): `dashboard/src/components/SortableHeader.jsx`

### Exports and CLI

- [Invoice CLI](https://github.com/mmaudet/ovh-cost-manager/blob/main/cli/index.js): `cli/index.js`
- [Project bill tools](https://github.com/mmaudet/ovh-cost-manager/blob/main/cli/bills-by-project.js): `cli/bills-by-project.js`
- [CSV and reports](https://github.com/mmaudet/ovh-cost-manager/blob/main/dashboard/src/utils/csv.js): `dashboard/src/utils/csv.js`

### Other components

- **Operator**
- **OVHcloud API**

## Connections

- Operator → Data importer: starts import (evidence: `README.md`)
- Data importer → OVHcloud API: fetches billing data (evidence: `README.md`)
- Data importer → SQLite database: stores imports (evidence: `README.md`)
- Operator → API server: opens dashboard (evidence: `README.md`)
- Dashboard shell → API client: requests data (evidence: `README.md`)
- API client → API server: calls API (evidence: `README.md`)
- API server → SQLite database: queries (evidence: `server/index.js`)
- API server → OIDC authentication: mounts authentication (evidence: `server/index.js`)
- API server → Consumption service: serves consumption (evidence: `server/index.js`)
- Project bill tools → SQLite database: reads bills (evidence: `cli/bills-by-project.js`)
- Dashboard shell → Overview analysis: shows tab (evidence: `README.md`)
- Dashboard shell → Month comparison: shows tab (evidence: `README.md`)
- Dashboard shell → Trend analysis: shows tab (evidence: `README.md`)
- Dashboard shell → Public Cloud: shows tab (evidence: `README.md`)
- Dashboard shell → Web Cloud: shows tab (evidence: `README.md`)
- Dashboard shell → Infrastructure inventory: shows tab (evidence: `README.md`)
- Dashboard shell → Backup analysis: shows tab (evidence: `README.md`)
- Dashboard shell → Carbon footprint: shows tab (evidence: `README.md`)
- Month comparison → API client: fetches comparison data (evidence: `dashboard/src/tabs/useCompareTab.js`)
- Month comparison → Unfolded comparisons: uses unfolding rows (evidence: `dashboard/src/tabs/useCompareTab.js`)
- Dashboard shell → Account selection: selects account
- Overview analysis → Sortable tables: sorts tables
- Infrastructure inventory → CSV and reports: exports CSV (evidence: `README.md`)
- Operator → Invoice CLI: runs invoice tool (evidence: `README.md`)
- Cost classification → SQLite database: classifies bill lines (evidence: `data/db.js`)
- Cloud usage → SQLite database: supplies usage kinds (evidence: `data/db.js`)
- Billing months → SQLite database: supports month queries (evidence: `data/db.js`)
- Query conditions → SQLite database: builds query conditions (evidence: `data/db.js`)
