Intelligence, Advanced Charting & Trading Platform
docs(adr): select single WS gateway protocol and record built standalone React app
davoodmehraban89 committed
Oct 12, 2026 at 00:28 UTC
36836b2044847201094fb3de67ddc3e3cee8df88
1 file changed
+11
-4
docs/architecture/ADR-0004-multimarket-rest-ws-charts.md
+11
-4
@@ -17,7 +17,7 @@ User React frontend (client only)
17
│ ├── source_ohlc → CandlestickSeries
18
│ └── daily_reference_point_not_ohlc / reference_point → LineSeries
19
├── HTTPS GET /api/v2/history?... → server REST contract / license gate
20
- └── WSS /ws/market → Cloudflare Worker gateway → Durable Object (hibernation)
20
+ └── WSS /stream?symbol=... → Cloudflare Worker gateway → per-symbol Durable Object (hibernation)
21
↑ privately authenticated publisher
22
Source adapters / ingestion scheduler
23
├── CoinGecko market_chart (price points, not OHLC)
@@ -38,7 +38,7 @@ Source adapters / ingestion scheduler
38
39
**WebSocket** is for low-latency incremental licensed events, not historical backfill. Proposed Cloudflare Durable Objects Hibernation gateway supports subscription validation, per-channel monotonic sequence, reconnection and gap detection. History replay on reconnect comes from REST. Publisher is authenticated by a private 32+ character token and rejected if rights are not `approved_public`. No provider publishers are active yet.
40
41
-**Canvas**: `packages/chart-ui/src/LightweightMarketChart.tsx` runs client-side only with Lightweight Charts version 5, which supports `chart.addSeries(CandlestickSeries|LineSeries)`. It does not turn ECB, CoinGecko, or other sampled points into fake OHLC. All public pages must include TradingView NOTICE and link.
41
+**Canvas**: `apps/market-terminal/src/main.jsx` is the runnable standalone React/Vite client using Lightweight Charts version 5 with `chart.addSeries(CandlestickSeries|LineSeries)`; `packages/chart-ui/src/LightweightMarketChart.tsx` remains a reusable component prototype. It does not turn ECB, CoinGecko, or other sampled points into fake OHLC. All public pages must include TradingView NOTICE and link.
42
43
## 3. Canonical API design
44
@@ -70,9 +70,16 @@ packages/market-feed/test/*.test.mjs
70
packages/chart-ui/package.json
71
packages/chart-ui/tsconfig.json
72
packages/chart-ui/src/LightweightMarketChart.tsx
73
-deploy/chartnova/realtime-gateway.mjs
73
+deploy/chartnova/market-stream-worker.mjs
74
docs/architecture/ADR-0004-multimarket-rest-ws-charts.md
75
docs/data/multimarket-provider-matrix.md
76
```
77
78
-**Important:** `packages/chart-ui` is a new isolated component package. The current repository does not yet contain a complete React/Next.js app integrating it. Existing production chart remains unchanged. No Durable Object was created, no live WebSocket opened and no backfill of unlicensed data was executed.
78
+**Important:** a standalone Vite/React app exists at `apps/market-terminal` and has passed a local production build, but it has **not** been mounted into or deployed over the existing production ChartNova app. No Durable Object was created, no live WebSocket opened and no backfill of unlicensed data was executed.
79
+
80
+## 6. Resolution of competing scaffolds (implementation detail)
81
+Two isolated WebSocket gateway sketches were prototyped while the architecture was being developed. To avoid sending a browser a protocol that its gateway cannot understand, **only** `deploy/chartnova/market-stream-worker.mjs` with `deploy/chartnova/wrangler.realtime.example.toml` is the selected deployment candidate. It uses `/stream?symbol=<CANONICAL_SYMBOL>`, per-symbol `SymbolStreamRoom`, server-side `STREAM_INGEST_TOKEN`, `STREAM_SYMBOL_ALLOWLIST`, and version-1 client `stream.subscribe` messages.
82
+
83
+`deploy/chartnova/realtime-gateway.mjs` and `packages/market-feed/src/realtime-protocol.mjs` remain non-deployed alternative prototypes; do not point the React frontend at the `/ws/market` interface without deliberately migrating and re-testing the protocol. Neither approach has an active provider publisher or a live production route.
84
+
85
+For historical data, the current standalone chart loads the **existing** ECB-only `/api/history` REST endpoint and renders those points as a line. `serveHistoryV2` is a provider-neutral and unmounted port for future licensed OHLC. It returns 503 without a configured repository; real candle display remains disabled until a licensed and independently validated data source, persistence and production REST integration exist.