# michiod/knowledge-graph architecture

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

- Interactive diagram: https://gitdiagram.com/michiod/knowledge-graph
- Repository: https://github.com/michiod/knowledge-graph

## Overview

This is a browser-based knowledge-graph editor, rather than the generic React/Vite template described by the README. The principal workflow is to open the editor, create and connect typed math nodes, and save graph state through the Go API to SQLite. The frontend also supports node expansion, editing, erasing, undo/redo, and graph layout. Source excerpts show the save request and rendering relationship; the initial load behavior is not sufficiently visible to map confidently.

Main entry points: [`src/App.tsx`](https://github.com/michiod/knowledge-graph/blob/main/src/App.tsx) (Graph editor), [`src/main.tsx`](https://github.com/michiod/knowledge-graph/blob/main/src/main.tsx) (React entry point), [`backend/main.go`](https://github.com/michiod/knowledge-graph/blob/main/backend/main.go) (Graph API), [`src/MathNode.tsx`](https://github.com/michiod/knowledge-graph/blob/main/src/MathNode.tsx) (Math node renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Graph editor"]
  node_entry["React entry point<br/>[main.tsx]"]
  node_editor["Graph editor<br/>[App.tsx]"]
  node_mathnode["Math node renderer<br/>[MathNode.tsx]"]
end

subgraph group_backend["Persistence API"]
  node_api["Graph API<br/>[main.go]"]
end

subgraph group_storage["Graph storage"]
  node_database[("SQLite graph state<br/>[graph.db]")]
end

node_user(("Editor user"))

node_user -->|"opens"| node_entry
node_entry -->|"mounts"| node_editor
node_editor -->|"renders"| node_mathnode
node_editor -->|"saves graph"| node_api
node_api -->|"reads and writes"| node_database

click node_entry "https://github.com/michiod/knowledge-graph/blob/main/src/main.tsx"
click node_editor "https://github.com/michiod/knowledge-graph/blob/main/src/App.tsx"
click node_mathnode "https://github.com/michiod/knowledge-graph/blob/main/src/MathNode.tsx"
click node_api "https://github.com/michiod/knowledge-graph/blob/main/backend/main.go"
click node_database "https://github.com/michiod/knowledge-graph/blob/main/backend/graph.db"

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_editor,node_mathnode,node_user toneBlue
class node_api toneAmber
class node_database toneMint
```

## Components

### Graph editor

- [React entry point](https://github.com/michiod/knowledge-graph/blob/main/src/main.tsx): `src/main.tsx`
- [Graph editor](https://github.com/michiod/knowledge-graph/blob/main/src/App.tsx): `src/App.tsx`
- [Math node renderer](https://github.com/michiod/knowledge-graph/blob/main/src/MathNode.tsx): `src/MathNode.tsx`

### Persistence API

- [Graph API](https://github.com/michiod/knowledge-graph/blob/main/backend/main.go): `backend/main.go`

### Graph storage

- [SQLite graph state](https://github.com/michiod/knowledge-graph/blob/main/backend/graph.db): `backend/graph.db`

### Other components

- **Editor user**

## Connections

- Editor user → React entry point: opens (evidence: `src/main.tsx`)
- React entry point → Graph editor: mounts (evidence: `src/main.tsx`)
- Graph editor → Math node renderer: renders (evidence: `src/App.tsx`)
- Graph editor → Graph API: saves graph (evidence: `src/App.tsx`)
- Graph API → SQLite graph state: reads and writes (evidence: `backend/main.go`)
