# rohithbhagath/lextech-ai architecture

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

- Interactive diagram: https://gitdiagram.com/rohithbhagath/lextech-ai
- Repository: https://github.com/rohithbhagath/lextech-ai

## Overview

LexTech is a legal Agentic RAG assistant. A user submits a question through the React chat; the API runs a LangGraph workflow that selects retrieval strategies, gathers and reranks evidence, synthesizes an answer, and records query, source, and trace data. Separate dashboard flows manage document ingestion and RAGAS evaluation. The README documents broader legal-intelligence capabilities and external services; where sampled source does not establish their wiring, those links are marked unverified rather than asserted.

Main entry points: [`frontend/src/App.jsx`](https://github.com/rohithbhagath/lextech-ai/blob/main/frontend/src/App.jsx) (Dashboard shell), [`frontend/src/services/api.js`](https://github.com/rohithbhagath/lextech-ai/blob/main/frontend/src/services/api.js) (HTTP client), [`backend/app/main.py`](https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/api/v1/query.py`](https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/api/v1/query.py) (Query endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web experience"]
  node_app["Dashboard shell<br/>[App.jsx]"]
  node_chat["Chat interface<br/>[ChatInterface.jsx]"]
  node_documents_ui["Document manager"]
  node_evaluation_ui["Evaluation dashboard"]
  node_trace_ui["Trace panel<br/>[TracePanel.jsx]"]
  node_api_client["HTTP client<br/>[api.js]"]
end

subgraph group_api["API and workflow"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_query_api["Query endpoint<br/>[query.py]"]
  node_ingest_api["Document endpoint<br/>[documents.py]"]
  node_evaluation_api["Evaluation endpoint<br/>[evaluation.py]"]
  node_graph["Agent state machine<br/>[graph.py]"]
  node_agent_nodes["Agent nodes<br/>[nodes.py]"]
  node_claude["Claude integration<br/>[claude_client.py]"]
end

subgraph group_knowledge["Knowledge and retrieval"]
  node_retrieval["Retrieval orchestrator<br/>[orchestrator.py]"]
  node_retrieval_strategies["Retrieval strategies"]
  node_ingest_pipeline["Ingestion pipeline<br/>[pipeline.py]"]
  node_ingest_modules["Loaders, chunkers, embeddings"]
end

subgraph group_intelligence["Legal intelligence"]
  node_legal_features["Legal intelligence"]
  node_tech_features["Technology analysis"]
end

subgraph group_state["Persistence and evaluation"]
  node_postgres[("PostgreSQL models")]
  node_db_session["Database sessions<br/>[session.py]"]
  node_vector_store[("Vector stores<br/>[vector_stores.py]")]
  node_evaluator["RAGAS evaluator<br/>[ragas_evaluator.py]"]
  node_reports["Evaluation reports<br/>[reports.py]"]
  node_observability["Tracing<br/>[tracing.py]"]
end

node_person(("Legal user"))
node_anthropic(("Anthropic API"))
node_openai(("OpenAI embeddings API"))
node_chroma[("ChromaDB")]
node_elasticsearch[("Elasticsearch")]

node_person -->|"uses"| node_app
node_app -->|"renders"| node_chat
node_app -->|"renders"| node_documents_ui
node_app -->|"renders"| node_evaluation_ui
node_app -->|"renders"| node_trace_ui
node_chat -->|"calls"| node_api_client
node_documents_ui -->|"calls"| node_api_client
node_evaluation_ui -->|"calls"| node_api_client
node_trace_ui -->|"calls"| node_api_client
node_api_client -->|"sends HTTP"| node_api_app
node_api_app -->|"registers route"| node_query_api
node_api_app -->|"registers route"| node_ingest_api
node_api_app -->|"registers route"| node_evaluation_api
node_query_api -->|"invokes"| node_graph
node_graph -.->|"dispatches"| node_agent_nodes
node_agent_nodes -->|"calls"| node_retrieval
node_retrieval -->|"runs searches"| node_retrieval_strategies
node_agent_nodes -.->|"synthesizes with"| node_claude
node_claude -.->|"requests generation"| node_anthropic
node_ingest_api -->|"starts ingestion"| node_ingest_pipeline
node_ingest_pipeline -->|"uses"| node_ingest_modules
node_ingest_pipeline -->|"writes records"| node_db_session
node_ingest_pipeline -->|"indexes vectors"| node_vector_store
node_vector_store -.->|"stores vectors"| node_chroma
node_retrieval_strategies -.->|"searches vectors"| node_chroma
node_retrieval_strategies -.->|"searches text"| node_elasticsearch
node_query_api -->|"uses session"| node_db_session
node_query_api -->|"writes query, answer, traces"| node_postgres
node_evaluation_api -->|"runs evaluation"| node_evaluator
node_evaluation_api -->|"serves reports"| node_reports
node_legal_features -.->|"supports legal search"| node_retrieval
node_tech_features -.->|"supports technology analysis"| node_retrieval
node_agent_nodes -.->|"records traces"| node_observability

click node_app "https://github.com/rohithbhagath/lextech-ai/blob/main/frontend/src/App.jsx"
click node_chat "https://github.com/rohithbhagath/lextech-ai/blob/main/frontend/src/components/ChatInterface.jsx"
click node_documents_ui "https://github.com/rohithbhagath/lextech-ai/blob/main/frontend/src/components/DocumentManager.jsx"
click node_evaluation_ui "https://github.com/rohithbhagath/lextech-ai/blob/main/frontend/src/components/EvaluationDashboard.jsx"
click node_trace_ui "https://github.com/rohithbhagath/lextech-ai/blob/main/frontend/src/components/TracePanel.jsx"
click node_api_client "https://github.com/rohithbhagath/lextech-ai/blob/main/frontend/src/services/api.js"
click node_api_app "https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/main.py"
click node_query_api "https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/api/v1/query.py"
click node_ingest_api "https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/api/v1/documents.py"
click node_evaluation_api "https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/api/v1/evaluation.py"
click node_graph "https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/graph/graph.py"
click node_agent_nodes "https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/graph/nodes.py"
click node_retrieval "https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/retrieval/orchestrator.py"
click node_retrieval_strategies "https://github.com/rohithbhagath/lextech-ai/tree/main/backend/app/retrieval"
click node_ingest_pipeline "https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/ingestion/pipeline.py"
click node_ingest_modules "https://github.com/rohithbhagath/lextech-ai/tree/main/backend/app/ingestion"
click node_legal_features "https://github.com/rohithbhagath/lextech-ai/tree/main/backend/app/intelligence"
click node_tech_features "https://github.com/rohithbhagath/lextech-ai/tree/main/backend/app/tech_intelligence"
click node_claude "https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/llm/claude_client.py"
click node_postgres "https://github.com/rohithbhagath/lextech-ai/tree/main/backend/db/models"
click node_db_session "https://github.com/rohithbhagath/lextech-ai/blob/main/backend/db/session.py"
click node_vector_store "https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/ingestion/embeddings/vector_stores.py"
click node_evaluator "https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/evaluation/ragas_evaluator.py"
click node_reports "https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/evaluation/reports.py"
click node_observability "https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/observability/tracing.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_chat,node_documents_ui,node_evaluation_ui,node_trace_ui,node_api_client,node_person toneBlue
class node_api_app,node_query_api,node_ingest_api,node_evaluation_api,node_graph,node_agent_nodes,node_claude,node_chroma,node_elasticsearch toneAmber
class node_retrieval,node_retrieval_strategies,node_ingest_pipeline,node_ingest_modules,node_anthropic,node_openai toneMint
class node_legal_features,node_tech_features toneRose
class node_postgres,node_db_session,node_vector_store,node_evaluator,node_reports,node_observability toneIndigo
```

## Components

### Web experience

- [Dashboard shell](https://github.com/rohithbhagath/lextech-ai/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Chat interface](https://github.com/rohithbhagath/lextech-ai/blob/main/frontend/src/components/ChatInterface.jsx): `frontend/src/components/ChatInterface.jsx`
- [Document manager](https://github.com/rohithbhagath/lextech-ai/blob/main/frontend/src/components/DocumentManager.jsx): `frontend/src/components/DocumentManager.jsx`
- [Evaluation dashboard](https://github.com/rohithbhagath/lextech-ai/blob/main/frontend/src/components/EvaluationDashboard.jsx): `frontend/src/components/EvaluationDashboard.jsx`
- [Trace panel](https://github.com/rohithbhagath/lextech-ai/blob/main/frontend/src/components/TracePanel.jsx): `frontend/src/components/TracePanel.jsx`
- [HTTP client](https://github.com/rohithbhagath/lextech-ai/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### API and workflow

- [FastAPI application](https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/main.py): `backend/app/main.py`
- [Query endpoint](https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/api/v1/query.py): `backend/app/api/v1/query.py`
- [Document endpoint](https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/api/v1/documents.py): `backend/app/api/v1/documents.py`
- [Evaluation endpoint](https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/api/v1/evaluation.py): `backend/app/api/v1/evaluation.py`
- [Agent state machine](https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/graph/graph.py): `backend/app/graph/graph.py`
- [Agent nodes](https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/graph/nodes.py): `backend/app/graph/nodes.py`
- [Claude integration](https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/llm/claude_client.py): `backend/app/llm/claude_client.py`

### Knowledge and retrieval

- [Retrieval orchestrator](https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/retrieval/orchestrator.py): `backend/app/retrieval/orchestrator.py`
- [Retrieval strategies](https://github.com/rohithbhagath/lextech-ai/tree/main/backend/app/retrieval): `backend/app/retrieval`
- [Ingestion pipeline](https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/ingestion/pipeline.py): `backend/app/ingestion/pipeline.py`
- [Loaders, chunkers, embeddings](https://github.com/rohithbhagath/lextech-ai/tree/main/backend/app/ingestion): `backend/app/ingestion`

### Legal intelligence

- [Legal intelligence](https://github.com/rohithbhagath/lextech-ai/tree/main/backend/app/intelligence): `backend/app/intelligence`
- [Technology analysis](https://github.com/rohithbhagath/lextech-ai/tree/main/backend/app/tech_intelligence): `backend/app/tech_intelligence`

### Persistence and evaluation

- [PostgreSQL models](https://github.com/rohithbhagath/lextech-ai/tree/main/backend/db/models): `backend/db/models`
- [Database sessions](https://github.com/rohithbhagath/lextech-ai/blob/main/backend/db/session.py): `backend/db/session.py`
- [Vector stores](https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/ingestion/embeddings/vector_stores.py): `backend/app/ingestion/embeddings/vector_stores.py`
- [RAGAS evaluator](https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/evaluation/ragas_evaluator.py): `backend/app/evaluation/ragas_evaluator.py`
- [Evaluation reports](https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/evaluation/reports.py): `backend/app/evaluation/reports.py`
- [Tracing](https://github.com/rohithbhagath/lextech-ai/blob/main/backend/app/observability/tracing.py): `backend/app/observability/tracing.py`

### Other components

- **Legal user**
- **Anthropic API**
- **OpenAI embeddings API**
- **ChromaDB**
- **Elasticsearch**

## Connections

- Legal user → Dashboard shell: uses
- Dashboard shell → Chat interface: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Document manager: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Evaluation dashboard: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Trace panel: renders (evidence: `frontend/src/App.jsx`)
- Chat interface → HTTP client: calls (evidence: `frontend/src/components/ChatInterface.jsx`)
- Document manager → HTTP client: calls (evidence: `frontend/src/components/DocumentManager.jsx`)
- Evaluation dashboard → HTTP client: calls (evidence: `frontend/src/components/EvaluationDashboard.jsx`)
- Trace panel → HTTP client: calls (evidence: `frontend/src/components/TracePanel.jsx`)
- HTTP client → FastAPI application: sends HTTP
- FastAPI application → Query endpoint: registers route (evidence: `backend/app/main.py`)
- FastAPI application → Document endpoint: registers route (evidence: `backend/app/main.py`)
- FastAPI application → Evaluation endpoint: registers route (evidence: `backend/app/main.py`)
- Query endpoint → Agent state machine: invokes (evidence: `backend/app/api/v1/query.py`)
- Agent state machine → Agent nodes: dispatches
- Agent nodes → Retrieval orchestrator: calls (evidence: `backend/app/graph/nodes.py`)
- Retrieval orchestrator → Retrieval strategies: runs searches (evidence: `backend/app/retrieval/orchestrator.py`)
- Agent nodes → Claude integration: synthesizes with
- Claude integration → Anthropic API: requests generation
- Document endpoint → Ingestion pipeline: starts ingestion (evidence: `backend/app/api/v1/documents.py`)
- Ingestion pipeline → Loaders, chunkers, embeddings: uses (evidence: `backend/app/ingestion/pipeline.py`)
- Ingestion pipeline → Database sessions: writes records (evidence: `backend/app/ingestion/pipeline.py`)
- Ingestion pipeline → Vector stores: indexes vectors (evidence: `backend/app/ingestion/pipeline.py`)
- Vector stores → ChromaDB: stores vectors
- Retrieval strategies → ChromaDB: searches vectors
- Retrieval strategies → Elasticsearch: searches text
- Query endpoint → Database sessions: uses session (evidence: `backend/app/api/v1/query.py`)
- Query endpoint → PostgreSQL models: writes query, answer, traces (evidence: `backend/app/api/v1/query.py`)
- Evaluation endpoint → RAGAS evaluator: runs evaluation (evidence: `backend/app/api/v1/evaluation.py`)
- Evaluation endpoint → Evaluation reports: serves reports (evidence: `backend/app/api/v1/evaluation.py`)
- Legal intelligence → Retrieval orchestrator: supports legal search
- Technology analysis → Retrieval orchestrator: supports technology analysis
- Agent nodes → Tracing: records traces
