# vivek01-ops/cloudcostlens architecture

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

- Interactive diagram: https://gitdiagram.com/vivek01-ops/cloudcostlens
- Repository: https://github.com/vivek01-ops/cloudcostlens

## Overview

CloudCostLens is an AWS cost-intelligence platform, but the README identifies this checkout as Milestone 1: discovery is implemented, while billing, metrics, analysis, and execution workers are stubs or later milestones. The main workflow shown is user-facing dashboard → API, alongside a separate worker-driven AWS discovery flow that records inventory and scan evidence. Cost, recommendation, approval, and action concepts are represented in the domain models and dashboard, but their processing is not implemented here. Relationships below are limited to README statements and source-index references; several web and domain details were not sampled.

Main entry points: [`core/services/discovery.py`](https://github.com/vivek01-ops/cloudcostlens/blob/master/core/services/discovery.py) (Scan orchestration), [`apps/api/main.py`](https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/api/main.py) (FastAPI application), [`core/models/cloud.py`](https://github.com/vivek01-ops/cloudcostlens/blob/master/core/models/cloud.py) (Cloud inventory models), [`apps/web/app/(app)/layout.tsx`](https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/web/app/(app)/layout.tsx) (Web dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Dashboard"]
  node_dashboard["Web dashboard<br/>[layout.tsx]"]
  node_overview["Overview<br/>[page.tsx]"]
  node_resources["Resource inventory<br/>[page.tsx]"]
  node_resource_detail["Resource detail<br/>[page.tsx]"]
  node_cost_explorer["Cost explorer<br/>[page.tsx]"]
  node_recommendations_ui["Recommendations<br/>[page.tsx]"]
  node_approvals_ui["Approvals<br/>[page.tsx]"]
  node_activity_ui["Activity<br/>[page.tsx]"]
  node_settings_ui["Settings<br/>[page.tsx]"]
end

subgraph group_api["API"]
  node_api["FastAPI application<br/>[main.py]"]
  node_meta["Metadata endpoint<br/>[meta.py]"]
  node_health["Health endpoint<br/>[health.py]"]
end

subgraph group_discovery["Discovery"]
  node_worker_cli["Worker dispatcher<br/>[cli.py]"]
  node_discovery_worker["Discovery worker<br/>[discovery.py]"]
  node_discovery_service["Scan orchestration<br/>[discovery.py]"]
  node_aws_clients["AWS client factory<br/>[session.py]"]
  node_ec2_adapter["EC2 discovery adapter<br/>[ec2.py]"]
  node_ingestion["Inventory ingestion<br/>[ingestion.py]"]
  node_future_workers["Later-stage workers<br/>[cli.py]"]
end

subgraph group_domain["Domain state"]
  node_inventory[("Cloud inventory models<br/>[cloud.py]")]
  node_optimization[("Optimization models<br/>[optimization.py]")]
  node_workflow[("Approval and action models<br/>[workflow.py]")]
  node_audit[("Audit events<br/>[audit.py]")]
end

node_user(("Cloud operator"))
node_aws{{"AWS"}}

node_user -->|"uses"| node_dashboard
node_dashboard -->|"HTTP requests"| node_api
node_api -->|"registers"| node_meta
node_api -->|"registers"| node_health
node_worker_cli -->|"dispatches"| node_discovery_worker
node_discovery_worker -->|"runs scans"| node_discovery_service
node_discovery_service -->|"builds clients"| node_aws_clients
node_discovery_service -->|"discovers resources"| node_ec2_adapter
node_aws_clients -.->|"connects to"| node_aws
node_ec2_adapter -.->|"reads inventory"| node_aws
node_discovery_service -->|"ingests results"| node_ingestion
node_ingestion -->|"upserts resources"| node_inventory
node_discovery_service -->|"records scans"| node_inventory
node_discovery_service -->|"records events"| node_audit
node_future_workers -.->|"dispatched by"| node_worker_cli
node_cost_explorer -.->|"displays cost data"| node_inventory
node_recommendations_ui -.->|"presents findings"| node_optimization
node_approvals_ui -.->|"presents approvals"| node_workflow
node_activity_ui -.->|"presents activity"| node_audit

click node_dashboard "https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/web/app/(app)/layout.tsx"
click node_overview "https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/web/app/(app)/overview/page.tsx"
click node_resources "https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/web/app/(app)/resources/page.tsx"
click node_resource_detail "https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/web/app/(app)/resources/%5Bid%5D/page.tsx"
click node_cost_explorer "https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/web/app/(app)/cost-explorer/page.tsx"
click node_recommendations_ui "https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/web/app/(app)/recommendations/page.tsx"
click node_approvals_ui "https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/web/app/(app)/approvals/page.tsx"
click node_activity_ui "https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/web/app/(app)/activity/page.tsx"
click node_settings_ui "https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/web/app/(app)/settings/page.tsx"
click node_api "https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/api/main.py"
click node_meta "https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/api/routers/meta.py"
click node_health "https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/api/routers/health.py"
click node_worker_cli "https://github.com/vivek01-ops/cloudcostlens/blob/master/workers/cli.py"
click node_discovery_worker "https://github.com/vivek01-ops/cloudcostlens/blob/master/workers/discovery.py"
click node_discovery_service "https://github.com/vivek01-ops/cloudcostlens/blob/master/core/services/discovery.py"
click node_aws_clients "https://github.com/vivek01-ops/cloudcostlens/blob/master/core/aws/session.py"
click node_ec2_adapter "https://github.com/vivek01-ops/cloudcostlens/blob/master/core/aws/ec2.py"
click node_ingestion "https://github.com/vivek01-ops/cloudcostlens/blob/master/core/services/ingestion.py"
click node_inventory "https://github.com/vivek01-ops/cloudcostlens/blob/master/core/models/cloud.py"
click node_optimization "https://github.com/vivek01-ops/cloudcostlens/blob/master/core/models/optimization.py"
click node_workflow "https://github.com/vivek01-ops/cloudcostlens/blob/master/core/models/workflow.py"
click node_audit "https://github.com/vivek01-ops/cloudcostlens/blob/master/core/audit.py"
click node_future_workers "https://github.com/vivek01-ops/cloudcostlens/blob/master/workers/cli.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_dashboard,node_overview,node_resources,node_resource_detail,node_cost_explorer,node_recommendations_ui,node_approvals_ui,node_activity_ui,node_settings_ui toneBlue
class node_api,node_meta,node_health toneAmber
class node_worker_cli,node_discovery_worker,node_discovery_service,node_aws_clients,node_ec2_adapter,node_ingestion,node_future_workers toneMint
class node_inventory,node_optimization,node_workflow,node_audit toneRose
class node_user,node_aws toneIndigo
```

## Components

### Dashboard

- [Web dashboard](https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/web/app/(app)/layout.tsx): `apps/web/app/(app)/layout.tsx`
- [Overview](https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/web/app/(app)/overview/page.tsx): `apps/web/app/(app)/overview/page.tsx`
- [Resource inventory](https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/web/app/(app)/resources/page.tsx): `apps/web/app/(app)/resources/page.tsx`
- [Resource detail](https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/web/app/(app)/resources/%5Bid%5D/page.tsx): `apps/web/app/(app)/resources/[id]/page.tsx`
- [Cost explorer](https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/web/app/(app)/cost-explorer/page.tsx): `apps/web/app/(app)/cost-explorer/page.tsx`
- [Recommendations](https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/web/app/(app)/recommendations/page.tsx): `apps/web/app/(app)/recommendations/page.tsx`
- [Approvals](https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/web/app/(app)/approvals/page.tsx): `apps/web/app/(app)/approvals/page.tsx`
- [Activity](https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/web/app/(app)/activity/page.tsx): `apps/web/app/(app)/activity/page.tsx`
- [Settings](https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/web/app/(app)/settings/page.tsx): `apps/web/app/(app)/settings/page.tsx`

### API

- [FastAPI application](https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/api/main.py): `apps/api/main.py`
- [Metadata endpoint](https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/api/routers/meta.py): `apps/api/routers/meta.py`
- [Health endpoint](https://github.com/vivek01-ops/cloudcostlens/blob/master/apps/api/routers/health.py): `apps/api/routers/health.py`

### Discovery

- [Worker dispatcher](https://github.com/vivek01-ops/cloudcostlens/blob/master/workers/cli.py): `workers/cli.py`
- [Discovery worker](https://github.com/vivek01-ops/cloudcostlens/blob/master/workers/discovery.py): `workers/discovery.py`
- [Scan orchestration](https://github.com/vivek01-ops/cloudcostlens/blob/master/core/services/discovery.py): `core/services/discovery.py`
- [AWS client factory](https://github.com/vivek01-ops/cloudcostlens/blob/master/core/aws/session.py): `core/aws/session.py`
- [EC2 discovery adapter](https://github.com/vivek01-ops/cloudcostlens/blob/master/core/aws/ec2.py): `core/aws/ec2.py`
- [Inventory ingestion](https://github.com/vivek01-ops/cloudcostlens/blob/master/core/services/ingestion.py): `core/services/ingestion.py`
- [Later-stage workers](https://github.com/vivek01-ops/cloudcostlens/blob/master/workers/cli.py): `workers/cli.py`

### Domain state

- [Cloud inventory models](https://github.com/vivek01-ops/cloudcostlens/blob/master/core/models/cloud.py): `core/models/cloud.py`
- [Optimization models](https://github.com/vivek01-ops/cloudcostlens/blob/master/core/models/optimization.py): `core/models/optimization.py`
- [Approval and action models](https://github.com/vivek01-ops/cloudcostlens/blob/master/core/models/workflow.py): `core/models/workflow.py`
- [Audit events](https://github.com/vivek01-ops/cloudcostlens/blob/master/core/audit.py): `core/audit.py`

### Other components

- **Cloud operator**
- **AWS**

## Connections

- Cloud operator → Web dashboard: uses (evidence: `README.md`)
- Web dashboard → FastAPI application: HTTP requests (evidence: `README.md`)
- FastAPI application → Metadata endpoint: registers (evidence: `apps/api/main.py`)
- FastAPI application → Health endpoint: registers (evidence: `apps/api/main.py`)
- Worker dispatcher → Discovery worker: dispatches (evidence: `workers/cli.py`)
- Discovery worker → Scan orchestration: runs scans (evidence: `workers/discovery.py`)
- Scan orchestration → AWS client factory: builds clients (evidence: `core/services/discovery.py`)
- Scan orchestration → EC2 discovery adapter: discovers resources (evidence: `core/services/discovery.py`)
- AWS client factory → AWS: connects to (evidence: `README.md`)
- EC2 discovery adapter → AWS: reads inventory (evidence: `README.md`)
- Scan orchestration → Inventory ingestion: ingests results (evidence: `core/services/discovery.py`)
- Inventory ingestion → Cloud inventory models: upserts resources (evidence: `core/services/ingestion.py`)
- Scan orchestration → Cloud inventory models: records scans (evidence: `core/services/discovery.py`)
- Scan orchestration → Audit events: records events (evidence: `core/services/discovery.py`)
- Later-stage workers → Worker dispatcher: dispatched by (evidence: `workers/cli.py`)
- Cost explorer → Cloud inventory models: displays cost data (evidence: `README.md`)
- Recommendations → Optimization models: presents findings (evidence: `README.md`)
- Approvals → Approval and action models: presents approvals (evidence: `README.md`)
- Activity → Audit events: presents activity (evidence: `README.md`)
