# white66-7/graph-fluid-spring architecture

> Architecture diagram of the GitHub repository white66-7/graph-fluid-spring, 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/white66-7/graph-fluid-spring
- Repository: https://github.com/white66-7/graph-fluid-spring

## Overview

Graph Inertia is a Logseq plugin that replaces the built-in graph view with a continuously simulated Canvas2D knowledge graph. The principal workflow fetches graph data, builds simulation state, and runs physics, timeline effects, and rendering; pointer interaction and camera controls operate on the live view. The README documents additional product capabilities such as momentum dragging, node birth effects, time travel, and native-graph fallback. Some wiring is visible only in excerpts or README documentation, so unsampled connections are omitted rather than inferred.

Main entry points: [`src/main.js`](https://github.com/white66-7/graph-fluid-spring/blob/main/src/main.js) (Runtime orchestrator), [`index.js`](https://github.com/white66-7/graph-fluid-spring/blob/main/index.js) (Plugin entry), [`src/warm.js`](https://github.com/white66-7/graph-fluid-spring/blob/main/src/warm.js) (Layout prewarmer), [`src/physics.js`](https://github.com/white66-7/graph-fluid-spring/blob/main/src/physics.js) (Force simulation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["Host integration"]
  node_logseq["Logseq host"]
  node_db[("Logseq DB")]
  node_entry["Plugin entry<br/>[index.js]"]
  node_settings["Settings and language<br/>[i18n.js]"]
end

subgraph group_graph["Graph runtime"]
  node_datasource["Graph data source<br/>[datasource.js]"]
  node_data["Graph data model<br/>[data.js]"]
  node_main["Runtime orchestrator<br/>[main.js]"]
  node_warm["Layout prewarmer<br/>[warm.js]"]
end

subgraph group_simulation["Simulation and effects"]
  node_physics["Force simulation<br/>[physics.js]"]
  node_spatial["Spatial grid<br/>[spatial.js]"]
  node_effects["Birth effects<br/>[effects.js]"]
  node_timeline["Time-travel timeline<br/>[timeline.js]"]
end

subgraph group_interface["View and controls"]
  node_overlay["Canvas overlay<br/>[overlay.js]"]
  node_renderer["Canvas2D renderer<br/>[renderer.js]"]
  node_camera["Camera<br/>[camera.js]"]
  node_interaction["Pointer interaction<br/>[interaction.js]"]
  node_toolbar["Graph toolbar<br/>[toolbar.js]"]
end

node_user(("User"))

node_user -->|"opens graph"| node_logseq
node_logseq -->|"loads plugin"| node_entry
node_entry -->|"queries graph"| node_db
node_entry -->|"fetches data"| node_datasource
node_datasource -->|"reads graph"| node_db
node_entry -->|"mounts runtime"| node_main
node_entry -->|"syncs settings"| node_settings
node_main -->|"builds model"| node_data
node_main -->|"creates simulation"| node_physics
node_main -->|"creates effects"| node_effects
node_main -->|"creates renderer"| node_renderer
node_main -->|"prewarms layout"| node_warm
node_warm -->|"fetches data"| node_datasource
node_warm -->|"builds model"| node_data
node_warm -->|"settles layout"| node_physics
node_physics -->|"uses grid"| node_spatial
node_main -->|"updates timeline"| node_timeline
node_main -->|"mounts canvas"| node_overlay
node_main -->|"fits view"| node_camera
node_main -->|"updates runtime"| node_interaction
node_main -->|"shows controls"| node_toolbar
node_main -->|"sets grid"| node_renderer
node_user -->|"drags nodes"| node_interaction
node_interaction -->|"pins nodes"| node_physics
node_user -->|"plays time travel"| node_timeline
node_user -.->|"uses controls"| node_toolbar
node_renderer -.->|"draws canvas"| node_overlay

click node_entry "https://github.com/white66-7/graph-fluid-spring/blob/main/index.js"
click node_settings "https://github.com/white66-7/graph-fluid-spring/blob/main/src/i18n.js"
click node_datasource "https://github.com/white66-7/graph-fluid-spring/blob/main/src/datasource.js"
click node_data "https://github.com/white66-7/graph-fluid-spring/blob/main/src/data.js"
click node_main "https://github.com/white66-7/graph-fluid-spring/blob/main/src/main.js"
click node_warm "https://github.com/white66-7/graph-fluid-spring/blob/main/src/warm.js"
click node_physics "https://github.com/white66-7/graph-fluid-spring/blob/main/src/physics.js"
click node_spatial "https://github.com/white66-7/graph-fluid-spring/blob/main/src/spatial.js"
click node_effects "https://github.com/white66-7/graph-fluid-spring/blob/main/src/effects.js"
click node_timeline "https://github.com/white66-7/graph-fluid-spring/blob/main/src/timeline.js"
click node_overlay "https://github.com/white66-7/graph-fluid-spring/blob/main/src/overlay.js"
click node_renderer "https://github.com/white66-7/graph-fluid-spring/blob/main/src/renderer.js"
click node_camera "https://github.com/white66-7/graph-fluid-spring/blob/main/src/camera.js"
click node_interaction "https://github.com/white66-7/graph-fluid-spring/blob/main/src/interaction.js"
click node_toolbar "https://github.com/white66-7/graph-fluid-spring/blob/main/src/toolbar.js"

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_logseq,node_db,node_entry,node_settings,node_user toneBlue
class node_datasource,node_data,node_main,node_warm toneAmber
class node_physics,node_spatial,node_effects,node_timeline toneMint
class node_overlay,node_renderer,node_camera,node_interaction,node_toolbar toneRose
```

## Components

### Host integration

- **Logseq host**
- **Logseq DB**
- [Plugin entry](https://github.com/white66-7/graph-fluid-spring/blob/main/index.js): `index.js`
- [Settings and language](https://github.com/white66-7/graph-fluid-spring/blob/main/src/i18n.js): `src/i18n.js`

### Graph runtime

- [Graph data source](https://github.com/white66-7/graph-fluid-spring/blob/main/src/datasource.js): `src/datasource.js`
- [Graph data model](https://github.com/white66-7/graph-fluid-spring/blob/main/src/data.js): `src/data.js`
- [Runtime orchestrator](https://github.com/white66-7/graph-fluid-spring/blob/main/src/main.js): `src/main.js`
- [Layout prewarmer](https://github.com/white66-7/graph-fluid-spring/blob/main/src/warm.js): `src/warm.js`

### Simulation and effects

- [Force simulation](https://github.com/white66-7/graph-fluid-spring/blob/main/src/physics.js): `src/physics.js`
- [Spatial grid](https://github.com/white66-7/graph-fluid-spring/blob/main/src/spatial.js): `src/spatial.js`
- [Birth effects](https://github.com/white66-7/graph-fluid-spring/blob/main/src/effects.js): `src/effects.js`
- [Time-travel timeline](https://github.com/white66-7/graph-fluid-spring/blob/main/src/timeline.js): `src/timeline.js`

### View and controls

- [Canvas overlay](https://github.com/white66-7/graph-fluid-spring/blob/main/src/overlay.js): `src/overlay.js`
- [Canvas2D renderer](https://github.com/white66-7/graph-fluid-spring/blob/main/src/renderer.js): `src/renderer.js`
- [Camera](https://github.com/white66-7/graph-fluid-spring/blob/main/src/camera.js): `src/camera.js`
- [Pointer interaction](https://github.com/white66-7/graph-fluid-spring/blob/main/src/interaction.js): `src/interaction.js`
- [Graph toolbar](https://github.com/white66-7/graph-fluid-spring/blob/main/src/toolbar.js): `src/toolbar.js`

### Other components

- **User**

## Connections

- User → Logseq host: opens graph (evidence: `README.md`)
- Logseq host → Plugin entry: loads plugin (evidence: `README.md`)
- Plugin entry → Logseq DB: queries graph (evidence: `index.js`)
- Plugin entry → Graph data source: fetches data (evidence: `index.js`)
- Graph data source → Logseq DB: reads graph (evidence: `README.md`)
- Plugin entry → Runtime orchestrator: mounts runtime (evidence: `index.js`)
- Plugin entry → Settings and language: syncs settings (evidence: `index.js`)
- Runtime orchestrator → Graph data model: builds model (evidence: `src/main.js`)
- Runtime orchestrator → Force simulation: creates simulation (evidence: `src/main.js`)
- Runtime orchestrator → Birth effects: creates effects (evidence: `src/main.js`)
- Runtime orchestrator → Canvas2D renderer: creates renderer (evidence: `src/main.js`)
- Runtime orchestrator → Layout prewarmer: prewarms layout (evidence: `src/warm.js`)
- Layout prewarmer → Graph data source: fetches data (evidence: `src/warm.js`)
- Layout prewarmer → Graph data model: builds model (evidence: `src/warm.js`)
- Layout prewarmer → Force simulation: settles layout (evidence: `src/warm.js`)
- Force simulation → Spatial grid: uses grid (evidence: `README.md`)
- Runtime orchestrator → Time-travel timeline: updates timeline (evidence: `README.md`)
- Runtime orchestrator → Canvas overlay: mounts canvas (evidence: `src/main.js`)
- Runtime orchestrator → Camera: fits view (evidence: `src/main.js`)
- Runtime orchestrator → Pointer interaction: updates runtime (evidence: `src/main.js`)
- Runtime orchestrator → Graph toolbar: shows controls (evidence: `src/main.js`)
- Runtime orchestrator → Canvas2D renderer: sets grid (evidence: `src/main.js`)
- User → Pointer interaction: drags nodes (evidence: `README.md`)
- Pointer interaction → Force simulation: pins nodes
- User → Time-travel timeline: plays time travel (evidence: `README.md`)
- User → Graph toolbar: uses controls
- Canvas2D renderer → Canvas overlay: draws canvas
