# jonas-ekeli/chembook3d architecture

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

- Interactive diagram: https://gitdiagram.com/jonas-ekeli/chembook3d
- Repository: https://github.com/jonas-ekeli/chembook3d

## Overview

Chembook3D is a local-first computational-chemistry notebook: users organize structures and reaction steps on a canvas, import calculation outputs, and inspect computed energies and analyses. The browser calls a local Python API; investigation state and copied source files are persisted locally. Optional branches add structure building, local calculations, cluster access, Claude/MCP assistance, and cloud or Git synchronization. The README documents the main deployment relationships; source-index references support several internal module links, while unsampled feature wiring is omitted where it cannot be verified.

Main entry points: [`src/chembook3d/api/routes.py`](https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/api/routes.py) (HTTP API), [`frontend/src/App.tsx`](https://github.com/jonas-ekeli/chembook3d/blob/main/frontend/src/App.tsx) (Browser interface), [`src/chembook3d/services/imports.py`](https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/services/imports.py) (Output import), [`frontend/src/api.ts`](https://github.com/jonas-ekeli/chembook3d/blob/main/frontend/src/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Investigation workspace"]
  node_web["Browser interface<br/>[App.tsx]"]
  node_canvas["Mechanism canvas<br/>[Canvas.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_api_server["HTTP API<br/>[routes.py]"]
  node_investigation["Investigation manager<br/>[investigation.py]"]
  node_store[("Investigation database<br/>[models.py]")]
end

subgraph group_chemistry["Chemistry data"]
  node_import_flow["Output import<br/>[imports.py]"]
  node_parsers["Output parsers<br/>[common.py]"]
  node_coordinates["XYZ coordinates<br/>[xyz.py]"]
  node_builder_api["Structure editing API<br/>[builder.py]"]
  node_builder_service["Structure tools<br/>[builder.py]"]
end

subgraph group_analysis["Analysis and visualization"]
  node_energy_view["Energy profiles<br/>[EnergyDrawer.tsx]"]
  node_analysis_services["Analysis services"]
  node_snapshot["Read-only snapshot<br/>[data.ts]"]
end

subgraph group_compute["Calculation tools"]
  node_local_jobs["Local calculations<br/>[local_worker.py]"]
  node_cloud_jobs["Cloud jobs<br/>[cloud_jobs.py]"]
end

subgraph group_integrations["Optional integrations"]
  node_remote["SSH cluster access<br/>[client.py]"]
  node_claude["Claude and MCP<br/>[mcp_server.py]"]
end

node_user(("Chemist"))
node_hpc["HPC cluster"]
node_git_remote["Private GitHub repository"]

node_user -->|"uses"| node_web
node_web -->|"requests data"| node_api_client
node_api_client -->|"calls REST API"| node_api_server
node_api_server -->|"manages"| node_investigation
node_investigation -->|"persists records"| node_store
node_api_server -->|"handles imports"| node_import_flow
node_import_flow -->|"parses files"| node_parsers
node_parsers -->|"uses coordinates"| node_coordinates
node_import_flow -->|"writes records"| node_store
node_web -->|"renders workspace"| node_canvas
node_web -->|"shows profiles"| node_energy_view
node_api_server -->|"serves analyses"| node_analysis_services
node_web -->|"reads exported data"| node_snapshot
node_api_server -->|"exposes editing"| node_builder_api
node_builder_api -->|"applies edits"| node_builder_service
node_api_server -->|"supports calculations"| node_local_jobs
node_api_server -.->|"supports cloud jobs"| node_cloud_jobs
node_api_server -->|"uses SSH access"| node_remote
node_remote -->|"connects by SSH"| node_hpc
node_claude -->|"uses same API"| node_api_server
node_api_server -.->|"syncs investigation"| node_git_remote

click node_web "https://github.com/jonas-ekeli/chembook3d/blob/main/frontend/src/App.tsx"
click node_canvas "https://github.com/jonas-ekeli/chembook3d/blob/main/frontend/src/components/Canvas.tsx"
click node_api_client "https://github.com/jonas-ekeli/chembook3d/blob/main/frontend/src/api.ts"
click node_api_server "https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/api/routes.py"
click node_investigation "https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/investigation.py"
click node_store "https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/models.py"
click node_import_flow "https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/services/imports.py"
click node_parsers "https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/parsers/common.py"
click node_coordinates "https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/xyz.py"
click node_builder_api "https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/api/builder.py"
click node_builder_service "https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/services/builder.py"
click node_energy_view "https://github.com/jonas-ekeli/chembook3d/blob/main/frontend/src/components/EnergyDrawer.tsx"
click node_analysis_services "https://github.com/jonas-ekeli/chembook3d/tree/main/src/chembook3d/services"
click node_snapshot "https://github.com/jonas-ekeli/chembook3d/blob/main/frontend/src/snapshot/data.ts"
click node_local_jobs "https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/local_worker.py"
click node_cloud_jobs "https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/cloud_jobs.py"
click node_remote "https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/remote/client.py"
click node_claude "https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/mcp_server.py"

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_web,node_canvas,node_api_client,node_api_server,node_investigation,node_store toneBlue
class node_import_flow,node_parsers,node_coordinates,node_builder_api,node_builder_service toneAmber
class node_energy_view,node_analysis_services,node_snapshot toneMint
class node_local_jobs,node_cloud_jobs toneRose
class node_remote,node_claude,node_user,node_hpc,node_git_remote toneIndigo
```

## Components

### Investigation workspace

- [Browser interface](https://github.com/jonas-ekeli/chembook3d/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Mechanism canvas](https://github.com/jonas-ekeli/chembook3d/blob/main/frontend/src/components/Canvas.tsx): `frontend/src/components/Canvas.tsx`
- [API client](https://github.com/jonas-ekeli/chembook3d/blob/main/frontend/src/api.ts): `frontend/src/api.ts`
- [HTTP API](https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/api/routes.py): `src/chembook3d/api/routes.py`
- [Investigation manager](https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/investigation.py): `src/chembook3d/investigation.py`
- [Investigation database](https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/models.py): `src/chembook3d/models.py`

### Chemistry data

- [Output import](https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/services/imports.py): `src/chembook3d/services/imports.py`
- [Output parsers](https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/parsers/common.py): `src/chembook3d/parsers/common.py`
- [XYZ coordinates](https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/xyz.py): `src/chembook3d/xyz.py`
- [Structure editing API](https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/api/builder.py): `src/chembook3d/api/builder.py`
- [Structure tools](https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/services/builder.py): `src/chembook3d/services/builder.py`

### Analysis and visualization

- [Energy profiles](https://github.com/jonas-ekeli/chembook3d/blob/main/frontend/src/components/EnergyDrawer.tsx): `frontend/src/components/EnergyDrawer.tsx`
- [Analysis services](https://github.com/jonas-ekeli/chembook3d/tree/main/src/chembook3d/services): `src/chembook3d/services`
- [Read-only snapshot](https://github.com/jonas-ekeli/chembook3d/blob/main/frontend/src/snapshot/data.ts): `frontend/src/snapshot/data.ts`

### Calculation tools

- [Local calculations](https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/local_worker.py): `src/chembook3d/local_worker.py`
- [Cloud jobs](https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/cloud_jobs.py): `src/chembook3d/cloud_jobs.py`

### Optional integrations

- [SSH cluster access](https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/remote/client.py): `src/chembook3d/remote/client.py`
- [Claude and MCP](https://github.com/jonas-ekeli/chembook3d/blob/main/src/chembook3d/mcp_server.py): `src/chembook3d/mcp_server.py`

### Other components

- **Chemist**
- **HPC cluster**
- **Private GitHub repository**

## Connections

- Chemist → Browser interface: uses (evidence: `README.md`)
- Browser interface → API client: requests data (evidence: `frontend/src/App.tsx`)
- API client → HTTP API: calls REST API (evidence: `frontend/src/api.ts`)
- HTTP API → Investigation manager: manages (evidence: `src/chembook3d/api/routes.py`)
- Investigation manager → Investigation database: persists records (evidence: `README.md`)
- HTTP API → Output import: handles imports (evidence: `src/chembook3d/api/routes.py`)
- Output import → Output parsers: parses files (evidence: `src/chembook3d/services/imports.py`)
- Output parsers → XYZ coordinates: uses coordinates (evidence: `src/chembook3d/parsers/common.py`)
- Output import → Investigation database: writes records (evidence: `src/chembook3d/services/imports.py`)
- Browser interface → Mechanism canvas: renders workspace (evidence: `frontend/src/App.tsx`)
- Browser interface → Energy profiles: shows profiles (evidence: `frontend/src/App.tsx`)
- HTTP API → Analysis services: serves analyses (evidence: `src/chembook3d/api/routes.py`)
- Browser interface → Read-only snapshot: reads exported data (evidence: `frontend/src/snapshot/data.ts`)
- HTTP API → Structure editing API: exposes editing (evidence: `src/chembook3d/app.py`)
- Structure editing API → Structure tools: applies edits (evidence: `src/chembook3d/api/builder.py`)
- HTTP API → Local calculations: supports calculations (evidence: `README.md`)
- HTTP API → Cloud jobs: supports cloud jobs (evidence: `README.md`)
- HTTP API → SSH cluster access: uses SSH access (evidence: `README.md`)
- SSH cluster access → HPC cluster: connects by SSH (evidence: `README.md`)
- Claude and MCP → HTTP API: uses same API (evidence: `README.md`)
- HTTP API → Private GitHub repository: syncs investigation (evidence: `README.md`)
