# shivanand24/semantrix architecture

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

- Interactive diagram: https://gitdiagram.com/shivanand24/semantrix
- Repository: https://github.com/shivanand24/semantrix

## Overview

Semantrix ingests text, embeds it, assigns it to evolving semantic clusters, and exposes cluster evidence and lifecycle activity through a dashboard. The central runtime path is the dashboard/API into incremental clustering, with SQLite as authoritative state and Qdrant for vector search. The graph also preserves documented dashboard capabilities and the provider-swappable LLM branch. Some UI-to-endpoint and unsampled subsystem details are documented only at a high level, so those links are not expanded into speculative call chains.

Main entry points: [`backend/semantrix_core/clustering.py`](https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/clustering.py) (Incremental clustering), [`frontend/src/components/AppShell.tsx`](https://github.com/shivanand24/semantrix/blob/main/frontend/src/components/AppShell.tsx) (Dashboard shell), [`backend/app/main.py`](https://github.com/shivanand24/semantrix/blob/main/backend/app/main.py) (Application setup), [`backend/app/routes.py`](https://github.com/shivanand24/semantrix/blob/main/backend/app/routes.py) (REST and SSE API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Dashboard"]
  node_dashboard["Dashboard shell<br/>[AppShell.tsx]"]
  node_overview["Cluster overview<br/>[page.tsx]"]
  node_replay["Live replay<br/>[page.tsx]"]
  node_custom["Custom ingestion<br/>[page.tsx]"]
  node_cluster_detail["Cluster details<br/>[page.tsx]"]
  node_analytics["Analytics<br/>[page.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_service["API Service"]
  node_api["REST and SSE API<br/>[routes.py]"]
  node_schemas["API schemas<br/>[schemas.py]"]
  node_app_setup["Application setup<br/>[main.py]"]
  node_config["Runtime settings<br/>[config.py]"]
end

subgraph group_domain["Clustering Core"]
  node_embedder["Text embedding<br/>[embedder.py]"]
  node_cluster_engine["Incremental clustering<br/>[clustering.py]"]
  node_lifecycle["Cluster lifecycle<br/>[lifecycle.py]"]
  node_adjudicator["LLM adjudication<br/>[llm_adjudicator.py]"]
  node_ingestion["Dataset ingestion<br/>[ingestion.py]"]
  node_baselines["Similarity baselines<br/>[baselines.py]"]
  node_recovery["Index recovery<br/>[recovery.py]"]
end

subgraph group_persistence["State and Search"]
  node_orm["Persistent models<br/>[models.py]"]
  node_db["SQLite access<br/>[db.py]"]
  node_vector_store["Vector store client<br/>[vector_store.py]"]
end

subgraph group_integrations["External Services"]
  node_sqlite[("SQLite WAL")]
  node_qdrant[("Qdrant")]
  node_llm_service{{"Hosted LLM APIs"}}
end

node_user(("User"))

node_user -->|"uses"| node_dashboard
node_dashboard -->|"REST / SSE"| node_api
node_dashboard -.->|"renders"| node_overview
node_dashboard -.->|"renders"| node_replay
node_dashboard -.->|"renders"| node_custom
node_dashboard -.->|"renders"| node_cluster_detail
node_dashboard -.->|"renders"| node_analytics
node_api_client -.->|"requests"| node_api
node_app_setup -->|"registers"| node_api
node_app_setup -->|"loads settings"| node_config
node_app_setup -->|"creates engine"| node_db
node_app_setup -->|"configures"| node_embedder
node_app_setup -->|"constructs"| node_cluster_engine
node_app_setup -->|"configures"| node_adjudicator
node_api -->|"validates"| node_schemas
node_api -->|"embeds text"| node_embedder
node_api -->|"ingests record"| node_cluster_engine
node_cluster_engine -->|"checks lifecycle"| node_lifecycle
node_cluster_engine -->|"uses vectors"| node_embedder
node_cluster_engine -->|"adjudicates"| node_adjudicator
node_cluster_engine -->|"updates index"| node_vector_store
node_cluster_engine -->|"persists state"| node_orm
node_recovery -->|"rebuilds index"| node_cluster_engine
node_recovery -->|"reads vectors"| node_vector_store
node_recovery -->|"embeds records"| node_embedder
node_db -->|"stores state"| node_sqlite
node_vector_store -->|"searches vectors"| node_qdrant
node_adjudicator -.->|"calls provider"| node_llm_service
node_ingestion -.->|"feeds records"| node_cluster_engine

click node_dashboard "https://github.com/shivanand24/semantrix/blob/main/frontend/src/components/AppShell.tsx"
click node_overview "https://github.com/shivanand24/semantrix/blob/main/frontend/src/app/page.tsx"
click node_replay "https://github.com/shivanand24/semantrix/blob/main/frontend/src/app/replay/page.tsx"
click node_custom "https://github.com/shivanand24/semantrix/blob/main/frontend/src/app/custom/page.tsx"
click node_cluster_detail "https://github.com/shivanand24/semantrix/blob/main/frontend/src/app/clusters/%5Bid%5D/page.tsx"
click node_analytics "https://github.com/shivanand24/semantrix/blob/main/frontend/src/app/analytics/page.tsx"
click node_api_client "https://github.com/shivanand24/semantrix/blob/main/frontend/src/lib/api.ts"
click node_api "https://github.com/shivanand24/semantrix/blob/main/backend/app/routes.py"
click node_schemas "https://github.com/shivanand24/semantrix/blob/main/backend/app/schemas.py"
click node_app_setup "https://github.com/shivanand24/semantrix/blob/main/backend/app/main.py"
click node_embedder "https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/embedder.py"
click node_cluster_engine "https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/clustering.py"
click node_lifecycle "https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/lifecycle.py"
click node_adjudicator "https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/llm_adjudicator.py"
click node_ingestion "https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/ingestion.py"
click node_baselines "https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/baselines.py"
click node_recovery "https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/recovery.py"
click node_config "https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/config.py"
click node_orm "https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/models.py"
click node_db "https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/db.py"
click node_vector_store "https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/vector_store.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_dashboard,node_overview,node_replay,node_custom,node_cluster_detail,node_analytics,node_api_client,node_user toneBlue
class node_api,node_schemas,node_app_setup,node_config toneAmber
class node_embedder,node_cluster_engine,node_lifecycle,node_adjudicator,node_ingestion,node_baselines,node_recovery toneMint
class node_orm,node_db,node_vector_store toneRose
class node_sqlite,node_qdrant,node_llm_service toneIndigo
```

## Components

### Dashboard

- [Dashboard shell](https://github.com/shivanand24/semantrix/blob/main/frontend/src/components/AppShell.tsx): `frontend/src/components/AppShell.tsx`
- [Cluster overview](https://github.com/shivanand24/semantrix/blob/main/frontend/src/app/page.tsx): `frontend/src/app/page.tsx`
- [Live replay](https://github.com/shivanand24/semantrix/blob/main/frontend/src/app/replay/page.tsx): `frontend/src/app/replay/page.tsx`
- [Custom ingestion](https://github.com/shivanand24/semantrix/blob/main/frontend/src/app/custom/page.tsx): `frontend/src/app/custom/page.tsx`
- [Cluster details](https://github.com/shivanand24/semantrix/blob/main/frontend/src/app/clusters/%5Bid%5D/page.tsx): `frontend/src/app/clusters/[id]/page.tsx`
- [Analytics](https://github.com/shivanand24/semantrix/blob/main/frontend/src/app/analytics/page.tsx): `frontend/src/app/analytics/page.tsx`
- [API client](https://github.com/shivanand24/semantrix/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### API Service

- [REST and SSE API](https://github.com/shivanand24/semantrix/blob/main/backend/app/routes.py): `backend/app/routes.py`
- [API schemas](https://github.com/shivanand24/semantrix/blob/main/backend/app/schemas.py): `backend/app/schemas.py`
- [Application setup](https://github.com/shivanand24/semantrix/blob/main/backend/app/main.py): `backend/app/main.py`
- [Runtime settings](https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/config.py): `backend/semantrix_core/config.py`

### Clustering Core

- [Text embedding](https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/embedder.py): `backend/semantrix_core/embedder.py`
- [Incremental clustering](https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/clustering.py): `backend/semantrix_core/clustering.py`
- [Cluster lifecycle](https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/lifecycle.py): `backend/semantrix_core/lifecycle.py`
- [LLM adjudication](https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/llm_adjudicator.py): `backend/semantrix_core/llm_adjudicator.py`
- [Dataset ingestion](https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/ingestion.py): `backend/semantrix_core/ingestion.py`
- [Similarity baselines](https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/baselines.py): `backend/semantrix_core/baselines.py`
- [Index recovery](https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/recovery.py): `backend/semantrix_core/recovery.py`

### State and Search

- [Persistent models](https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/models.py): `backend/semantrix_core/models.py`
- [SQLite access](https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/db.py): `backend/semantrix_core/db.py`
- [Vector store client](https://github.com/shivanand24/semantrix/blob/main/backend/semantrix_core/vector_store.py): `backend/semantrix_core/vector_store.py`

### External Services

- **SQLite WAL**
- **Qdrant**
- **Hosted LLM APIs**

### Other components

- **User**

## Connections

- User → Dashboard shell: uses (evidence: `README.md`)
- Dashboard shell → REST and SSE API: REST / SSE (evidence: `README.md`)
- Dashboard shell → Cluster overview: renders
- Dashboard shell → Live replay: renders
- Dashboard shell → Custom ingestion: renders
- Dashboard shell → Cluster details: renders
- Dashboard shell → Analytics: renders
- API client → REST and SSE API: requests
- Application setup → REST and SSE API: registers (evidence: `backend/app/main.py`)
- Application setup → Runtime settings: loads settings (evidence: `backend/app/main.py`)
- Application setup → SQLite access: creates engine (evidence: `backend/app/main.py`)
- Application setup → Text embedding: configures (evidence: `backend/app/main.py`)
- Application setup → Incremental clustering: constructs (evidence: `backend/app/main.py`)
- Application setup → LLM adjudication: configures (evidence: `backend/app/main.py`)
- REST and SSE API → API schemas: validates (evidence: `backend/app/routes.py`)
- REST and SSE API → Text embedding: embeds text (evidence: `backend/app/routes.py`)
- REST and SSE API → Incremental clustering: ingests record (evidence: `backend/app/routes.py`)
- Incremental clustering → Cluster lifecycle: checks lifecycle (evidence: `backend/semantrix_core/clustering.py`)
- Incremental clustering → Text embedding: uses vectors (evidence: `backend/semantrix_core/clustering.py`)
- Incremental clustering → LLM adjudication: adjudicates (evidence: `backend/semantrix_core/clustering.py`)
- Incremental clustering → Vector store client: updates index (evidence: `backend/semantrix_core/clustering.py`)
- Incremental clustering → Persistent models: persists state (evidence: `backend/semantrix_core/clustering.py`)
- Index recovery → Incremental clustering: rebuilds index (evidence: `backend/semantrix_core/recovery.py`)
- Index recovery → Vector store client: reads vectors (evidence: `backend/semantrix_core/recovery.py`)
- Index recovery → Text embedding: embeds records (evidence: `backend/semantrix_core/recovery.py`)
- SQLite access → SQLite WAL: stores state (evidence: `README.md`)
- Vector store client → Qdrant: searches vectors (evidence: `README.md`)
- LLM adjudication → Hosted LLM APIs: calls provider (evidence: `README.md`)
- Dataset ingestion → Incremental clustering: feeds records
