# httpweez/synapse architecture

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

- Interactive diagram: https://gitdiagram.com/httpweez/synapse
- Repository: https://github.com/httpweez/synapse

## Overview

Synapse is an offline-first browser app for building and exploring 3D mind maps. The user opens the app, selects or creates a map, edits and connects nodes, then searches, filters, focuses, and navigates the graph; maps persist in browser storage. The graph, UI, filtering, state, sample-map data, and persistence modules are represented alongside the rendering layer and its bundled Three.js controls. Relationships reflect shown imports and calls or README claims; unsampled implementation details are not inferred.

Main entry points: [`js/graph.js`](https://github.com/httpweez/synapse/blob/main/js/graph.js) (Graph Operations), [`js/ui.js`](https://github.com/httpweez/synapse/blob/main/js/ui.js) (Map UI), [`js/scene.js`](https://github.com/httpweez/synapse/blob/main/js/scene.js) (Scene and Animation), [`js/app.js`](https://github.com/httpweez/synapse/blob/main/js/app.js) (App Entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User Experience"]
  node_entry["App Entry<br/>[app.js]"]
  node_html["Browser Interface<br/>[index.html]"]
  node_ui["Map UI<br/>[ui.js]"]
  node_filters["Search and Focus<br/>[filters.js]"]
end

subgraph group_graph_core["Graph Core"]
  node_graph["Graph Operations<br/>[graph.js]"]
  node_state["Shared Graph State<br/>[state.js]"]
  node_sample["Example Map Data<br/>[data.js]"]
end

subgraph group_persistence["Map Persistence"]
  node_storage["Map Storage<br/>[storage.js]"]
  node_localstorage[("Browser Storage")]
end

subgraph group_rendering["3D Rendering"]
  node_scene["Scene and Animation<br/>[scene.js]"]
  node_three["Three.js Engine<br/>[three.module.js]"]
  node_orbit["Orbit Controls<br/>[OrbitControls.js]"]
  node_labels["CSS Label Renderer<br/>[CSS2DRenderer.js]"]
end

node_user(("Map Builder"))

node_user -->|"opens app"| node_html
node_entry -->|"initializes and animates"| node_scene
node_entry -->|"binds and updates"| node_ui
node_entry -->|"applies filters"| node_filters
node_ui -->|"selects and restores"| node_graph
node_ui -->|"applies focus and filters"| node_filters
node_ui -->|"loads example"| node_sample
node_ui -->|"loads and saves maps"| node_storage
node_ui -->|"moves camera focus"| node_scene
node_sample -->|"creates nodes and edges"| node_graph
node_filters -->|"reads neighbors and highlights"| node_graph
node_graph -->|"updates graph state"| node_state
node_graph -->|"adds graph objects"| node_scene
node_graph -->|"creates node labels"| node_labels
node_scene -->|"reads simulation state"| node_state
node_scene -->|"configures camera controls"| node_orbit
node_scene -->|"renders labels"| node_labels
node_storage -->|"reads and writes maps"| node_localstorage
node_storage -->|"clears deleted map graph"| node_graph

click node_entry "https://github.com/httpweez/synapse/blob/main/js/app.js"
click node_html "https://github.com/httpweez/synapse/blob/main/index.html"
click node_ui "https://github.com/httpweez/synapse/blob/main/js/ui.js"
click node_filters "https://github.com/httpweez/synapse/blob/main/js/filters.js"
click node_graph "https://github.com/httpweez/synapse/blob/main/js/graph.js"
click node_state "https://github.com/httpweez/synapse/blob/main/js/state.js"
click node_sample "https://github.com/httpweez/synapse/blob/main/js/data.js"
click node_storage "https://github.com/httpweez/synapse/blob/main/js/storage.js"
click node_scene "https://github.com/httpweez/synapse/blob/main/js/scene.js"
click node_three "https://github.com/httpweez/synapse/blob/main/lib/three/three.module.js"
click node_orbit "https://github.com/httpweez/synapse/blob/main/lib/three/controls/OrbitControls.js"
click node_labels "https://github.com/httpweez/synapse/blob/main/lib/three/renderers/CSS2DRenderer.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_entry,node_html,node_ui,node_filters toneBlue
class node_graph,node_state,node_sample toneAmber
class node_storage,node_localstorage toneMint
class node_scene,node_three,node_orbit,node_labels toneRose
class node_user toneIndigo
```

## Components

### User Experience

- [App Entry](https://github.com/httpweez/synapse/blob/main/js/app.js): `js/app.js`
- [Browser Interface](https://github.com/httpweez/synapse/blob/main/index.html): `index.html`
- [Map UI](https://github.com/httpweez/synapse/blob/main/js/ui.js): `js/ui.js`
- [Search and Focus](https://github.com/httpweez/synapse/blob/main/js/filters.js): `js/filters.js`

### Graph Core

- [Graph Operations](https://github.com/httpweez/synapse/blob/main/js/graph.js): `js/graph.js`
- [Shared Graph State](https://github.com/httpweez/synapse/blob/main/js/state.js): `js/state.js`
- [Example Map Data](https://github.com/httpweez/synapse/blob/main/js/data.js): `js/data.js`

### Map Persistence

- [Map Storage](https://github.com/httpweez/synapse/blob/main/js/storage.js): `js/storage.js`
- **Browser Storage**

### 3D Rendering

- [Scene and Animation](https://github.com/httpweez/synapse/blob/main/js/scene.js): `js/scene.js`
- [Three.js Engine](https://github.com/httpweez/synapse/blob/main/lib/three/three.module.js): `lib/three/three.module.js`
- [Orbit Controls](https://github.com/httpweez/synapse/blob/main/lib/three/controls/OrbitControls.js): `lib/three/controls/OrbitControls.js`
- [CSS Label Renderer](https://github.com/httpweez/synapse/blob/main/lib/three/renderers/CSS2DRenderer.js): `lib/three/renderers/CSS2DRenderer.js`

### Other components

- **Map Builder**

## Connections

- Map Builder → Browser Interface: opens app (evidence: `README.md`)
- App Entry → Scene and Animation: initializes and animates (evidence: `js/app.js`)
- App Entry → Map UI: binds and updates (evidence: `js/app.js`)
- App Entry → Search and Focus: applies filters (evidence: `js/app.js`)
- Map UI → Graph Operations: selects and restores (evidence: `js/ui.js`)
- Map UI → Search and Focus: applies focus and filters (evidence: `js/ui.js`)
- Map UI → Example Map Data: loads example (evidence: `js/ui.js`)
- Map UI → Map Storage: loads and saves maps (evidence: `js/ui.js`)
- Map UI → Scene and Animation: moves camera focus (evidence: `js/ui.js`)
- Example Map Data → Graph Operations: creates nodes and edges (evidence: `js/data.js`)
- Search and Focus → Graph Operations: reads neighbors and highlights (evidence: `js/filters.js`)
- Graph Operations → Shared Graph State: updates graph state (evidence: `js/graph.js`)
- Graph Operations → Scene and Animation: adds graph objects (evidence: `js/graph.js`)
- Graph Operations → CSS Label Renderer: creates node labels (evidence: `js/graph.js`)
- Scene and Animation → Shared Graph State: reads simulation state (evidence: `js/scene.js`)
- Scene and Animation → Orbit Controls: configures camera controls (evidence: `js/scene.js`)
- Scene and Animation → CSS Label Renderer: renders labels (evidence: `js/scene.js`)
- Map Storage → Browser Storage: reads and writes maps (evidence: `js/storage.js`)
- Map Storage → Graph Operations: clears deleted map graph (evidence: `js/storage.js`)
