# expo/exact architecture

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

- Interactive diagram: https://gitdiagram.com/expo/exact
- Repository: https://github.com/expo/exact

## Overview

Exact is a cross-platform application runtime: developers describe UI in Contract and provide application logic in TypeScript or Rust; the same compiled plan is presented by browser or native hosts. The graph follows compilation through execution and rendering, with storage, motion, and agent-driven operation as distinct capabilities. Several links reflect explicit README architecture statements; sampled source confirms selected internal relationships, but much of the runtime and platform wiring was not inspected.

Main entry points: [`runner/src/runner/query.rs`](https://github.com/expo/exact/blob/main/runner/src/runner/query.rs) (Native runner), [`host/web-js/src/main.rs`](https://github.com/expo/exact/blob/main/host/web-js/src/main.rs) (Web runtime), [`host/web/storage-fs.js`](https://github.com/expo/exact/blob/main/host/web/storage-fs.js) (Browser storage), [`apps/design-tool/app.ts`](https://github.com/expo/exact/blob/main/apps/design-tool/app.ts) (Contract source)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["App authoring"]
  node_contract["Contract source<br/>[app.ts]"]
  node_app_logic["App logic<br/>[app.ts]"]
end

subgraph group_compile["Contract compilation"]
  node_contract_syntax["Contract syntax<br/>[routes.rs]"]
  node_contract_types["Contract types<br/>[routes.rs]"]
  node_contract_lower["Plan lowering<br/>[routes.rs]"]
end

subgraph group_runtime["Plan runtime"]
  node_plan["Compact plan"]
  node_web_runtime["Web runtime<br/>[main.rs]"]
  node_native_runner["Native runner<br/>[query.rs]"]
  node_js_engine["Logic engine<br/>[engine.rs]"]
end

subgraph group_presentation["Layout and presentation"]
  node_layout_kernel["Layout kernel<br/>[engine.rs]"]
  node_web_host["Browser host<br/>[routes.js]"]
  node_apple_host["Apple host"]
  node_linux_host["Linux host<br/>[app.rs]"]
  node_gpu_renderer["GPU renderer<br/>[pipeline.rs]"]
end

subgraph group_capabilities["Runtime capabilities"]
  node_motion["Motion engine<br/>[engine.rs]"]
  node_web_storage[("Browser storage<br/>[storage-fs.js]")]
  node_storage_environment["Storage environment"]
  node_image_transform["Image transforms<br/>[storage-image.js]"]
  node_world_storage[("Game world storage<br/>[storage.rs]")]
end

node_developer(("App developer"))
node_agent(("Coding agent"))

node_developer -->|"writes UI"| node_contract
node_developer -->|"writes logic"| node_app_logic
node_contract -->|"parses"| node_contract_syntax
node_contract_syntax -->|"checks types"| node_contract_types
node_contract_types -->|"lowers"| node_contract_lower
node_contract_lower -->|"produces plan"| node_plan
node_plan -->|"executes in"| node_web_runtime
node_plan -->|"executes in"| node_native_runner
node_app_logic -->|"runs after first frame"| node_js_engine
node_native_runner -->|"computes layout"| node_layout_kernel
node_web_runtime -->|"drives DOM"| node_web_host
node_native_runner -->|"presents natively"| node_apple_host
node_native_runner -->|"presents natively"| node_linux_host
node_native_runner -.->|"draws with GPU"| node_gpu_renderer
node_native_runner -.->|"samples motion"| node_motion
node_web_storage -->|"reads settings"| node_storage_environment
node_web_storage -->|"loads on demand"| node_image_transform
node_agent -.->|"drives app"| node_web_runtime

click node_contract "https://github.com/expo/exact/blob/main/apps/design-tool/app.ts"
click node_app_logic "https://github.com/expo/exact/blob/main/apps/agents/app.ts"
click node_contract_syntax "https://github.com/expo/exact/blob/main/contract/syntax/src/routes.rs"
click node_contract_types "https://github.com/expo/exact/blob/main/contract/types/src/routes.rs"
click node_contract_lower "https://github.com/expo/exact/blob/main/contract/lower/src/routes.rs"
click node_web_runtime "https://github.com/expo/exact/blob/main/host/web-js/src/main.rs"
click node_native_runner "https://github.com/expo/exact/blob/main/runner/src/runner/query.rs"
click node_js_engine "https://github.com/expo/exact/blob/main/js/src/engine.rs"
click node_layout_kernel "https://github.com/expo/exact/blob/main/kernel/src/style/engine.rs"
click node_web_host "https://github.com/expo/exact/blob/main/host/web/navigation/routes.js"
click node_apple_host "https://github.com/expo/exact/blob/main/host/apple/Sources/ExactKit/RegionController.swift"
click node_linux_host "https://github.com/expo/exact/blob/main/host/linux/src/app.rs"
click node_gpu_renderer "https://github.com/expo/exact/blob/main/game/render/src/pipeline.rs"
click node_motion "https://github.com/expo/exact/blob/main/motion/src/engine.rs"
click node_web_storage "https://github.com/expo/exact/blob/main/host/web/storage-fs.js"
click node_storage_environment "https://github.com/expo/exact/blob/main/host/web/storage-environment.js"
click node_image_transform "https://github.com/expo/exact/blob/main/host/web/storage-image.js"
click node_world_storage "https://github.com/expo/exact/blob/main/game/engine/src/storage.rs"

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_contract,node_app_logic toneBlue
class node_contract_syntax,node_contract_types,node_contract_lower toneAmber
class node_plan,node_web_runtime,node_native_runner,node_js_engine toneMint
class node_layout_kernel,node_web_host,node_apple_host,node_linux_host,node_gpu_renderer toneRose
class node_motion,node_web_storage,node_storage_environment,node_image_transform,node_world_storage,node_developer,node_agent toneIndigo
```

## Components

### App authoring

- [Contract source](https://github.com/expo/exact/blob/main/apps/design-tool/app.ts): `apps/design-tool/app.ts`
- [App logic](https://github.com/expo/exact/blob/main/apps/agents/app.ts): `apps/agents/app.ts`

### Contract compilation

- [Contract syntax](https://github.com/expo/exact/blob/main/contract/syntax/src/routes.rs): `contract/syntax/src/routes.rs`
- [Contract types](https://github.com/expo/exact/blob/main/contract/types/src/routes.rs): `contract/types/src/routes.rs`
- [Plan lowering](https://github.com/expo/exact/blob/main/contract/lower/src/routes.rs): `contract/lower/src/routes.rs`

### Plan runtime

- **Compact plan**
- [Web runtime](https://github.com/expo/exact/blob/main/host/web-js/src/main.rs): `host/web-js/src/main.rs`
- [Native runner](https://github.com/expo/exact/blob/main/runner/src/runner/query.rs): `runner/src/runner/query.rs`
- [Logic engine](https://github.com/expo/exact/blob/main/js/src/engine.rs): `js/src/engine.rs`

### Layout and presentation

- [Layout kernel](https://github.com/expo/exact/blob/main/kernel/src/style/engine.rs): `kernel/src/style/engine.rs`
- [Browser host](https://github.com/expo/exact/blob/main/host/web/navigation/routes.js): `host/web/navigation/routes.js`
- [Apple host](https://github.com/expo/exact/blob/main/host/apple/Sources/ExactKit/RegionController.swift): `host/apple/Sources/ExactKit/RegionController.swift`
- [Linux host](https://github.com/expo/exact/blob/main/host/linux/src/app.rs): `host/linux/src/app.rs`
- [GPU renderer](https://github.com/expo/exact/blob/main/game/render/src/pipeline.rs): `game/render/src/pipeline.rs`

### Runtime capabilities

- [Motion engine](https://github.com/expo/exact/blob/main/motion/src/engine.rs): `motion/src/engine.rs`
- [Browser storage](https://github.com/expo/exact/blob/main/host/web/storage-fs.js): `host/web/storage-fs.js`
- [Storage environment](https://github.com/expo/exact/blob/main/host/web/storage-environment.js): `host/web/storage-environment.js`
- [Image transforms](https://github.com/expo/exact/blob/main/host/web/storage-image.js): `host/web/storage-image.js`
- [Game world storage](https://github.com/expo/exact/blob/main/game/engine/src/storage.rs): `game/engine/src/storage.rs`

### Other components

- **App developer**
- **Coding agent**

## Connections

- App developer → Contract source: writes UI
- App developer → App logic: writes logic
- Contract source → Contract syntax: parses
- Contract syntax → Contract types: checks types
- Contract types → Plan lowering: lowers
- Plan lowering → Compact plan: produces plan
- Compact plan → Web runtime: executes in
- Compact plan → Native runner: executes in
- App logic → Logic engine: runs after first frame
- Native runner → Layout kernel: computes layout
- Web runtime → Browser host: drives DOM
- Native runner → Apple host: presents natively
- Native runner → Linux host: presents natively
- Native runner → GPU renderer: draws with GPU
- Native runner → Motion engine: samples motion
- Browser storage → Storage environment: reads settings (evidence: `host/web/storage-fs.js`)
- Browser storage → Image transforms: loads on demand (evidence: `host/web/storage-fs.js`)
- Coding agent → Web runtime: drives app
