# pc1209920-coder/open-side architecture

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

- Interactive diagram: https://gitdiagram.com/pc1209920-coder/open-side
- Repository: https://github.com/pc1209920-coder/open-side

## Overview

Open-Side is a decentralized compute mesh that accepts workloads, partitions and routes shards to available peers, executes them in isolated sandboxes, and returns aggregated results; optional ledger settlement records compute proofs and credits. The README documents a CLI, AI-compatible HTTP gateway, daemon, DHT, NAT traversal, WebSockets, checkpoints, and WebAssembly execution. The graph combines those documented capabilities with visible imports and calls; edges for subsystems whose runtime wiring was not sampled are dashed and marked unverified.

Main entry points: [`src/index.js`](https://github.com/pc1209920-coder/open-side/blob/main/src/index.js) (ComputeSea API), [`bin/open-side.js`](https://github.com/pc1209920-coder/open-side/blob/main/bin/open-side.js) (CLI), [`src/router.js`](https://github.com/pc1209920-coder/open-side/blob/main/src/router.js) (Grid Router), [`src/node.js`](https://github.com/pc1209920-coder/open-side/blob/main/src/node.js) (P2P Node)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry Points"]
  node_cli["CLI<br/>[open-side.js]"]
  node_gateway["AI HTTP Gateway<br/>[gateway.js]"]
  node_daemon["Cluster Daemon<br/>[daemon.js]"]
end

subgraph group_orchestration["Workload Orchestration"]
  node_sea["ComputeSea API<br/>[index.js]"]
  node_router["Grid Router<br/>[router.js]"]
end

subgraph group_execution["Secure Execution"]
  node_crypto["Mesh Crypto<br/>[crypto.js]"]
  node_sandbox["Standby Sandbox<br/>[sandbox.js]"]
  node_wasm["WASM Compute<br/>[wasm.js]"]
end

subgraph group_network["Mesh Networking"]
  node_node["P2P Node<br/>[node.js]"]
  node_dht[("Kademlia DHT<br/>[dht.js]")]
  node_nat["STUN NAT Traversal<br/>[nat.js]"]
  node_websocket["WebSocket Transport<br/>[websocket.js]"]
end

subgraph group_extensions["State and Services"]
  node_ledger[("Compute Ledger<br/>[ledger.js]")]
  node_checkpoint[("Checkpoint Manager<br/>[checkpoint.js]")]
end

node_user(("Workload Client"))
node_http_client(("HTTP API Client"))

node_user -->|"runs commands"| node_cli
node_user -->|"submits workloads"| node_sea
node_http_client -->|"sends requests"| node_gateway
node_cli -->|"starts or simulates"| node_sea
node_cli -->|"manages daemon"| node_daemon
node_gateway -->|"submits workload"| node_sea
node_sea -->|"partitions and routes"| node_router
node_router -->|"uses checkpoint manager"| node_checkpoint
node_router -->|"uses canonicalization"| node_sandbox
node_sea -->|"dispatches peer shards"| node_node
node_node -->|"secures peer traffic"| node_crypto
node_node -->|"executes authenticated shards"| node_sandbox
node_sea -->|"uses mesh encryption"| node_crypto
node_sea -->|"records proof and settles credits"| node_ledger
node_sea -.->|"integrates DHT"| node_dht
node_sea -.->|"integrates NAT traversal"| node_nat
node_sea -.->|"integrates WebSockets"| node_websocket
node_sea -.->|"offers WASM compute"| node_wasm

click node_cli "https://github.com/pc1209920-coder/open-side/blob/main/bin/open-side.js"
click node_gateway "https://github.com/pc1209920-coder/open-side/blob/main/src/gateway.js"
click node_daemon "https://github.com/pc1209920-coder/open-side/blob/main/src/daemon.js"
click node_sea "https://github.com/pc1209920-coder/open-side/blob/main/src/index.js"
click node_router "https://github.com/pc1209920-coder/open-side/blob/main/src/router.js"
click node_node "https://github.com/pc1209920-coder/open-side/blob/main/src/node.js"
click node_crypto "https://github.com/pc1209920-coder/open-side/blob/main/src/crypto.js"
click node_sandbox "https://github.com/pc1209920-coder/open-side/blob/main/src/sandbox.js"
click node_ledger "https://github.com/pc1209920-coder/open-side/blob/main/src/ledger.js"
click node_checkpoint "https://github.com/pc1209920-coder/open-side/blob/main/src/checkpoint.js"
click node_dht "https://github.com/pc1209920-coder/open-side/blob/main/src/dht.js"
click node_nat "https://github.com/pc1209920-coder/open-side/blob/main/src/transport/nat.js"
click node_websocket "https://github.com/pc1209920-coder/open-side/blob/main/src/transport/websocket.js"
click node_wasm "https://github.com/pc1209920-coder/open-side/blob/main/src/wasm.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_cli,node_gateway,node_daemon,node_user,node_http_client toneBlue
class node_sea,node_router toneAmber
class node_crypto,node_sandbox,node_wasm toneMint
class node_node,node_dht,node_nat,node_websocket toneRose
class node_ledger,node_checkpoint toneIndigo
```

## Components

### Entry Points

- [CLI](https://github.com/pc1209920-coder/open-side/blob/main/bin/open-side.js): `bin/open-side.js`
- [AI HTTP Gateway](https://github.com/pc1209920-coder/open-side/blob/main/src/gateway.js): `src/gateway.js`
- [Cluster Daemon](https://github.com/pc1209920-coder/open-side/blob/main/src/daemon.js): `src/daemon.js`

### Workload Orchestration

- [ComputeSea API](https://github.com/pc1209920-coder/open-side/blob/main/src/index.js): `src/index.js`
- [Grid Router](https://github.com/pc1209920-coder/open-side/blob/main/src/router.js): `src/router.js`

### Secure Execution

- [Mesh Crypto](https://github.com/pc1209920-coder/open-side/blob/main/src/crypto.js): `src/crypto.js`
- [Standby Sandbox](https://github.com/pc1209920-coder/open-side/blob/main/src/sandbox.js): `src/sandbox.js`
- [WASM Compute](https://github.com/pc1209920-coder/open-side/blob/main/src/wasm.js): `src/wasm.js`

### Mesh Networking

- [P2P Node](https://github.com/pc1209920-coder/open-side/blob/main/src/node.js): `src/node.js`
- [Kademlia DHT](https://github.com/pc1209920-coder/open-side/blob/main/src/dht.js): `src/dht.js`
- [STUN NAT Traversal](https://github.com/pc1209920-coder/open-side/blob/main/src/transport/nat.js): `src/transport/nat.js`
- [WebSocket Transport](https://github.com/pc1209920-coder/open-side/blob/main/src/transport/websocket.js): `src/transport/websocket.js`

### State and Services

- [Compute Ledger](https://github.com/pc1209920-coder/open-side/blob/main/src/ledger.js): `src/ledger.js`
- [Checkpoint Manager](https://github.com/pc1209920-coder/open-side/blob/main/src/checkpoint.js): `src/checkpoint.js`

### Other components

- **Workload Client**
- **HTTP API Client**

## Connections

- Workload Client → CLI: runs commands (evidence: `README.md`)
- Workload Client → ComputeSea API: submits workloads (evidence: `README.md`)
- HTTP API Client → AI HTTP Gateway: sends requests (evidence: `README.md`)
- CLI → ComputeSea API: starts or simulates (evidence: `bin/open-side.js`)
- CLI → Cluster Daemon: manages daemon (evidence: `bin/open-side.js`)
- AI HTTP Gateway → ComputeSea API: submits workload (evidence: `src/gateway.js`)
- ComputeSea API → Grid Router: partitions and routes (evidence: `README.md`)
- Grid Router → Checkpoint Manager: uses checkpoint manager (evidence: `src/router.js`)
- Grid Router → Standby Sandbox: uses canonicalization (evidence: `src/router.js`)
- ComputeSea API → P2P Node: dispatches peer shards (evidence: `README.md`)
- P2P Node → Mesh Crypto: secures peer traffic (evidence: `src/node.js`)
- P2P Node → Standby Sandbox: executes authenticated shards (evidence: `README.md`)
- ComputeSea API → Mesh Crypto: uses mesh encryption (evidence: `README.md`)
- ComputeSea API → Compute Ledger: records proof and settles credits (evidence: `README.md`)
- ComputeSea API → Kademlia DHT: integrates DHT (evidence: `src/index.js`)
- ComputeSea API → STUN NAT Traversal: integrates NAT traversal (evidence: `src/index.js`)
- ComputeSea API → WebSocket Transport: integrates WebSockets (evidence: `src/index.js`)
- ComputeSea API → WASM Compute: offers WASM compute (evidence: `src/index.js`)
