# Architecture and execution snapshots

Trace browser/API/runtime responsibilities and understand exactly what a captured run can reproduce.

Canonical URL: https://opennodeflow.dev/wiki/architecture/
JSON reference: https://opennodeflow.dev/wiki/architecture/index.json
Source snapshot: 2026-10-23

ONF combines a React workbench with a Node.js HTTP API and local execution engine. In the current production arrangement the API also serves the built frontend. MCP is part of that same host; it is not a separate automation server.

## Request and execution path

```text
Browser workbench
  → same-origin JSON API and server events
  → validation, revision guards and SQLite store
  → durable accepted run and dependency snapshot
  → workflow scheduler and local pool admission
  → per-attempt trusted code worker
  → validated outputs, routes, logs and committed state
```

The workbench owns editable drafts, navigation, undo and run inspection. The API normalises and validates requests, publishes immutable assets and emits update events. MCP tools/resources adapt the same guarded application model for compatible agents.

SQLite retains entities, versions, metadata, history and encrypted runtime material. The matching encryption key is part of the installation identity for recovery. Workspaces organise workflows and durable API scopes; reusable definitions and secrets remain shared.

## Snapshot at acceptance

Before enqueueing, the engine validates the saved graph and resolves its exact node, custom-type, executor and nested body dependencies. The queued run and snapshot are stored together. Later library or workflow publication does not replace that accepted code context.

Subflows expand into executable graphs with origin maps back to parent/nested nodes. Collection and Repeat invocations add their own item/iteration identity. The editor's presentation graph and executable snapshot remain related but distinct views.

A snapshot captures code and graph context, not the external world. Current secret values, host packages, executable availability, environment and provider responses are not immutable machine-image contents. Credentials resolve when each attempt begins and may rotate between attempts.

## Scheduling and persistence

Ordinary nodes respect all predecessors and OR control selection. Explicit early joins can admit downstream work before other branches finish; they do not cancel losing branches. The scheduler bounds concurrent ready tasks and local worker pools provide another capacity boundary.

Node-local state is staged through an attempt and commits only after successful output/route checks. Shared storage and variable mutations commit immediately in their own guarded transactions. Neither mechanism atomically coordinates an external provider action.

Durable waits and paused debugger sessions preserve encrypted continuations and release active execution capacity. Resume uses the same pinned snapshot and already completed nodes. Actively running arbitrary code at a crash is marked interrupted instead of silently replayed.

## Historical inspection

Retained historical snapshots expose the accepted workflow and definitions after the current canvas changes. Terminal retention removes the corresponding run data. Error reports and storage journals follow their originating run, while event/deduplication receipts have separate recovery purposes.

Use [run storage history](/wiki/run-storage-history/) for committed before/after transitions and [debugging](/wiki/debugging/) for node-boundary execution inspection. Read [security](/wiki/security/) before treating process separation or encrypted files as a multi-user isolation guarantee.

---

## Documentation provenance

- `docs/ARCHITECTURE.md`
- `docs/RUNTIMES-AND-WORKERS.md`
- `docs/DEBUGGING-AND-WAITS.md`

This page describes maintained source, not a live inventory or an authorization to perform actions.
