# kaidenhuang/openpalantir architecture

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

- Interactive diagram: https://gitdiagram.com/kaidenhuang/openpalantir
- Repository: https://github.com/kaidenhuang/openpalantir

## Overview

OpenPalantir ingests documents and relational databases, extracts and enriches entities and relationships, persists a Neo4j knowledge graph, and exposes graph analysis and an AI decision assistant through a React UI and FastAPI backend. The graph preserves the documented ingestion, CDC, task, analysis, and decision branches. Several backend implementations were not sampled, so relationships supported only by product documentation are cited to the README; uncertain wiring is omitted.

Main entry points: [`backend/main.py`](https://github.com/kaidenhuang/openpalantir/blob/main/backend/main.py) (REST API), [`frontend/src/App.tsx`](https://github.com/kaidenhuang/openpalantir/blob/main/frontend/src/App.tsx) (Application shell), [`backend/knowledge_graph/graph_manager.py`](https://github.com/kaidenhuang/openpalantir/blob/main/backend/knowledge_graph/graph_manager.py) (Graph manager), [`backend/api/routes/database.py`](https://github.com/kaidenhuang/openpalantir/blob/main/backend/api/routes/database.py) (Database routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interface"]
  node_app["Application shell<br/>[App.tsx]"]
  node_dbui["Database UI"]
  node_graphui["Graph visualization"]
  node_analysisui["Analysis dashboard"]
  node_decisionui["Decision assistant"]
  node_docui["Document viewer<br/>[DocumentViewer.tsx]"]
end

subgraph group_api["API and tasks"]
  node_api["REST API<br/>[main.py]"]
  node_dbroute["Database routes<br/>[database.py]"]
  node_analysisroute["Analysis routes<br/>[analysis.py]"]
  node_decisionroute["Decision routes<br/>[decision.py]"]
  node_taskmanager["Task manager<br/>[task_manager.py]"]
  node_taskhandlers["Task handlers"]
  node_metadata[("SQLite metadata<br/>[database.py]")]
end

subgraph group_ingest["Data ingestion"]
  node_source["Source management<br/>[source_service.py]"]
  node_docproc["Document processing"]
  node_pageindex["Document indexing<br/>[page_index.py]"]
  node_dbmanager["Database connections"]
  node_schema["Schema persistence"]
  node_entity["Entity extraction"]
  node_cdc["CDC synchronization<br/>[cdc_manager.py]"]
end

subgraph group_graph["Knowledge graph"]
  node_graphmanager["Graph manager<br/>[graph_manager.py]"]
  node_entityrepo["Entity repository"]
  node_relrepo["Relationship repository"]
  node_neo4j[("Neo4j")]
end

subgraph group_insights["Analysis and decisions"]
  node_analyzer["Graph analyzer<br/>[analyzer.py]"]
  node_decisionengine["Decision engine<br/>[engine.py]"]
  node_tools["Decision tools<br/>[tools.py]"]
  node_modelclient["Model client<br/>[model_client.py]"]
end

node_user(("User"))
node_llm["LLM provider"]
node_source_db[("Source databases")]
node_debezium["Debezium"]
node_redis["Redis Streams"]

node_user -->|"uses"| node_app
node_app -->|"renders"| node_dbui
node_app -->|"renders"| node_graphui
node_app -->|"renders"| node_analysisui
node_app -->|"renders"| node_decisionui
node_app -->|"renders"| node_docui
node_dbui -->|"requests"| node_api
node_graphui -->|"requests"| node_api
node_analysisui -->|"requests"| node_api
node_decisionui -->|"requests"| node_api
node_docui -->|"requests"| node_api
node_api -->|"registers"| node_dbroute
node_api -->|"registers"| node_analysisroute
node_api -->|"registers"| node_decisionroute
node_dbroute -->|"calls"| node_dbmanager
node_dbroute -->|"calls"| node_schema
node_api -->|"exposes"| node_taskmanager
node_taskmanager -->|"dispatches"| node_taskhandlers
node_source -.->|"processes documents"| node_docproc
node_docproc -.->|"indexes documents"| node_pageindex
node_source -->|"enriches entities"| node_entity
node_dbmanager -->|"connects"| node_source_db
node_dbmanager -.->|"extracts schema"| node_schema
node_cdc -->|"captures changes"| node_debezium
node_debezium -->|"reads changes"| node_source_db
node_debezium -->|"streams events"| node_redis
node_cdc -->|"consumes events"| node_redis
node_entity -.->|"adds graph data"| node_graphmanager
node_graphmanager -->|"delegates entities"| node_entityrepo
node_graphmanager -->|"delegates relationships"| node_relrepo
node_entityrepo -->|"reads and writes"| node_neo4j
node_relrepo -->|"reads and writes"| node_neo4j
node_analysisroute -.->|"runs analysis"| node_analyzer
node_analyzer -.->|"queries graph"| node_graphmanager
node_decisionroute -.->|"runs assistant"| node_decisionengine
node_decisionengine -->|"executes tools"| node_tools
node_decisionengine -->|"requests completions"| node_modelclient
node_tools -.->|"retrieves graph data"| node_graphmanager
node_modelclient -->|"calls model"| node_llm
node_api -->|"initializes"| node_metadata

click node_app "https://github.com/kaidenhuang/openpalantir/blob/main/frontend/src/App.tsx"
click node_dbui "https://github.com/kaidenhuang/openpalantir/blob/main/frontend/src/components/DatabaseManagement.tsx"
click node_graphui "https://github.com/kaidenhuang/openpalantir/blob/main/frontend/src/components/GraphVisualization.tsx"
click node_analysisui "https://github.com/kaidenhuang/openpalantir/blob/main/frontend/src/components/AnalysisDashboard.tsx"
click node_decisionui "https://github.com/kaidenhuang/openpalantir/blob/main/frontend/src/components/DecisionAssistant.tsx"
click node_docui "https://github.com/kaidenhuang/openpalantir/blob/main/frontend/src/components/DocumentViewer.tsx"
click node_api "https://github.com/kaidenhuang/openpalantir/blob/main/backend/main.py"
click node_dbroute "https://github.com/kaidenhuang/openpalantir/blob/main/backend/api/routes/database.py"
click node_analysisroute "https://github.com/kaidenhuang/openpalantir/blob/main/backend/api/routes/analysis.py"
click node_decisionroute "https://github.com/kaidenhuang/openpalantir/blob/main/backend/api/routes/decision.py"
click node_taskmanager "https://github.com/kaidenhuang/openpalantir/blob/main/backend/task_management/task_manager.py"
click node_taskhandlers "https://github.com/kaidenhuang/openpalantir/tree/main/backend/task_management/handlers"
click node_source "https://github.com/kaidenhuang/openpalantir/blob/main/backend/source_management/source_service.py"
click node_docproc "https://github.com/kaidenhuang/openpalantir/blob/main/backend/document_processing/document_processor.py"
click node_pageindex "https://github.com/kaidenhuang/openpalantir/blob/main/backend/pageindex/page_index.py"
click node_dbmanager "https://github.com/kaidenhuang/openpalantir/blob/main/backend/database_management/database_manager.py"
click node_schema "https://github.com/kaidenhuang/openpalantir/blob/main/backend/database_management/database_service.py"
click node_entity "https://github.com/kaidenhuang/openpalantir/blob/main/backend/entity_extraction/llm_entity_enhancer.py"
click node_cdc "https://github.com/kaidenhuang/openpalantir/blob/main/backend/cdc/cdc_manager.py"
click node_graphmanager "https://github.com/kaidenhuang/openpalantir/blob/main/backend/knowledge_graph/graph_manager.py"
click node_entityrepo "https://github.com/kaidenhuang/openpalantir/blob/main/backend/knowledge_graph/entity_repository.py"
click node_relrepo "https://github.com/kaidenhuang/openpalantir/blob/main/backend/knowledge_graph/relationship_repository.py"
click node_analyzer "https://github.com/kaidenhuang/openpalantir/blob/main/backend/analysis_engine/analyzer.py"
click node_decisionengine "https://github.com/kaidenhuang/openpalantir/blob/main/backend/decision_engine/agentic/engine.py"
click node_tools "https://github.com/kaidenhuang/openpalantir/blob/main/backend/decision_engine/agentic/tools.py"
click node_modelclient "https://github.com/kaidenhuang/openpalantir/blob/main/backend/model_management/model_client.py"
click node_metadata "https://github.com/kaidenhuang/openpalantir/blob/main/backend/config/database.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_dbui,node_graphui,node_analysisui,node_decisionui,node_docui,node_user toneBlue
class node_api,node_dbroute,node_analysisroute,node_decisionroute,node_taskmanager,node_taskhandlers,node_metadata,node_source_db,node_redis toneAmber
class node_source,node_docproc,node_pageindex,node_dbmanager,node_schema,node_entity,node_cdc toneMint
class node_graphmanager,node_entityrepo,node_relrepo,node_neo4j toneRose
class node_analyzer,node_decisionengine,node_tools,node_modelclient,node_llm,node_debezium toneIndigo
```

## Components

### User interface

- [Application shell](https://github.com/kaidenhuang/openpalantir/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Database UI](https://github.com/kaidenhuang/openpalantir/blob/main/frontend/src/components/DatabaseManagement.tsx): `frontend/src/components/DatabaseManagement.tsx`
- [Graph visualization](https://github.com/kaidenhuang/openpalantir/blob/main/frontend/src/components/GraphVisualization.tsx): `frontend/src/components/GraphVisualization.tsx`
- [Analysis dashboard](https://github.com/kaidenhuang/openpalantir/blob/main/frontend/src/components/AnalysisDashboard.tsx): `frontend/src/components/AnalysisDashboard.tsx`
- [Decision assistant](https://github.com/kaidenhuang/openpalantir/blob/main/frontend/src/components/DecisionAssistant.tsx): `frontend/src/components/DecisionAssistant.tsx`
- [Document viewer](https://github.com/kaidenhuang/openpalantir/blob/main/frontend/src/components/DocumentViewer.tsx): `frontend/src/components/DocumentViewer.tsx`

### API and tasks

- [REST API](https://github.com/kaidenhuang/openpalantir/blob/main/backend/main.py): `backend/main.py`
- [Database routes](https://github.com/kaidenhuang/openpalantir/blob/main/backend/api/routes/database.py): `backend/api/routes/database.py`
- [Analysis routes](https://github.com/kaidenhuang/openpalantir/blob/main/backend/api/routes/analysis.py): `backend/api/routes/analysis.py`
- [Decision routes](https://github.com/kaidenhuang/openpalantir/blob/main/backend/api/routes/decision.py): `backend/api/routes/decision.py`
- [Task manager](https://github.com/kaidenhuang/openpalantir/blob/main/backend/task_management/task_manager.py): `backend/task_management/task_manager.py`
- [Task handlers](https://github.com/kaidenhuang/openpalantir/tree/main/backend/task_management/handlers): `backend/task_management/handlers`
- [SQLite metadata](https://github.com/kaidenhuang/openpalantir/blob/main/backend/config/database.py): `backend/config/database.py`

### Data ingestion

- [Source management](https://github.com/kaidenhuang/openpalantir/blob/main/backend/source_management/source_service.py): `backend/source_management/source_service.py`
- [Document processing](https://github.com/kaidenhuang/openpalantir/blob/main/backend/document_processing/document_processor.py): `backend/document_processing/document_processor.py`
- [Document indexing](https://github.com/kaidenhuang/openpalantir/blob/main/backend/pageindex/page_index.py): `backend/pageindex/page_index.py`
- [Database connections](https://github.com/kaidenhuang/openpalantir/blob/main/backend/database_management/database_manager.py): `backend/database_management/database_manager.py`
- [Schema persistence](https://github.com/kaidenhuang/openpalantir/blob/main/backend/database_management/database_service.py): `backend/database_management/database_service.py`
- [Entity extraction](https://github.com/kaidenhuang/openpalantir/blob/main/backend/entity_extraction/llm_entity_enhancer.py): `backend/entity_extraction/llm_entity_enhancer.py`
- [CDC synchronization](https://github.com/kaidenhuang/openpalantir/blob/main/backend/cdc/cdc_manager.py): `backend/cdc/cdc_manager.py`

### Knowledge graph

- [Graph manager](https://github.com/kaidenhuang/openpalantir/blob/main/backend/knowledge_graph/graph_manager.py): `backend/knowledge_graph/graph_manager.py`
- [Entity repository](https://github.com/kaidenhuang/openpalantir/blob/main/backend/knowledge_graph/entity_repository.py): `backend/knowledge_graph/entity_repository.py`
- [Relationship repository](https://github.com/kaidenhuang/openpalantir/blob/main/backend/knowledge_graph/relationship_repository.py): `backend/knowledge_graph/relationship_repository.py`
- **Neo4j**

### Analysis and decisions

- [Graph analyzer](https://github.com/kaidenhuang/openpalantir/blob/main/backend/analysis_engine/analyzer.py): `backend/analysis_engine/analyzer.py`
- [Decision engine](https://github.com/kaidenhuang/openpalantir/blob/main/backend/decision_engine/agentic/engine.py): `backend/decision_engine/agentic/engine.py`
- [Decision tools](https://github.com/kaidenhuang/openpalantir/blob/main/backend/decision_engine/agentic/tools.py): `backend/decision_engine/agentic/tools.py`
- [Model client](https://github.com/kaidenhuang/openpalantir/blob/main/backend/model_management/model_client.py): `backend/model_management/model_client.py`

### Other components

- **User**
- **LLM provider**
- **Source databases**
- **Debezium**
- **Redis Streams**

## Connections

- User → Application shell: uses (evidence: `README.md`)
- Application shell → Database UI: renders (evidence: `frontend/src/App.tsx`)
- Application shell → Graph visualization: renders (evidence: `frontend/src/App.tsx`)
- Application shell → Analysis dashboard: renders (evidence: `frontend/src/App.tsx`)
- Application shell → Decision assistant: renders (evidence: `frontend/src/App.tsx`)
- Application shell → Document viewer: renders (evidence: `frontend/src/App.tsx`)
- Database UI → REST API: requests (evidence: `README.md`)
- Graph visualization → REST API: requests (evidence: `README.md`)
- Analysis dashboard → REST API: requests (evidence: `README.md`)
- Decision assistant → REST API: requests (evidence: `README.md`)
- Document viewer → REST API: requests (evidence: `README.md`)
- REST API → Database routes: registers (evidence: `backend/main.py`)
- REST API → Analysis routes: registers (evidence: `backend/main.py`)
- REST API → Decision routes: registers (evidence: `backend/main.py`)
- Database routes → Database connections: calls (evidence: `backend/api/routes/database.py`)
- Database routes → Schema persistence: calls (evidence: `backend/api/routes/database.py`)
- REST API → Task manager: exposes (evidence: `README.md`)
- Task manager → Task handlers: dispatches (evidence: `backend/task_management/task_manager.py`)
- Source management → Document processing: processes documents
- Document processing → Document indexing: indexes documents
- Source management → Entity extraction: enriches entities (evidence: `backend/source_management/source_service.py`)
- Database connections → Source databases: connects (evidence: `README.md`)
- Database connections → Schema persistence: extracts schema (evidence: `backend/database_management/database_manager.py`)
- CDC synchronization → Debezium: captures changes (evidence: `README.md`)
- Debezium → Source databases: reads changes (evidence: `README.md`)
- Debezium → Redis Streams: streams events (evidence: `README.md`)
- CDC synchronization → Redis Streams: consumes events (evidence: `README.md`)
- Entity extraction → Graph manager: adds graph data
- Graph manager → Entity repository: delegates entities (evidence: `backend/knowledge_graph/graph_manager.py`)
- Graph manager → Relationship repository: delegates relationships (evidence: `backend/knowledge_graph/graph_manager.py`)
- Entity repository → Neo4j: reads and writes (evidence: `backend/knowledge_graph/entity_repository.py`)
- Relationship repository → Neo4j: reads and writes (evidence: `backend/knowledge_graph/relationship_repository.py`)
- Analysis routes → Graph analyzer: runs analysis
- Graph analyzer → Graph manager: queries graph
- Decision routes → Decision engine: runs assistant
- Decision engine → Decision tools: executes tools (evidence: `backend/decision_engine/agentic/engine.py`)
- Decision engine → Model client: requests completions (evidence: `backend/decision_engine/agentic/engine.py`)
- Decision tools → Graph manager: retrieves graph data
- Model client → LLM provider: calls model (evidence: `backend/model_management/model_client.py`)
- REST API → SQLite metadata: initializes (evidence: `backend/main.py`)
