# manireddy11/prama architecture

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

- Interactive diagram: https://gitdiagram.com/manireddy11/prama
- Repository: https://github.com/manireddy11/prama

## Overview

Prama is a local research assistant: a user asks in web or chat mode, the Next.js workspace sends the request through its same-origin proxy, and FastAPI streams the answer and research events back. Web answers follow the documented plan, search, read, rank, write, and citation-verification stages; users can inspect sources and revisit threads. The graph preserves documented optional caching, vector recall, and saved history. Internal research stages share backend/research.py; their links reflect the README’s pipeline, not separately inspected calls. Evidence is limited to the supplied excerpts and README.

Main entry points: [`backend/main.py`](https://github.com/manireddy11/prama/blob/main/backend/main.py) (Search API), [`frontend/app/page.tsx`](https://github.com/manireddy11/prama/blob/main/frontend/app/page.tsx) (Chat workspace), [`backend/research.py`](https://github.com/manireddy11/prama/blob/main/backend/research.py) (Web search), [`frontend/app/api/search/route.ts`](https://github.com/manireddy11/prama/blob/main/frontend/app/api/search/route.ts) (Search proxy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Research workspace"]
  node_workspace["Chat workspace<br/>[page.tsx]"]
  node_source_preview["Source previews<br/>[page.tsx]"]
end

subgraph group_api["Request and persistence"]
  node_search_proxy["Search proxy<br/>[route.ts]"]
  node_api_orchestrator["Search API<br/>[main.py]"]
  node_history["Thread history<br/>[main.py]"]
  node_supabase[("Saved turns")]
end

subgraph group_research["Research pipeline"]
  node_query_planning["Query planning<br/>[research.py]"]
  node_web_search["Web search<br/>[research.py]"]
  node_page_reading["Page extraction<br/>[research.py]"]
  node_passage_ranking["Passage ranking<br/>[research.py]"]
  node_answer_generation["Answer generation<br/>[research.py]"]
  node_citation_verification["Citation verification<br/>[research.py]"]
  node_redis_cache[("Search cache<br/>[research.py]")]
  node_vector_recall["Vector recall<br/>[research.py]"]
end

subgraph group_providers["External research services"]
  node_groq{{"Groq"}}
  node_jina_search{{"Jina Search"}}
  node_jina_reader{{"Jina Reader"}}
  node_upstash{{"Upstash Redis"}}
  node_pinecone{{"Pinecone"}}
end

node_user(("Researcher"))

node_user -->|"asks question"| node_workspace
node_workspace -->|"sends request"| node_search_proxy
node_search_proxy -->|"forwards HTTP"| node_api_orchestrator
node_api_orchestrator -->|"plans queries"| node_query_planning
node_api_orchestrator -->|"retrieves sources"| node_web_search
node_query_planning -->|"expands searches"| node_web_search
node_web_search -->|"searches web"| node_jina_search
node_web_search -.->|"caches results"| node_redis_cache
node_redis_cache -.->|"stores cache"| node_upstash
node_api_orchestrator -->|"reads pages"| node_page_reading
node_page_reading -->|"extracts text"| node_jina_reader
node_api_orchestrator -.->|"recalls pages"| node_vector_recall
node_vector_recall -.->|"queries vectors"| node_pinecone
node_api_orchestrator -->|"ranks passages"| node_passage_ranking
node_api_orchestrator -->|"generates answer"| node_answer_generation
node_answer_generation -->|"writes answer"| node_groq
node_api_orchestrator -->|"verifies citations"| node_citation_verification
node_citation_verification -->|"streams verification"| node_workspace
node_api_orchestrator -->|"streams events"| node_workspace
node_api_orchestrator -->|"loads history"| node_history
node_workspace -->|"loads threads"| node_search_proxy
node_history -.->|"reads and saves"| node_supabase
node_workspace -->|"opens sources"| node_source_preview

click node_workspace "https://github.com/manireddy11/prama/blob/main/frontend/app/page.tsx"
click node_source_preview "https://github.com/manireddy11/prama/blob/main/frontend/app/page.tsx"
click node_search_proxy "https://github.com/manireddy11/prama/blob/main/frontend/app/api/search/route.ts"
click node_api_orchestrator "https://github.com/manireddy11/prama/blob/main/backend/main.py"
click node_history "https://github.com/manireddy11/prama/blob/main/backend/main.py"
click node_supabase "https://github.com/manireddy11/prama/blob/main/supabase/migrations/20261125000000_research_turns.sql"
click node_query_planning "https://github.com/manireddy11/prama/blob/main/backend/research.py"
click node_web_search "https://github.com/manireddy11/prama/blob/main/backend/research.py"
click node_page_reading "https://github.com/manireddy11/prama/blob/main/backend/research.py"
click node_passage_ranking "https://github.com/manireddy11/prama/blob/main/backend/research.py"
click node_answer_generation "https://github.com/manireddy11/prama/blob/main/backend/research.py"
click node_citation_verification "https://github.com/manireddy11/prama/blob/main/backend/research.py"
click node_redis_cache "https://github.com/manireddy11/prama/blob/main/backend/research.py"
click node_vector_recall "https://github.com/manireddy11/prama/blob/main/backend/research.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_workspace,node_source_preview toneBlue
class node_search_proxy,node_api_orchestrator,node_history,node_supabase toneAmber
class node_query_planning,node_web_search,node_page_reading,node_passage_ranking,node_answer_generation,node_citation_verification,node_redis_cache,node_vector_recall toneMint
class node_groq,node_jina_search,node_jina_reader,node_upstash,node_pinecone toneRose
class node_user toneIndigo
```

## Components

### Research workspace

- [Chat workspace](https://github.com/manireddy11/prama/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`
- [Source previews](https://github.com/manireddy11/prama/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`

### Request and persistence

- [Search proxy](https://github.com/manireddy11/prama/blob/main/frontend/app/api/search/route.ts): `frontend/app/api/search/route.ts`
- [Search API](https://github.com/manireddy11/prama/blob/main/backend/main.py): `backend/main.py`
- [Thread history](https://github.com/manireddy11/prama/blob/main/backend/main.py): `backend/main.py`
- [Saved turns](https://github.com/manireddy11/prama/blob/main/supabase/migrations/20261125000000_research_turns.sql): `supabase/migrations/20261125000000_research_turns.sql`

### Research pipeline

- [Query planning](https://github.com/manireddy11/prama/blob/main/backend/research.py): `backend/research.py`
- [Web search](https://github.com/manireddy11/prama/blob/main/backend/research.py): `backend/research.py`
- [Page extraction](https://github.com/manireddy11/prama/blob/main/backend/research.py): `backend/research.py`
- [Passage ranking](https://github.com/manireddy11/prama/blob/main/backend/research.py): `backend/research.py`
- [Answer generation](https://github.com/manireddy11/prama/blob/main/backend/research.py): `backend/research.py`
- [Citation verification](https://github.com/manireddy11/prama/blob/main/backend/research.py): `backend/research.py`
- [Search cache](https://github.com/manireddy11/prama/blob/main/backend/research.py): `backend/research.py`
- [Vector recall](https://github.com/manireddy11/prama/blob/main/backend/research.py): `backend/research.py`

### External research services

- **Groq**
- **Jina Search**
- **Jina Reader**
- **Upstash Redis**
- **Pinecone**

### Other components

- **Researcher**

## Connections

- Researcher → Chat workspace: asks question (evidence: `README.md`)
- Chat workspace → Search proxy: sends request (evidence: `frontend/app/page.tsx`)
- Search proxy → Search API: forwards HTTP (evidence: `frontend/app/api/search/route.ts`)
- Search API → Query planning: plans queries (evidence: `README.md`)
- Search API → Web search: retrieves sources (evidence: `backend/main.py`)
- Query planning → Web search: expands searches (evidence: `README.md`)
- Web search → Jina Search: searches web (evidence: `README.md`)
- Web search → Search cache: caches results (evidence: `README.md`)
- Search cache → Upstash Redis: stores cache (evidence: `README.md`)
- Search API → Page extraction: reads pages (evidence: `README.md`)
- Page extraction → Jina Reader: extracts text (evidence: `README.md`)
- Search API → Vector recall: recalls pages (evidence: `README.md`)
- Vector recall → Pinecone: queries vectors (evidence: `README.md`)
- Search API → Passage ranking: ranks passages (evidence: `README.md`)
- Search API → Answer generation: generates answer (evidence: `backend/main.py`)
- Answer generation → Groq: writes answer (evidence: `README.md`)
- Search API → Citation verification: verifies citations (evidence: `backend/main.py`)
- Citation verification → Chat workspace: streams verification
- Search API → Chat workspace: streams events (evidence: `frontend/app/page.tsx`)
- Search API → Thread history: loads history (evidence: `backend/main.py`)
- Chat workspace → Search proxy: loads threads (evidence: `frontend/app/page.tsx`)
- Thread history → Saved turns: reads and saves (evidence: `backend/main.py`)
- Chat workspace → Source previews: opens sources (evidence: `frontend/app/page.tsx`)
