Reference
Architecture
Reley is a monorepo: a shared schema package, a headless core engine, a Commander CLI, and an Electron + React shell. Every feature flows through one RPC seam.
Layout
packages/
@relay/shared types, zod schemas, IPC method names, errors @relay/core headless engine (no DOM, no Electron) @relay/core-cli Commander CLI, constructs Core in-process @relay/desktop Electron + Vite + React renderer + worker thread
The dispatcher seam
Renderer and CLI never talk to engine code directly. Everything goes through one shape:
flow
renderer / CLI
│ RpcRequest { method, params, id }
▼
Dispatcher → HandlerMap[method] → RpcResponse { result | error }- Method names:
packages/shared/src/ipc/methods.ts - Schemas:
packages/shared/src/schemas/ - Handlers:
packages/core/src/rpc/handlers.ts - Renderer call:
api.call('your.method', params)
Desktop worker bridge
In the Electron app the engine runs in a Node worker thread. The main process forwards renderer IPC into a MessagePort. The worker constructs CoreContext, calls ctx.load(), and a Dispatcher drains the buffered IPC once load resolves. Don't reorder the buffer attach.
Core engine modules
packages/core/src/
svm/ SVM sandbox wrapper (NAPI native; Electron Node ABI) cloner/ RPC clone (Program + accounts + blob cache) patcher/ Anchor IDL coder + IDL store + setField trace/ execution log → instruction tree parser replayer/ historical tx hydrate + execute + diff runtime/ per-session lifecycle, tx-builder, workflow-runner snapshot/ deterministic state snapshots + fork + diff keypair/ sandbox vault with optional safeStorage seal scripting/ vm.Context sandbox with network allowlist rpc-server/ Solana JSON-RPC HTTP server (mirrors wire shape) store/ CoreContext, project + session catalogs, blob store