# aawhan0/dasaiko architecture

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

- Interactive diagram: https://gitdiagram.com/aawhan0/dasaiko
- Repository: https://github.com/aawhan0/dasaiko

## Overview

Dasaiko is an AI research workspace for reading papers, asking paper-aware questions, and inspecting evidence behind grounded answers. The principal loop runs from the researcher’s workspace through chat and context-aware retrieval, then hybrid search and reranking select evidence for answer generation and display. A separate ingestion path turns uploaded PDFs into searchable chunks and embeddings; authentication and persistent research context support the workspace. The graph combines README-documented capabilities with sampled source references; links to unsampled implementations are omitted or marked unverified.

Main entry points: [`backend/app/services/chat_service.py`](https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/chat_service.py) (Chat orchestration), [`backend/app/services/search_service.py`](https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/search_service.py) (Hybrid retrieval), [`backend/app/models/chunk.py`](https://github.com/aawhan0/dasaiko/blob/main/backend/app/models/chunk.py) (Paper and chunk records), [`frontend/src/pages/WorkspacePage.tsx`](https://github.com/aawhan0/dasaiko/blob/main/frontend/src/pages/WorkspacePage.tsx) (Workspace UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Research workspace"]
  node_workspace_ui["Workspace UI<br/>[WorkspacePage.tsx]"]
  node_paper_reader["Paper reader<br/>[PDFViewer.tsx]"]
  node_upload_ui["Paper upload<br/>[UploadZone.tsx]"]
  node_evidence_ui["Evidence view<br/>[EvidenceVault.tsx]"]
  node_frontend_api["API clients<br/>[api.ts]"]
end

subgraph group_api["Application services"]
  node_app_entry["API application<br/>[main.py]"]
  node_auth["Authentication<br/>[auth_service.py]"]
  node_chat_api["Chat routes<br/>[chat.py]"]
  node_chat["Chat orchestration<br/>[chat_service.py]"]
  node_search_api["Search routes<br/>[search.py]"]
  node_document_api["Document routes<br/>[documents.py]"]
  node_ingestion["Document ingestion"]
  node_research_context["Research context"]
end

subgraph group_retrieval["Retrieval and reasoning"]
  node_query_rewrite["Query rewriting"]
  node_search["Hybrid retrieval<br/>[search_service.py]"]
  node_vector_search["Vector search"]
  node_bm25["Lexical search<br/>[bm25_service.py]"]
  node_reranker["Cross-encoder ranking"]
  node_embedding["Embedding generation"]
end

subgraph group_evidence["Evidence and persistence"]
  node_persistence[("Relational database<br/>[database.py]")]
  node_paper_data["Paper and chunk records<br/>[chunk.py]"]
end

node_researcher(("Researcher"))
node_inference{{"LLM inference"}}
node_embedding_provider{{"Embedding provider"}}

node_researcher -->|"uses"| node_workspace_ui
node_workspace_ui -->|"reads papers"| node_paper_reader
node_workspace_ui -->|"uploads papers"| node_upload_ui
node_workspace_ui -.->|"requests data"| node_frontend_api
node_frontend_api -->|"calls API"| node_app_entry
node_app_entry -->|"registers route"| node_chat_api
node_app_entry -->|"registers route"| node_search_api
node_app_entry -->|"registers route"| node_document_api
node_chat_api -->|"calls"| node_chat
node_search_api -->|"calls"| node_search
node_document_api -.->|"handles documents"| node_ingestion
node_chat -.->|"rewrites query"| node_query_rewrite
node_chat -->|"requests evidence"| node_search
node_search -->|"retrieves vectors"| node_vector_search
node_search -->|"retrieves terms"| node_bm25
node_search -->|"reranks candidates"| node_reranker
node_vector_search -->|"embeds query"| node_embedding
node_embedding -.->|"requests embedding"| node_embedding_provider
node_search -->|"selects evidence"| node_paper_data
node_bm25 -->|"reads chunks"| node_paper_data
node_vector_search -->|"queries records"| node_paper_data
node_ingestion -->|"creates searchable data"| node_paper_data
node_paper_data -.->|"persists records"| node_persistence
node_chat -->|"generates answer"| node_inference
node_chat -->|"returns evidence"| node_evidence_ui
node_researcher -->|"authenticates"| node_auth
node_chat -.->|"uses research context"| node_research_context

click node_workspace_ui "https://github.com/aawhan0/dasaiko/blob/main/frontend/src/pages/WorkspacePage.tsx"
click node_paper_reader "https://github.com/aawhan0/dasaiko/blob/main/frontend/src/components/pdf/PDFViewer.tsx"
click node_upload_ui "https://github.com/aawhan0/dasaiko/blob/main/frontend/src/components/upload/UploadZone.tsx"
click node_evidence_ui "https://github.com/aawhan0/dasaiko/blob/main/frontend/src/components/evidence/EvidenceVault.tsx"
click node_frontend_api "https://github.com/aawhan0/dasaiko/blob/main/frontend/src/services/api.ts"
click node_app_entry "https://github.com/aawhan0/dasaiko/blob/main/backend/app/main.py"
click node_auth "https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/auth_service.py"
click node_chat_api "https://github.com/aawhan0/dasaiko/blob/main/backend/app/api/chat.py"
click node_chat "https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/chat_service.py"
click node_search_api "https://github.com/aawhan0/dasaiko/blob/main/backend/app/api/search.py"
click node_document_api "https://github.com/aawhan0/dasaiko/blob/main/backend/app/api/documents.py"
click node_ingestion "https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/document_service.py"
click node_query_rewrite "https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/query_rewriter_service.py"
click node_search "https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/search_service.py"
click node_vector_search "https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/vector_search_service.py"
click node_bm25 "https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/bm25_service.py"
click node_reranker "https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/reranker_service.py"
click node_embedding "https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/embedding_service.py"
click node_research_context "https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/research_profile_service.py"
click node_persistence "https://github.com/aawhan0/dasaiko/blob/main/backend/app/db/database.py"
click node_paper_data "https://github.com/aawhan0/dasaiko/blob/main/backend/app/models/chunk.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_ui,node_paper_reader,node_upload_ui,node_evidence_ui,node_frontend_api toneBlue
class node_app_entry,node_auth,node_chat_api,node_chat,node_search_api,node_document_api,node_ingestion,node_research_context toneAmber
class node_query_rewrite,node_search,node_vector_search,node_bm25,node_reranker,node_embedding toneMint
class node_persistence,node_paper_data toneRose
class node_researcher,node_inference,node_embedding_provider toneIndigo
```

## Components

### Research workspace

- [Workspace UI](https://github.com/aawhan0/dasaiko/blob/main/frontend/src/pages/WorkspacePage.tsx): `frontend/src/pages/WorkspacePage.tsx`
- [Paper reader](https://github.com/aawhan0/dasaiko/blob/main/frontend/src/components/pdf/PDFViewer.tsx): `frontend/src/components/pdf/PDFViewer.tsx`
- [Paper upload](https://github.com/aawhan0/dasaiko/blob/main/frontend/src/components/upload/UploadZone.tsx): `frontend/src/components/upload/UploadZone.tsx`
- [Evidence view](https://github.com/aawhan0/dasaiko/blob/main/frontend/src/components/evidence/EvidenceVault.tsx): `frontend/src/components/evidence/EvidenceVault.tsx`
- [API clients](https://github.com/aawhan0/dasaiko/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### Application services

- [API application](https://github.com/aawhan0/dasaiko/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication](https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/auth_service.py): `backend/app/services/auth_service.py`
- [Chat routes](https://github.com/aawhan0/dasaiko/blob/main/backend/app/api/chat.py): `backend/app/api/chat.py`
- [Chat orchestration](https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/chat_service.py): `backend/app/services/chat_service.py`
- [Search routes](https://github.com/aawhan0/dasaiko/blob/main/backend/app/api/search.py): `backend/app/api/search.py`
- [Document routes](https://github.com/aawhan0/dasaiko/blob/main/backend/app/api/documents.py): `backend/app/api/documents.py`
- [Document ingestion](https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/document_service.py): `backend/app/services/document_service.py`
- [Research context](https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/research_profile_service.py): `backend/app/services/research_profile_service.py`

### Retrieval and reasoning

- [Query rewriting](https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/query_rewriter_service.py): `backend/app/services/query_rewriter_service.py`
- [Hybrid retrieval](https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/search_service.py): `backend/app/services/search_service.py`
- [Vector search](https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/vector_search_service.py): `backend/app/services/vector_search_service.py`
- [Lexical search](https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/bm25_service.py): `backend/app/services/bm25_service.py`
- [Cross-encoder ranking](https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/reranker_service.py): `backend/app/services/reranker_service.py`
- [Embedding generation](https://github.com/aawhan0/dasaiko/blob/main/backend/app/services/embedding_service.py): `backend/app/services/embedding_service.py`

### Evidence and persistence

- [Relational database](https://github.com/aawhan0/dasaiko/blob/main/backend/app/db/database.py): `backend/app/db/database.py`
- [Paper and chunk records](https://github.com/aawhan0/dasaiko/blob/main/backend/app/models/chunk.py): `backend/app/models/chunk.py`

### Other components

- **Researcher**
- **LLM inference**
- **Embedding provider**

## Connections

- Researcher → Workspace UI: uses (evidence: `README.md`)
- Workspace UI → Paper reader: reads papers (evidence: `README.md`)
- Workspace UI → Paper upload: uploads papers (evidence: `README.md`)
- Workspace UI → API clients: requests data
- API clients → API application: calls API (evidence: `README.md`)
- API application → Chat routes: registers route (evidence: `backend/app/main.py`)
- API application → Search routes: registers route (evidence: `backend/app/main.py`)
- API application → Document routes: registers route (evidence: `backend/app/main.py`)
- Chat routes → Chat orchestration: calls (evidence: `backend/app/api/chat.py`)
- Search routes → Hybrid retrieval: calls (evidence: `backend/app/api/search.py`)
- Document routes → Document ingestion: handles documents
- Chat orchestration → Query rewriting: rewrites query
- Chat orchestration → Hybrid retrieval: requests evidence (evidence: `README.md`)
- Hybrid retrieval → Vector search: retrieves vectors (evidence: `backend/app/services/search_service.py`)
- Hybrid retrieval → Lexical search: retrieves terms (evidence: `backend/app/services/search_service.py`)
- Hybrid retrieval → Cross-encoder ranking: reranks candidates (evidence: `backend/app/services/search_service.py`)
- Vector search → Embedding generation: embeds query (evidence: `backend/app/services/vector_search_service.py`)
- Embedding generation → Embedding provider: requests embedding
- Hybrid retrieval → Paper and chunk records: selects evidence (evidence: `backend/app/services/search_service.py`)
- Lexical search → Paper and chunk records: reads chunks (evidence: `backend/app/services/bm25_service.py`)
- Vector search → Paper and chunk records: queries records (evidence: `backend/app/services/vector_search_service.py`)
- Document ingestion → Paper and chunk records: creates searchable data (evidence: `README.md`)
- Paper and chunk records → Relational database: persists records
- Chat orchestration → LLM inference: generates answer (evidence: `README.md`)
- Chat orchestration → Evidence view: returns evidence (evidence: `README.md`)
- Researcher → Authentication: authenticates
- Chat orchestration → Research context: uses research context
