# martinkoutecky/tine architecture

> Architecture diagram of the GitHub repository martinkoutecky/tine, 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/martinkoutecky/tine
- Repository: https://github.com/martinkoutecky/tine

## Overview

Tine is a local-first desktop outliner for Logseq-compatible Markdown graphs. The main workflow is opening a graph, editing pages in the frontend, and persisting changes through the native backend to graph files; search, queries, sheets, and publishing form related read-oriented workflows. The README documents major user-facing capabilities, while excerpts show frontend-to-backend calls, document saves, and query execution. Several subsystems are represented by their exact source paths but were not sampled, so their internal calls are not inferred.

Main entry points: [`src/App.tsx`](https://github.com/martinkoutecky/tine/blob/master/src/App.tsx) (Application shell), [`src/backend.ts`](https://github.com/martinkoutecky/tine/blob/master/src/backend.ts) (Backend bridge), [`crates/tine-store/src/store.rs`](https://github.com/martinkoutecky/tine/blob/master/crates/tine-store/src/store.rs) (Graph store), [`src-tauri/src/commands.rs`](https://github.com/martinkoutecky/tine/blob/master/src-tauri/src/commands.rs) (Native commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experience"]
  node_app["Application shell<br/>[App.tsx]"]
  node_editor["Page editor<br/>[index.ts]"]
  node_save["Save coordinator<br/>[engine.ts]"]
  node_queryui["Query workspace<br/>[QueryWorkspace.tsx]"]
  node_queryir["Query model<br/>[queryIr.ts]"]
  node_sheets["Sheets"]
end

subgraph group_native["Native application"]
  node_backend["Backend bridge<br/>[backend.ts]"]
  node_commands["Native commands<br/>[commands.rs]"]
end

subgraph group_graph["Graph services"]
  node_store[("Graph store<br/>[store.rs]")]
  node_model["Graph model<br/>[model.rs]"]
  node_queryexec["Query execution<br/>[query.rs]"]
  node_queryplan["Search planning<br/>[query_plan.rs]"]
  node_core["Parsing and core<br/>[lib.rs]"]
end

subgraph group_capabilities["Product capabilities"]
  node_conflicts["Conflict handling<br/>[conflicts.rs]"]
  node_pdf["PDF features<br/>[pdf.rs]"]
  node_publish["Static publishing<br/>[publish.rs]"]
  node_plugins["Plugin runtime<br/>[manager.ts]"]
  node_guide["In-app guide<br/>[guide.rs]"]
end

node_user(("Graph user"))
node_localgraph[("Markdown graph files")]

node_user -->|"uses"| node_app
node_app -->|"opens pages"| node_editor
node_editor -->|"persists edits"| node_save
node_save -->|"saves pages"| node_backend
node_backend -->|"invokes commands"| node_commands
node_commands -->|"accesses graph"| node_store
node_store -->|"reads and writes"| node_localgraph
node_store -->|"maintains state"| node_model
node_queryui -->|"runs searches"| node_backend
node_queryui -->|"edits queries"| node_queryir
node_backend -->|"routes queries"| node_commands
node_commands -->|"evaluates queries"| node_queryexec
node_queryexec -->|"uses plans"| node_queryplan
node_queryexec -->|"reads snapshot"| node_model
node_sheets -->|"loads query data"| node_backend
node_store -.->|"uses core types"| node_core
node_app -.->|"surfaces conflicts"| node_conflicts
node_app -->|"offers annotation"| node_pdf
node_user -->|"exports graph"| node_publish
node_app -->|"manages plugins"| node_plugins
node_app -->|"opens guide"| node_guide

click node_app "https://github.com/martinkoutecky/tine/blob/master/src/App.tsx"
click node_editor "https://github.com/martinkoutecky/tine/blob/master/src/document/index.ts"
click node_save "https://github.com/martinkoutecky/tine/blob/master/src/document/save/engine.ts"
click node_queryui "https://github.com/martinkoutecky/tine/blob/master/src/components/QueryWorkspace.tsx"
click node_queryir "https://github.com/martinkoutecky/tine/blob/master/src/editor/queryIr.ts"
click node_sheets "https://github.com/martinkoutecky/tine/blob/master/src/components/querySheetParts.tsx"
click node_backend "https://github.com/martinkoutecky/tine/blob/master/src/backend.ts"
click node_commands "https://github.com/martinkoutecky/tine/blob/master/src-tauri/src/commands.rs"
click node_store "https://github.com/martinkoutecky/tine/blob/master/crates/tine-store/src/store.rs"
click node_model "https://github.com/martinkoutecky/tine/blob/master/crates/tine-store/src/model.rs"
click node_queryexec "https://github.com/martinkoutecky/tine/blob/master/crates/tine-store/src/query.rs"
click node_queryplan "https://github.com/martinkoutecky/tine/blob/master/crates/tine-store/src/query_plan.rs"
click node_core "https://github.com/martinkoutecky/tine/blob/master/crates/tine-core/src/lib.rs"
click node_conflicts "https://github.com/martinkoutecky/tine/blob/master/crates/tine-graph-features/src/conflicts.rs"
click node_pdf "https://github.com/martinkoutecky/tine/blob/master/crates/tine-graph-features/src/pdf.rs"
click node_publish "https://github.com/martinkoutecky/tine/blob/master/crates/tine-graph-features/src/publish.rs"
click node_plugins "https://github.com/martinkoutecky/tine/blob/master/src/plugins/manager.ts"
click node_guide "https://github.com/martinkoutecky/tine/blob/master/crates/tine-graph-features/src/guide.rs"

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_editor,node_save,node_queryui,node_queryir,node_sheets,node_user toneBlue
class node_backend,node_commands,node_localgraph toneAmber
class node_store,node_model,node_queryexec,node_queryplan,node_core toneMint
class node_conflicts,node_pdf,node_publish,node_plugins,node_guide toneRose
```

## Components

### Frontend experience

- [Application shell](https://github.com/martinkoutecky/tine/blob/master/src/App.tsx): `src/App.tsx`
- [Page editor](https://github.com/martinkoutecky/tine/blob/master/src/document/index.ts): `src/document/index.ts`
- [Save coordinator](https://github.com/martinkoutecky/tine/blob/master/src/document/save/engine.ts): `src/document/save/engine.ts`
- [Query workspace](https://github.com/martinkoutecky/tine/blob/master/src/components/QueryWorkspace.tsx): `src/components/QueryWorkspace.tsx`
- [Query model](https://github.com/martinkoutecky/tine/blob/master/src/editor/queryIr.ts): `src/editor/queryIr.ts`
- [Sheets](https://github.com/martinkoutecky/tine/blob/master/src/components/querySheetParts.tsx): `src/components/querySheetParts.tsx`

### Native application

- [Backend bridge](https://github.com/martinkoutecky/tine/blob/master/src/backend.ts): `src/backend.ts`
- [Native commands](https://github.com/martinkoutecky/tine/blob/master/src-tauri/src/commands.rs): `src-tauri/src/commands.rs`

### Graph services

- [Graph store](https://github.com/martinkoutecky/tine/blob/master/crates/tine-store/src/store.rs): `crates/tine-store/src/store.rs`
- [Graph model](https://github.com/martinkoutecky/tine/blob/master/crates/tine-store/src/model.rs): `crates/tine-store/src/model.rs`
- [Query execution](https://github.com/martinkoutecky/tine/blob/master/crates/tine-store/src/query.rs): `crates/tine-store/src/query.rs`
- [Search planning](https://github.com/martinkoutecky/tine/blob/master/crates/tine-store/src/query_plan.rs): `crates/tine-store/src/query_plan.rs`
- [Parsing and core](https://github.com/martinkoutecky/tine/blob/master/crates/tine-core/src/lib.rs): `crates/tine-core/src/lib.rs`

### Product capabilities

- [Conflict handling](https://github.com/martinkoutecky/tine/blob/master/crates/tine-graph-features/src/conflicts.rs): `crates/tine-graph-features/src/conflicts.rs`
- [PDF features](https://github.com/martinkoutecky/tine/blob/master/crates/tine-graph-features/src/pdf.rs): `crates/tine-graph-features/src/pdf.rs`
- [Static publishing](https://github.com/martinkoutecky/tine/blob/master/crates/tine-graph-features/src/publish.rs): `crates/tine-graph-features/src/publish.rs`
- [Plugin runtime](https://github.com/martinkoutecky/tine/blob/master/src/plugins/manager.ts): `src/plugins/manager.ts`
- [In-app guide](https://github.com/martinkoutecky/tine/blob/master/crates/tine-graph-features/src/guide.rs): `crates/tine-graph-features/src/guide.rs`

### Other components

- **Graph user**
- **Markdown graph files**

## Connections

- Graph user → Application shell: uses (evidence: `README.md`)
- Application shell → Page editor: opens pages (evidence: `src/App.tsx`)
- Page editor → Save coordinator: persists edits (evidence: `src/document/index.ts`)
- Save coordinator → Backend bridge: saves pages (evidence: `src/document/save/engine.ts`)
- Backend bridge → Native commands: invokes commands (evidence: `README.md`)
- Native commands → Graph store: accesses graph (evidence: `README.md`)
- Graph store → Markdown graph files: reads and writes (evidence: `README.md`)
- Graph store → Graph model: maintains state (evidence: `crates/tine-store/src/model.rs`)
- Query workspace → Backend bridge: runs searches (evidence: `src/components/QueryWorkspace.tsx`)
- Query workspace → Query model: edits queries (evidence: `src/components/QueryWorkspace.tsx`)
- Backend bridge → Native commands: routes queries (evidence: `README.md`)
- Native commands → Query execution: evaluates queries (evidence: `README.md`)
- Query execution → Search planning: uses plans (evidence: `crates/tine-store/src/query.rs`)
- Query execution → Graph model: reads snapshot (evidence: `crates/tine-store/src/query.rs`)
- Sheets → Backend bridge: loads query data (evidence: `src/components/querySheetParts.tsx`)
- Graph store → Parsing and core: uses core types
- Application shell → Conflict handling: surfaces conflicts
- Application shell → PDF features: offers annotation (evidence: `README.md`)
- Graph user → Static publishing: exports graph (evidence: `README.md`)
- Application shell → Plugin runtime: manages plugins (evidence: `src/App.tsx`)
- Application shell → In-app guide: opens guide (evidence: `README.md`)
