# meltingbot/zeroneurone architecture

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

- Interactive diagram: https://gitdiagram.com/meltingbot/zeroneurone
- Repository: https://github.com/meltingbot/zeroneurone

## Overview

ZeroNeurone is a local-first investigative analysis workspace: analysts create dossiers, model entities and relationships on an infinite canvas, then inspect and share their work through specialist views, queries, reports, and import/export. Its runtime centers on dossier state backed by IndexedDB and OPFS, with optional encryption and Yjs collaboration. The README documents several capabilities whose implementation was not sampled; those relationships are cited to the README rather than treated as source-verified call chains.

Main entry points: [`src/App.tsx`](https://github.com/meltingbot/zeroneurone/blob/main/src/App.tsx) (Application routing), [`src/pages/DossierPage.tsx`](https://github.com/meltingbot/zeroneurone/blob/main/src/pages/DossierPage.tsx) (Dossier workspace), [`src/stores/dossierStore.ts`](https://github.com/meltingbot/zeroneurone/blob/main/src/stores/dossierStore.ts) (Dossier state), [`src/components/canvas/Canvas.tsx`](https://github.com/meltingbot/zeroneurone/blob/main/src/components/canvas/Canvas.tsx) (Graph canvas)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Workspace and modeling"]
  node_app["Application routing<br/>[App.tsx]"]
  node_home["Dossier home<br/>[HomePage.tsx]"]
  node_dossierpage["Dossier workspace<br/>[DossierPage.tsx]"]
  node_canvas["Graph canvas<br/>[Canvas.tsx]"]
  node_dossierstate["Dossier state<br/>[dossierStore.ts]"]
  node_selection["Selection state<br/>[selectionStore.ts]"]
  node_tabs["Dossier tabs<br/>[tabStore.ts]"]
end

subgraph group_analysis["Analysis and views"]
  node_map["Map view<br/>[MapView.tsx]"]
  node_timeline["Timeline view<br/>[TimelineView.tsx]"]
  node_matrix["Matrix view<br/>[MatrixView.tsx]"]
  node_queryui["Query builder and results"]
  node_querystate["Query state<br/>[queryStore.ts]"]
  node_queryengine["Query parser and evaluator<br/>[evaluator.ts]"]
  node_search["Full-text search<br/>[searchService.ts]"]
  node_graphworker["Graph analysis<br/>[graphWorker.ts]"]
  node_reports["Reports and synthesis<br/>[reportService.ts]"]
end

subgraph group_persistence["Data and protection"]
  node_database[("IndexedDB database<br/>[database.ts]")]
  node_files["Attachment storage<br/>[fileService.ts]"]
  node_encryption["Encryption services"]
  node_encstate["Encryption state<br/>[encryptionStore.ts]"]
end

subgraph group_exchange["Import and export"]
  node_import["Import services<br/>[importService.ts]"]
  node_genealogy["Genealogy import"]
  node_export["Export services<br/>[exportService.ts]"]
end

subgraph group_collaboration["Sharing and extensions"]
  node_syncstate["Sync state<br/>[syncStore.ts]"]
  node_sync["Yjs synchronization<br/>[syncService.ts]"]
  node_relay["Relay server<br/>[relay-server.js]"]
  node_plugins["Plugin registry<br/>[pluginRegistry.ts]"]
end

node_analyst(("Analyst"))

node_analyst -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_dossierpage
node_analyst -->|"models entities"| node_canvas
node_dossierpage -.->|"presents"| node_canvas
node_dossierpage -.->|"presents"| node_map
node_dossierpage -.->|"presents"| node_timeline
node_dossierpage -.->|"presents"| node_matrix
node_canvas -->|"edits dossier"| node_dossierstate
node_canvas -->|"selects elements"| node_selection
node_dossierpage -->|"manages tabs"| node_tabs
node_analyst -->|"builds query"| node_queryui
node_queryui -->|"sets query"| node_querystate
node_querystate -->|"evaluates query"| node_queryengine
node_querystate -->|"saves queries"| node_database
node_analyst -->|"searches dossier"| node_search
node_analyst -->|"requests analysis"| node_graphworker
node_analyst -->|"creates synthesis"| node_reports
node_dossierstate -->|"persists dossier"| node_database
node_dossierstate -->|"manages attachments"| node_files
node_files -->|"stores metadata"| node_database
node_analyst -->|"unlocks data"| node_encryption
node_app -->|"unlocks data"| node_encryption
node_app -->|"sets key state"| node_encstate
node_analyst -->|"imports data"| node_import
node_analyst -->|"imports genealogy"| node_genealogy
node_genealogy -->|"converts records"| node_dossierstate
node_analyst -->|"exports dossier"| node_export
node_dossierstate -->|"shares changes"| node_sync
node_syncstate -.->|"tracks synchronization"| node_sync
node_sync -->|"syncs over WebSocket"| node_relay
node_analyst -->|"uses extensions"| node_plugins
node_app -->|"loads plugins"| node_plugins

click node_app "https://github.com/meltingbot/zeroneurone/blob/main/src/App.tsx"
click node_home "https://github.com/meltingbot/zeroneurone/blob/main/src/pages/HomePage.tsx"
click node_dossierpage "https://github.com/meltingbot/zeroneurone/blob/main/src/pages/DossierPage.tsx"
click node_canvas "https://github.com/meltingbot/zeroneurone/blob/main/src/components/canvas/Canvas.tsx"
click node_dossierstate "https://github.com/meltingbot/zeroneurone/blob/main/src/stores/dossierStore.ts"
click node_selection "https://github.com/meltingbot/zeroneurone/blob/main/src/stores/selectionStore.ts"
click node_tabs "https://github.com/meltingbot/zeroneurone/blob/main/src/stores/tabStore.ts"
click node_map "https://github.com/meltingbot/zeroneurone/blob/main/src/components/map/MapView.tsx"
click node_timeline "https://github.com/meltingbot/zeroneurone/blob/main/src/components/timeline/TimelineView.tsx"
click node_matrix "https://github.com/meltingbot/zeroneurone/blob/main/src/components/matrix/MatrixView.tsx"
click node_queryui "https://github.com/meltingbot/zeroneurone/blob/main/src/components/panels/QueryBuilderVisual.tsx"
click node_querystate "https://github.com/meltingbot/zeroneurone/blob/main/src/stores/queryStore.ts"
click node_queryengine "https://github.com/meltingbot/zeroneurone/blob/main/src/services/query/evaluator.ts"
click node_search "https://github.com/meltingbot/zeroneurone/blob/main/src/services/searchService.ts"
click node_graphworker "https://github.com/meltingbot/zeroneurone/blob/main/src/workers/graphWorker.ts"
click node_reports "https://github.com/meltingbot/zeroneurone/blob/main/src/services/reportService.ts"
click node_database "https://github.com/meltingbot/zeroneurone/blob/main/src/db/database.ts"
click node_files "https://github.com/meltingbot/zeroneurone/blob/main/src/services/fileService.ts"
click node_encryption "https://github.com/meltingbot/zeroneurone/blob/main/src/services/encryption/encryptionService.ts"
click node_encstate "https://github.com/meltingbot/zeroneurone/blob/main/src/stores/encryptionStore.ts"
click node_import "https://github.com/meltingbot/zeroneurone/blob/main/src/services/importService.ts"
click node_genealogy "https://github.com/meltingbot/zeroneurone/blob/main/src/services/genealogy/genealogyImportService.ts"
click node_export "https://github.com/meltingbot/zeroneurone/blob/main/src/services/exportService.ts"
click node_syncstate "https://github.com/meltingbot/zeroneurone/blob/main/src/stores/syncStore.ts"
click node_sync "https://github.com/meltingbot/zeroneurone/blob/main/src/services/syncService.ts"
click node_relay "https://github.com/meltingbot/zeroneurone/blob/main/relay-server.js"
click node_plugins "https://github.com/meltingbot/zeroneurone/blob/main/src/plugins/pluginRegistry.ts"

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_home,node_dossierpage,node_canvas,node_dossierstate,node_selection,node_tabs toneBlue
class node_map,node_timeline,node_matrix,node_queryui,node_querystate,node_queryengine,node_search,node_graphworker,node_reports toneAmber
class node_database,node_files,node_encryption,node_encstate toneMint
class node_import,node_genealogy,node_export toneRose
class node_syncstate,node_sync,node_relay,node_plugins,node_analyst toneIndigo
```

## Components

### Workspace and modeling

- [Application routing](https://github.com/meltingbot/zeroneurone/blob/main/src/App.tsx): `src/App.tsx`
- [Dossier home](https://github.com/meltingbot/zeroneurone/blob/main/src/pages/HomePage.tsx): `src/pages/HomePage.tsx`
- [Dossier workspace](https://github.com/meltingbot/zeroneurone/blob/main/src/pages/DossierPage.tsx): `src/pages/DossierPage.tsx`
- [Graph canvas](https://github.com/meltingbot/zeroneurone/blob/main/src/components/canvas/Canvas.tsx): `src/components/canvas/Canvas.tsx`
- [Dossier state](https://github.com/meltingbot/zeroneurone/blob/main/src/stores/dossierStore.ts): `src/stores/dossierStore.ts`
- [Selection state](https://github.com/meltingbot/zeroneurone/blob/main/src/stores/selectionStore.ts): `src/stores/selectionStore.ts`
- [Dossier tabs](https://github.com/meltingbot/zeroneurone/blob/main/src/stores/tabStore.ts): `src/stores/tabStore.ts`

### Analysis and views

- [Map view](https://github.com/meltingbot/zeroneurone/blob/main/src/components/map/MapView.tsx): `src/components/map/MapView.tsx`
- [Timeline view](https://github.com/meltingbot/zeroneurone/blob/main/src/components/timeline/TimelineView.tsx): `src/components/timeline/TimelineView.tsx`
- [Matrix view](https://github.com/meltingbot/zeroneurone/blob/main/src/components/matrix/MatrixView.tsx): `src/components/matrix/MatrixView.tsx`
- [Query builder and results](https://github.com/meltingbot/zeroneurone/blob/main/src/components/panels/QueryBuilderVisual.tsx): `src/components/panels/QueryBuilderVisual.tsx`
- [Query state](https://github.com/meltingbot/zeroneurone/blob/main/src/stores/queryStore.ts): `src/stores/queryStore.ts`
- [Query parser and evaluator](https://github.com/meltingbot/zeroneurone/blob/main/src/services/query/evaluator.ts): `src/services/query/evaluator.ts`
- [Full-text search](https://github.com/meltingbot/zeroneurone/blob/main/src/services/searchService.ts): `src/services/searchService.ts`
- [Graph analysis](https://github.com/meltingbot/zeroneurone/blob/main/src/workers/graphWorker.ts): `src/workers/graphWorker.ts`
- [Reports and synthesis](https://github.com/meltingbot/zeroneurone/blob/main/src/services/reportService.ts): `src/services/reportService.ts`

### Data and protection

- [IndexedDB database](https://github.com/meltingbot/zeroneurone/blob/main/src/db/database.ts): `src/db/database.ts`
- [Attachment storage](https://github.com/meltingbot/zeroneurone/blob/main/src/services/fileService.ts): `src/services/fileService.ts`
- [Encryption services](https://github.com/meltingbot/zeroneurone/blob/main/src/services/encryption/encryptionService.ts): `src/services/encryption/encryptionService.ts`
- [Encryption state](https://github.com/meltingbot/zeroneurone/blob/main/src/stores/encryptionStore.ts): `src/stores/encryptionStore.ts`

### Import and export

- [Import services](https://github.com/meltingbot/zeroneurone/blob/main/src/services/importService.ts): `src/services/importService.ts`
- [Genealogy import](https://github.com/meltingbot/zeroneurone/blob/main/src/services/genealogy/genealogyImportService.ts): `src/services/genealogy/genealogyImportService.ts`
- [Export services](https://github.com/meltingbot/zeroneurone/blob/main/src/services/exportService.ts): `src/services/exportService.ts`

### Sharing and extensions

- [Sync state](https://github.com/meltingbot/zeroneurone/blob/main/src/stores/syncStore.ts): `src/stores/syncStore.ts`
- [Yjs synchronization](https://github.com/meltingbot/zeroneurone/blob/main/src/services/syncService.ts): `src/services/syncService.ts`
- [Relay server](https://github.com/meltingbot/zeroneurone/blob/main/relay-server.js): `relay-server.js`
- [Plugin registry](https://github.com/meltingbot/zeroneurone/blob/main/src/plugins/pluginRegistry.ts): `src/plugins/pluginRegistry.ts`

### Other components

- **Analyst**

## Connections

- Analyst → Application routing: opens
- Application routing → Dossier home: routes to (evidence: `src/App.tsx`)
- Application routing → Dossier workspace: routes to (evidence: `src/App.tsx`)
- Analyst → Graph canvas: models entities
- Dossier workspace → Graph canvas: presents
- Dossier workspace → Map view: presents
- Dossier workspace → Timeline view: presents
- Dossier workspace → Matrix view: presents
- Graph canvas → Dossier state: edits dossier
- Graph canvas → Selection state: selects elements
- Dossier workspace → Dossier tabs: manages tabs
- Analyst → Query builder and results: builds query
- Query builder and results → Query state: sets query (evidence: `src/components/panels/QueryBuilderVisual.tsx`)
- Query state → Query parser and evaluator: evaluates query (evidence: `src/stores/queryStore.ts`)
- Query state → IndexedDB database: saves queries (evidence: `src/stores/queryStore.ts`)
- Analyst → Full-text search: searches dossier
- Analyst → Graph analysis: requests analysis
- Analyst → Reports and synthesis: creates synthesis
- Dossier state → IndexedDB database: persists dossier (evidence: `src/db/database.ts`)
- Dossier state → Attachment storage: manages attachments (evidence: `src/stores/dossierStore.ts`)
- Attachment storage → IndexedDB database: stores metadata (evidence: `src/services/fileService.ts`)
- Analyst → Encryption services: unlocks data
- Application routing → Encryption services: unlocks data (evidence: `src/App.tsx`)
- Application routing → Encryption state: sets key state (evidence: `src/App.tsx`)
- Analyst → Import services: imports data
- Analyst → Genealogy import: imports genealogy
- Genealogy import → Dossier state: converts records (evidence: `src/services/genealogy/genealogyImportService.ts`)
- Analyst → Export services: exports dossier
- Dossier state → Yjs synchronization: shares changes (evidence: `src/stores/dossierStore.ts`)
- Sync state → Yjs synchronization: tracks synchronization
- Yjs synchronization → Relay server: syncs over WebSocket
- Analyst → Plugin registry: uses extensions
- Application routing → Plugin registry: loads plugins (evidence: `src/App.tsx`)
