# atharvapawaskar/kubefin-ai architecture

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

- Interactive diagram: https://gitdiagram.com/atharvapawaskar/kubefin-ai
- Repository: https://github.com/atharvapawaskar/kubefin-ai

## Overview

Kubefin is currently a Phase 0 scaffold for a Kubernetes-native AI FinOps and LLM governance platform. Its documented workflow proxies application requests through a gateway to AI providers, then asynchronously processes usage events into costs and aggregates for storage and visibility. The gateway is documented as owning authentication, policy, limits, budgets, routing, and event generation. The tree contains placeholders rather than sampled runtime implementations, so this map reflects README-described responsibilities and flows, not verified code behavior.

Main entry points: [`services/worker`](https://github.com/atharvapawaskar/kubefin-ai/tree/main/services/worker) (Worker), [`services/gateway`](https://github.com/atharvapawaskar/kubefin-ai/tree/main/services/gateway) (Gateway controls), [`contracts/redis`](https://github.com/atharvapawaskar/kubefin-ai/tree/main/contracts/redis) (Redis Streams), [`frontend`](https://github.com/atharvapawaskar/kubefin-ai/tree/main/frontend) (Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gateway["Request governance"]
  node_gateway["Gateway controls"]
end

subgraph group_analytics["Usage processing"]
  node_worker["Worker"]
  node_cost["Cost calculation"]
  node_aggregation["Usage aggregation"]
end

subgraph group_interfaces["Product interfaces"]
  node_events["Redis Streams"]
  node_dashboard["Dashboard"]
end

node_application(("Application"))
node_provider["AI provider"]
node_database[("MongoDB")]

node_application -->|"sends requests"| node_gateway
node_gateway -->|"routes requests"| node_provider
node_gateway -->|"emits usage"| node_events
node_events -->|"feeds events"| node_worker
node_worker -->|"calculates costs"| node_cost
node_worker -->|"aggregates usage"| node_aggregation
node_worker -->|"stores results"| node_database
node_database -->|"provides data"| node_dashboard

click node_gateway "https://github.com/atharvapawaskar/kubefin-ai/tree/main/services/gateway"
click node_events "https://github.com/atharvapawaskar/kubefin-ai/tree/main/contracts/redis"
click node_worker "https://github.com/atharvapawaskar/kubefin-ai/tree/main/services/worker"
click node_cost "https://github.com/atharvapawaskar/kubefin-ai/tree/main/services/worker"
click node_aggregation "https://github.com/atharvapawaskar/kubefin-ai/tree/main/services/worker"
click node_dashboard "https://github.com/atharvapawaskar/kubefin-ai/tree/main/frontend"

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_gateway toneBlue
class node_worker,node_cost,node_aggregation,node_database toneAmber
class node_events,node_dashboard toneMint
class node_application,node_provider toneIndigo
```

## Components

### Request governance

- [Gateway controls](https://github.com/atharvapawaskar/kubefin-ai/tree/main/services/gateway): `services/gateway`

### Usage processing

- [Worker](https://github.com/atharvapawaskar/kubefin-ai/tree/main/services/worker): `services/worker`
- [Cost calculation](https://github.com/atharvapawaskar/kubefin-ai/tree/main/services/worker): `services/worker`
- [Usage aggregation](https://github.com/atharvapawaskar/kubefin-ai/tree/main/services/worker): `services/worker`

### Product interfaces

- [Redis Streams](https://github.com/atharvapawaskar/kubefin-ai/tree/main/contracts/redis): `contracts/redis`
- [Dashboard](https://github.com/atharvapawaskar/kubefin-ai/tree/main/frontend): `frontend`

### Other components

- **Application**
- **AI provider**
- **MongoDB**

## Connections

- Application → Gateway controls: sends requests (evidence: `README.md`)
- Gateway controls → AI provider: routes requests (evidence: `README.md`)
- Gateway controls → Redis Streams: emits usage (evidence: `README.md`)
- Redis Streams → Worker: feeds events (evidence: `README.md`)
- Worker → Cost calculation: calculates costs (evidence: `README.md`)
- Worker → Usage aggregation: aggregates usage (evidence: `README.md`)
- Worker → MongoDB: stores results (evidence: `README.md`)
- MongoDB → Dashboard: provides data (evidence: `README.md`)
