# hanggaa/x1 architecture

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

- Interactive diagram: https://gitdiagram.com/hanggaa/x1
- Repository: https://github.com/hanggaa/x1

## Overview

x1 is a capital-intelligence portfolio dashboard with a companion editor. Users view portfolio holdings, valuation and performance, historical audit changes, and market signals; editors update holdings, checkpoints, signals, and outlook data. The local Node server serves both interfaces and exposes JSON read/write endpoints. The sampled code supports the main data, pricing, and persistence relationships; unsampled HTML and dashboard orchestration are represented only where the excerpts show their behavior.

Main entry points: [`editor/editor.js`](https://github.com/hanggaa/x1/blob/main/editor/editor.js) (Editor Engine), [`script.js`](https://github.com/hanggaa/x1/blob/main/script.js) (Dashboard Engine), [`server.js`](https://github.com/hanggaa/x1/blob/main/server.js) (HTTP Server), [`index.html`](https://github.com/hanggaa/x1/blob/main/index.html) (Dashboard UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Portfolio Dashboard"]
  node_dashboard_ui["Dashboard UI<br/>[index.html]"]
  node_dashboard_engine["Dashboard Engine<br/>[script.js]"]
  node_portfolio_view["Holdings Valuation<br/>[script.js]"]
  node_performance["Summary Performance<br/>[script.js]"]
  node_history_audit["History Audit<br/>[script.js]"]
  node_signals_view["Signals Outlook<br/>[script.js]"]
end

subgraph group_editing["Portfolio Editing"]
  node_editor_ui["Editor UI<br/>[index.html]"]
  node_editor_engine["Editor Engine<br/>[editor.js]"]
  node_holdings_edit["Holdings Editor<br/>[editor.js]"]
  node_snapshot_edit["Snapshot Editor<br/>[editor.js]"]
  node_history_edit["History Manager<br/>[editor.js]"]
  node_signals_edit["Signals Editor<br/>[editor.js]"]
end

subgraph group_server["Local Data Service"]
  node_local_server["HTTP Server<br/>[server.js]"]
  node_data_api["Portfolio Data API<br/>[server.js]"]
  node_portfolio_data["Portfolio JSON<br/>[data.json]"]
end

subgraph group_integrations["External Data"]
  node_arweave["Arweave Snapshot"]
  node_coingecko["CoinGecko Prices"]
end

node_user(("Portfolio User"))
node_editor_user(("Portfolio Editor"))

node_user -->|"views"| node_dashboard_ui
node_editor_user -->|"edits"| node_editor_ui
node_local_server -->|"serves"| node_dashboard_ui
node_local_server -->|"serves"| node_editor_ui
node_dashboard_engine -->|"renders"| node_portfolio_view
node_dashboard_engine -->|"updates"| node_performance
node_dashboard_engine -->|"renders"| node_history_audit
node_dashboard_engine -.->|"renders"| node_signals_view
node_dashboard_engine -->|"loads data"| node_arweave
node_dashboard_engine -->|"fetches prices"| node_coingecko
node_editor_engine -->|"manages"| node_holdings_edit
node_editor_engine -->|"creates snapshots"| node_snapshot_edit
node_editor_engine -->|"manages"| node_history_edit
node_editor_engine -->|"manages"| node_signals_edit
node_editor_engine -->|"loads fallback"| node_arweave
node_editor_engine -->|"loads fallback"| node_portfolio_data
node_editor_engine -->|"posts updates"| node_data_api
node_data_api -->|"reads and writes"| node_portfolio_data

click node_dashboard_ui "https://github.com/hanggaa/x1/blob/main/index.html"
click node_dashboard_engine "https://github.com/hanggaa/x1/blob/main/script.js"
click node_portfolio_view "https://github.com/hanggaa/x1/blob/main/script.js"
click node_performance "https://github.com/hanggaa/x1/blob/main/script.js"
click node_history_audit "https://github.com/hanggaa/x1/blob/main/script.js"
click node_signals_view "https://github.com/hanggaa/x1/blob/main/script.js"
click node_editor_ui "https://github.com/hanggaa/x1/blob/main/editor/index.html"
click node_editor_engine "https://github.com/hanggaa/x1/blob/main/editor/editor.js"
click node_holdings_edit "https://github.com/hanggaa/x1/blob/main/editor/editor.js"
click node_snapshot_edit "https://github.com/hanggaa/x1/blob/main/editor/editor.js"
click node_history_edit "https://github.com/hanggaa/x1/blob/main/editor/editor.js"
click node_signals_edit "https://github.com/hanggaa/x1/blob/main/editor/editor.js"
click node_local_server "https://github.com/hanggaa/x1/blob/main/server.js"
click node_data_api "https://github.com/hanggaa/x1/blob/main/server.js"
click node_portfolio_data "https://github.com/hanggaa/x1/blob/main/data.json"

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_dashboard_ui,node_dashboard_engine,node_portfolio_view,node_performance,node_history_audit,node_signals_view,node_user toneBlue
class node_editor_ui,node_editor_engine,node_holdings_edit,node_snapshot_edit,node_history_edit,node_signals_edit toneAmber
class node_local_server,node_data_api,node_portfolio_data toneMint
class node_arweave,node_coingecko toneRose
class node_editor_user toneIndigo
```

## Components

### Portfolio Dashboard

- [Dashboard UI](https://github.com/hanggaa/x1/blob/main/index.html): `index.html`
- [Dashboard Engine](https://github.com/hanggaa/x1/blob/main/script.js): `script.js`
- [Holdings Valuation](https://github.com/hanggaa/x1/blob/main/script.js): `script.js`
- [Summary Performance](https://github.com/hanggaa/x1/blob/main/script.js): `script.js`
- [History Audit](https://github.com/hanggaa/x1/blob/main/script.js): `script.js`
- [Signals Outlook](https://github.com/hanggaa/x1/blob/main/script.js): `script.js`

### Portfolio Editing

- [Editor UI](https://github.com/hanggaa/x1/blob/main/editor/index.html): `editor/index.html`
- [Editor Engine](https://github.com/hanggaa/x1/blob/main/editor/editor.js): `editor/editor.js`
- [Holdings Editor](https://github.com/hanggaa/x1/blob/main/editor/editor.js): `editor/editor.js`
- [Snapshot Editor](https://github.com/hanggaa/x1/blob/main/editor/editor.js): `editor/editor.js`
- [History Manager](https://github.com/hanggaa/x1/blob/main/editor/editor.js): `editor/editor.js`
- [Signals Editor](https://github.com/hanggaa/x1/blob/main/editor/editor.js): `editor/editor.js`

### Local Data Service

- [HTTP Server](https://github.com/hanggaa/x1/blob/main/server.js): `server.js`
- [Portfolio Data API](https://github.com/hanggaa/x1/blob/main/server.js): `server.js`
- [Portfolio JSON](https://github.com/hanggaa/x1/blob/main/data.json): `data.json`

### External Data

- **Arweave Snapshot**
- **CoinGecko Prices**

### Other components

- **Portfolio User**
- **Portfolio Editor**

## Connections

- Portfolio User → Dashboard UI: views
- Portfolio Editor → Editor UI: edits
- HTTP Server → Dashboard UI: serves (evidence: `server.js`)
- HTTP Server → Editor UI: serves (evidence: `server.js`)
- Dashboard Engine → Holdings Valuation: renders (evidence: `script.js`)
- Dashboard Engine → Summary Performance: updates (evidence: `script.js`)
- Dashboard Engine → History Audit: renders (evidence: `script.js`)
- Dashboard Engine → Signals Outlook: renders (evidence: `script.js`)
- Dashboard Engine → Arweave Snapshot: loads data (evidence: `script.js`)
- Dashboard Engine → CoinGecko Prices: fetches prices (evidence: `script.js`)
- Editor Engine → Holdings Editor: manages (evidence: `editor/editor.js`)
- Editor Engine → Snapshot Editor: creates snapshots (evidence: `editor/editor.js`)
- Editor Engine → History Manager: manages (evidence: `editor/editor.js`)
- Editor Engine → Signals Editor: manages (evidence: `editor/editor.js`)
- Editor Engine → Arweave Snapshot: loads fallback (evidence: `editor/editor.js`)
- Editor Engine → Portfolio JSON: loads fallback (evidence: `editor/editor.js`)
- Editor Engine → Portfolio Data API: posts updates (evidence: `editor/editor.js`)
- Portfolio Data API → Portfolio JSON: reads and writes (evidence: `server.js`)
