# tarunvamsivaka/anuvaad architecture

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

- Interactive diagram: https://gitdiagram.com/tarunvamsivaka/anuvaad
- Repository: https://github.com/tarunvamsivaka/anuvaad

## Overview

Anuvaad is an AI code-translation product: users submit code or a natural-language request through the translator, the API applies authentication and quota controls, and AI services return translated or explained code, including streamed output. The product also supports history, billing and credits, collaborative workspaces, GitHub imports, and semantic repository search. The README documents these capabilities; source excerpts show selected backend calls. Some frontend-to-API and unsampled route internals are documented but not directly shown, so those links use README evidence.

Main entry points: [`app/main.py`](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/main.py) (FastAPI Application), [`app/services/ai.py`](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/services/ai.py) (AI Translation), [`app/routers/translate`](https://github.com/tarunvamsivaka/anuvaad/tree/master/app/routers/translate) (Translation Routes), [`app/routers/billing.py`](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/routers/billing.py) (Billing Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User Clients"]
  node_translator["Translator Workspace"]
  node_cli["Developer CLI<br/>[index.ts]"]
end

subgraph group_api["API and Access"]
  node_api_app["FastAPI Application<br/>[main.py]"]
  node_translation_routes["Translation Routes"]
  node_auth["Authentication<br/>[auth.py]"]
  node_quota["Quota Controls<br/>[quota.py]"]
  node_cache["Cache and Rate Limits<br/>[cache.py]"]
end

subgraph group_translation["Translation Services"]
  node_ai["AI Translation<br/>[ai.py]"]
  node_language_parser["Code Parser<br/>[ast_parser.py]"]
end

subgraph group_account["Accounts and Billing"]
  node_translation_history["Translation History<br/>[translation.py]"]
  node_background_tasks["Background Tasks<br/>[tasks.py]"]
  node_billing_routes["Billing Routes<br/>[billing.py]"]
  node_billing_service["Billing Service<br/>[service.py]"]
  node_subscriptions["Subscriptions<br/>[subscription.py]"]
  node_workspace_routes["Workspace Routes<br/>[workspace.py]"]
  node_database[("PostgreSQL and pgvector")]
end

subgraph group_repository["Repository Search"]
  node_github_routes["GitHub Import<br/>[github.py]"]
  node_search_routes["Repository Search<br/>[repo_search.py]"]
  node_indexing["Repository Indexing<br/>[pipeline.py]"]
  node_embeddings["Embedding Service<br/>[embedding.py]"]
  node_vectors["Vector Repository<br/>[vectors.py]"]
end

node_developer(("Developer"))
node_llm_provider["LLM Providers"]
node_github["GitHub"]
node_payment_provider["Razorpay"]

node_developer -->|"uses"| node_translator
node_developer -->|"uses"| node_cli
node_translator -->|"submits translations"| node_api_app
node_cli -.->|"calls API"| node_api_app
node_api_app -->|"mounts"| node_translation_routes
node_api_app -->|"mounts"| node_billing_routes
node_api_app -->|"mounts"| node_workspace_routes
node_api_app -->|"mounts"| node_github_routes
node_api_app -->|"mounts"| node_search_routes
node_translation_routes -->|"authenticates"| node_auth
node_translation_routes -->|"checks quota"| node_quota
node_translation_routes -->|"requests translation"| node_ai
node_ai -->|"generates output"| node_llm_provider
node_ai -->|"parses code"| node_language_parser
node_ai -->|"reads and writes"| node_cache
node_ai -->|"loads history"| node_translation_history
node_ai -->|"queues history save"| node_background_tasks
node_quota -->|"reads and updates"| node_cache
node_quota -->|"counts translations"| node_translation_history
node_billing_routes -->|"delegates billing"| node_billing_service
node_billing_routes -->|"queues billing work"| node_background_tasks
node_billing_service -->|"updates subscriptions"| node_subscriptions
node_background_tasks -->|"updates subscriptions"| node_subscriptions
node_billing_routes -->|"handles payments"| node_payment_provider
node_workspace_routes -.->|"stores workspace data"| node_database
node_github_routes -->|"imports Gists"| node_github
node_search_routes -->|"creates query vectors"| node_embeddings
node_search_routes -->|"searches vectors"| node_vectors
node_indexing -->|"generates vectors"| node_embeddings
node_indexing -.->|"persists index"| node_database
node_vectors -->|"reads and writes"| node_database

click node_translator "https://github.com/tarunvamsivaka/anuvaad/blob/master/frontend/src/features/translate/TranslateFeature.tsx"
click node_cli "https://github.com/tarunvamsivaka/anuvaad/blob/master/cli/src/index.ts"
click node_api_app "https://github.com/tarunvamsivaka/anuvaad/blob/master/app/main.py"
click node_translation_routes "https://github.com/tarunvamsivaka/anuvaad/tree/master/app/routers/translate"
click node_auth "https://github.com/tarunvamsivaka/anuvaad/blob/master/app/core/auth.py"
click node_quota "https://github.com/tarunvamsivaka/anuvaad/blob/master/app/core/quota.py"
click node_ai "https://github.com/tarunvamsivaka/anuvaad/blob/master/app/services/ai.py"
click node_language_parser "https://github.com/tarunvamsivaka/anuvaad/blob/master/app/services/ast_parser.py"
click node_translation_history "https://github.com/tarunvamsivaka/anuvaad/blob/master/app/repositories/translation.py"
click node_background_tasks "https://github.com/tarunvamsivaka/anuvaad/blob/master/app/queue/tasks.py"
click node_billing_routes "https://github.com/tarunvamsivaka/anuvaad/blob/master/app/routers/billing.py"
click node_billing_service "https://github.com/tarunvamsivaka/anuvaad/blob/master/app/domain/billing/service.py"
click node_subscriptions "https://github.com/tarunvamsivaka/anuvaad/blob/master/app/repositories/subscription.py"
click node_workspace_routes "https://github.com/tarunvamsivaka/anuvaad/blob/master/app/routers/workspace.py"
click node_database "https://github.com/tarunvamsivaka/anuvaad/blob/master/app/core/database_session.py"
click node_cache "https://github.com/tarunvamsivaka/anuvaad/blob/master/app/core/cache.py"
click node_github_routes "https://github.com/tarunvamsivaka/anuvaad/blob/master/app/routers/github.py"
click node_search_routes "https://github.com/tarunvamsivaka/anuvaad/blob/master/app/routers/repo_search.py"
click node_indexing "https://github.com/tarunvamsivaka/anuvaad/blob/master/app/services/indexing/pipeline.py"
click node_embeddings "https://github.com/tarunvamsivaka/anuvaad/blob/master/app/services/embedding.py"
click node_vectors "https://github.com/tarunvamsivaka/anuvaad/blob/master/app/repositories/vectors.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_translator,node_cli toneBlue
class node_api_app,node_translation_routes,node_auth,node_quota,node_cache toneAmber
class node_ai,node_language_parser toneMint
class node_translation_history,node_background_tasks,node_billing_routes,node_billing_service,node_subscriptions,node_workspace_routes,node_database toneRose
class node_github_routes,node_search_routes,node_indexing,node_embeddings,node_vectors,node_developer,node_llm_provider,node_github,node_payment_provider toneIndigo
```

## Components

### User Clients

- [Translator Workspace](https://github.com/tarunvamsivaka/anuvaad/blob/master/frontend/src/features/translate/TranslateFeature.tsx): `frontend/src/features/translate/TranslateFeature.tsx`
- [Developer CLI](https://github.com/tarunvamsivaka/anuvaad/blob/master/cli/src/index.ts): `cli/src/index.ts`

### API and Access

- [FastAPI Application](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/main.py): `app/main.py`
- [Translation Routes](https://github.com/tarunvamsivaka/anuvaad/tree/master/app/routers/translate): `app/routers/translate`
- [Authentication](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/core/auth.py): `app/core/auth.py`
- [Quota Controls](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/core/quota.py): `app/core/quota.py`
- [Cache and Rate Limits](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/core/cache.py): `app/core/cache.py`

### Translation Services

- [AI Translation](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/services/ai.py): `app/services/ai.py`
- [Code Parser](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/services/ast_parser.py): `app/services/ast_parser.py`

### Accounts and Billing

- [Translation History](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/repositories/translation.py): `app/repositories/translation.py`
- [Background Tasks](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/queue/tasks.py): `app/queue/tasks.py`
- [Billing Routes](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/routers/billing.py): `app/routers/billing.py`
- [Billing Service](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/domain/billing/service.py): `app/domain/billing/service.py`
- [Subscriptions](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/repositories/subscription.py): `app/repositories/subscription.py`
- [Workspace Routes](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/routers/workspace.py): `app/routers/workspace.py`
- [PostgreSQL and pgvector](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/core/database_session.py): `app/core/database_session.py`

### Repository Search

- [GitHub Import](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/routers/github.py): `app/routers/github.py`
- [Repository Search](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/routers/repo_search.py): `app/routers/repo_search.py`
- [Repository Indexing](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/services/indexing/pipeline.py): `app/services/indexing/pipeline.py`
- [Embedding Service](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/services/embedding.py): `app/services/embedding.py`
- [Vector Repository](https://github.com/tarunvamsivaka/anuvaad/blob/master/app/repositories/vectors.py): `app/repositories/vectors.py`

### Other components

- **Developer**
- **LLM Providers**
- **GitHub**
- **Razorpay**

## Connections

- Developer → Translator Workspace: uses
- Developer → Developer CLI: uses
- Translator Workspace → FastAPI Application: submits translations
- Developer CLI → FastAPI Application: calls API
- FastAPI Application → Translation Routes: mounts (evidence: `app/main.py`)
- FastAPI Application → Billing Routes: mounts (evidence: `app/main.py`)
- FastAPI Application → Workspace Routes: mounts (evidence: `app/main.py`)
- FastAPI Application → GitHub Import: mounts (evidence: `app/main.py`)
- FastAPI Application → Repository Search: mounts (evidence: `app/main.py`)
- Translation Routes → Authentication: authenticates (evidence: `app/main.py`)
- Translation Routes → Quota Controls: checks quota (evidence: `app/core/quota.py`)
- Translation Routes → AI Translation: requests translation
- AI Translation → LLM Providers: generates output
- AI Translation → Code Parser: parses code (evidence: `app/services/ai.py`)
- AI Translation → Cache and Rate Limits: reads and writes (evidence: `app/services/ai.py`)
- AI Translation → Translation History: loads history (evidence: `app/services/ai.py`)
- AI Translation → Background Tasks: queues history save (evidence: `app/services/ai.py`)
- Quota Controls → Cache and Rate Limits: reads and updates (evidence: `app/core/quota.py`)
- Quota Controls → Translation History: counts translations (evidence: `app/core/quota.py`)
- Billing Routes → Billing Service: delegates billing (evidence: `app/routers/billing.py`)
- Billing Routes → Background Tasks: queues billing work (evidence: `app/routers/billing.py`)
- Billing Service → Subscriptions: updates subscriptions (evidence: `app/domain/billing/service.py`)
- Background Tasks → Subscriptions: updates subscriptions (evidence: `app/queue/tasks.py`)
- Billing Routes → Razorpay: handles payments
- Workspace Routes → PostgreSQL and pgvector: stores workspace data
- GitHub Import → GitHub: imports Gists
- Repository Search → Embedding Service: creates query vectors (evidence: `app/routers/repo_search.py`)
- Repository Search → Vector Repository: searches vectors (evidence: `app/routers/repo_search.py`)
- Repository Indexing → Embedding Service: generates vectors (evidence: `app/services/indexing/pipeline.py`)
- Repository Indexing → PostgreSQL and pgvector: persists index
- Vector Repository → PostgreSQL and pgvector: reads and writes (evidence: `app/repositories/vectors.py`)
