# zsviczian/kplex architecture

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

- Interactive diagram: https://gitdiagram.com/zsviczian/kplex
- Repository: https://github.com/zsviczian/kplex

## Overview

K-Plex is an Obsidian plugin for spatially navigating note relationships. The main workflow starts when a user opens the Plex, lets the plugin index vault content, then explores related notes around a changing center. The graph compiler and index form the internal data layer; the UI exposes navigation, search, relationship editing, lenses, and Wander. The README documents user-facing behavior, while source-index references and excerpts support only selected internal links; uncertain wiring is left unconnected or marked unverified.

Main entry points: [`src/main.ts`](https://github.com/zsviczian/kplex/blob/main/src/main.ts) (Plugin entry), [`src/ui/App.tsx`](https://github.com/zsviczian/kplex/blob/main/src/ui/App.tsx) (Plex application), [`src/adapters/obsidian/sourceAcquisition.ts`](https://github.com/zsviczian/kplex/blob/main/src/adapters/obsidian/sourceAcquisition.ts) (Source acquisition), [`src/index/SourceFacts.ts`](https://github.com/zsviczian/kplex/blob/main/src/index/SourceFacts.ts) (Source facts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host["Obsidian integration"]
  node_plugin["Plugin entry<br/>[main.ts]"]
  node_source_acquisition["Source acquisition"]
  node_host_collectors["Vault collectors"]
end

subgraph group_graph["Index and graph"]
  node_source_repository[("Source repository")]
  node_source_facts["Source facts<br/>[SourceFacts.ts]"]
  node_metadata_parser["Metadata parser<br/>[metadata.ts]"]
  node_graph_compiler["Graph compiler<br/>[compiler.ts]"]
  node_graph_index["Graph index<br/>[GraphIndex.ts]"]
end

subgraph group_surface["Plex interface"]
  node_plex_view["Plex view<br/>[KplexView.tsx]"]
  node_app["Plex application<br/>[App.tsx]"]
  node_graph_canvas["Graph canvas<br/>[PlexGraph.tsx]"]
  node_search["Vault search<br/>[SearchBox.tsx]"]
  node_relationships["Relationship editing<br/>[RelationModal.ts]"]
  node_lenses["Graph lenses<br/>[GraphLens.ts]"]
end

subgraph group_actions["Navigation and actions"]
  node_action_manager["Action dispatch<br/>[ActionManager.ts]"]
  node_wander["Wander navigation"]
end

subgraph group_prefs["Settings and language"]
  node_settings["Plugin settings<br/>[settings.ts]"]
  node_localization["Localization<br/>[index.ts]"]
end

node_user(("Vault user"))

node_user -->|"opens Plex"| node_plugin
node_plugin -->|"starts indexing"| node_graph_index
node_plugin -->|"opens view"| node_plex_view
node_source_acquisition -->|"compiles sources"| node_graph_compiler
node_source_repository -->|"reads facts"| node_source_facts
node_source_facts -->|"uses grammar"| node_metadata_parser
node_host_collectors -.->|"supplies sources"| node_source_acquisition
node_graph_compiler -.->|"builds graph"| node_graph_index
node_plex_view -.->|"renders interface"| node_app
node_app -.->|"shows graph"| node_graph_canvas
node_user -->|"centers notes"| node_graph_canvas
node_user -->|"searches vault"| node_search
node_user -->|"edits relationships"| node_relationships
node_user -->|"reshapes Plex"| node_lenses
node_app -->|"dispatches actions"| node_action_manager
node_app -->|"controls wandering"| node_wander
node_user -->|"starts Wander"| node_wander
node_plugin -->|"loads settings"| node_settings
node_plugin -.->|"uses translations"| node_localization

click node_plugin "https://github.com/zsviczian/kplex/blob/main/src/main.ts"
click node_source_acquisition "https://github.com/zsviczian/kplex/blob/main/src/adapters/obsidian/sourceAcquisition.ts"
click node_host_collectors "https://github.com/zsviczian/kplex/tree/main/src/adapters/obsidian"
click node_source_repository "https://github.com/zsviczian/kplex/blob/main/src/index/SourceRepository.ts"
click node_source_facts "https://github.com/zsviczian/kplex/blob/main/src/index/SourceFacts.ts"
click node_metadata_parser "https://github.com/zsviczian/kplex/blob/main/src/core/parser/metadata.ts"
click node_graph_compiler "https://github.com/zsviczian/kplex/blob/main/src/core/graph/compiler.ts"
click node_graph_index "https://github.com/zsviczian/kplex/blob/main/src/index/GraphIndex.ts"
click node_plex_view "https://github.com/zsviczian/kplex/blob/main/src/ui/KplexView.tsx"
click node_app "https://github.com/zsviczian/kplex/blob/main/src/ui/App.tsx"
click node_graph_canvas "https://github.com/zsviczian/kplex/blob/main/src/ui/PlexGraph.tsx"
click node_search "https://github.com/zsviczian/kplex/blob/main/src/ui/features/SearchBox.tsx"
click node_relationships "https://github.com/zsviczian/kplex/blob/main/src/ui/RelationModal.ts"
click node_lenses "https://github.com/zsviczian/kplex/blob/main/src/lens/GraphLens.ts"
click node_action_manager "https://github.com/zsviczian/kplex/blob/main/src/application/ActionManager.ts"
click node_wander "https://github.com/zsviczian/kplex/blob/main/src/application/WanderController.ts"
click node_settings "https://github.com/zsviczian/kplex/blob/main/src/settings.ts"
click node_localization "https://github.com/zsviczian/kplex/blob/main/src/lang/index.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_plugin,node_source_acquisition,node_host_collectors,node_user toneBlue
class node_source_repository,node_source_facts,node_metadata_parser,node_graph_compiler,node_graph_index toneAmber
class node_plex_view,node_app,node_graph_canvas,node_search,node_relationships,node_lenses toneMint
class node_action_manager,node_wander toneRose
class node_settings,node_localization toneIndigo
```

## Components

### Obsidian integration

- [Plugin entry](https://github.com/zsviczian/kplex/blob/main/src/main.ts): `src/main.ts`
- [Source acquisition](https://github.com/zsviczian/kplex/blob/main/src/adapters/obsidian/sourceAcquisition.ts): `src/adapters/obsidian/sourceAcquisition.ts`
- [Vault collectors](https://github.com/zsviczian/kplex/tree/main/src/adapters/obsidian): `src/adapters/obsidian`

### Index and graph

- [Source repository](https://github.com/zsviczian/kplex/blob/main/src/index/SourceRepository.ts): `src/index/SourceRepository.ts`
- [Source facts](https://github.com/zsviczian/kplex/blob/main/src/index/SourceFacts.ts): `src/index/SourceFacts.ts`
- [Metadata parser](https://github.com/zsviczian/kplex/blob/main/src/core/parser/metadata.ts): `src/core/parser/metadata.ts`
- [Graph compiler](https://github.com/zsviczian/kplex/blob/main/src/core/graph/compiler.ts): `src/core/graph/compiler.ts`
- [Graph index](https://github.com/zsviczian/kplex/blob/main/src/index/GraphIndex.ts): `src/index/GraphIndex.ts`

### Plex interface

- [Plex view](https://github.com/zsviczian/kplex/blob/main/src/ui/KplexView.tsx): `src/ui/KplexView.tsx`
- [Plex application](https://github.com/zsviczian/kplex/blob/main/src/ui/App.tsx): `src/ui/App.tsx`
- [Graph canvas](https://github.com/zsviczian/kplex/blob/main/src/ui/PlexGraph.tsx): `src/ui/PlexGraph.tsx`
- [Vault search](https://github.com/zsviczian/kplex/blob/main/src/ui/features/SearchBox.tsx): `src/ui/features/SearchBox.tsx`
- [Relationship editing](https://github.com/zsviczian/kplex/blob/main/src/ui/RelationModal.ts): `src/ui/RelationModal.ts`
- [Graph lenses](https://github.com/zsviczian/kplex/blob/main/src/lens/GraphLens.ts): `src/lens/GraphLens.ts`

### Navigation and actions

- [Action dispatch](https://github.com/zsviczian/kplex/blob/main/src/application/ActionManager.ts): `src/application/ActionManager.ts`
- [Wander navigation](https://github.com/zsviczian/kplex/blob/main/src/application/WanderController.ts): `src/application/WanderController.ts`

### Settings and language

- [Plugin settings](https://github.com/zsviczian/kplex/blob/main/src/settings.ts): `src/settings.ts`
- [Localization](https://github.com/zsviczian/kplex/blob/main/src/lang/index.ts): `src/lang/index.ts`

### Other components

- **Vault user**

## Connections

- Vault user → Plugin entry: opens Plex (evidence: `README.md`)
- Plugin entry → Graph index: starts indexing (evidence: `src/main.ts`)
- Plugin entry → Plex view: opens view (evidence: `src/main.ts`)
- Source acquisition → Graph compiler: compiles sources (evidence: `src/adapters/obsidian/sourceAcquisition.ts`)
- Source repository → Source facts: reads facts (evidence: `src/index/SourceRepository.ts`)
- Source facts → Metadata parser: uses grammar (evidence: `src/index/SourceFacts.ts`)
- Vault collectors → Source acquisition: supplies sources (evidence: `src/adapters/obsidian/sourceAcquisition.ts`)
- Graph compiler → Graph index: builds graph
- Plex view → Plex application: renders interface
- Plex application → Graph canvas: shows graph (evidence: `src/ui/App.tsx`)
- Vault user → Graph canvas: centers notes (evidence: `README.md`)
- Vault user → Vault search: searches vault (evidence: `README.md`)
- Vault user → Relationship editing: edits relationships (evidence: `README.md`)
- Vault user → Graph lenses: reshapes Plex (evidence: `README.md`)
- Plex application → Action dispatch: dispatches actions (evidence: `src/ui/App.tsx`)
- Plex application → Wander navigation: controls wandering (evidence: `src/ui/App.tsx`)
- Vault user → Wander navigation: starts Wander (evidence: `README.md`)
- Plugin entry → Plugin settings: loads settings (evidence: `src/main.ts`)
- Plugin entry → Localization: uses translations (evidence: `src/main.ts`)
