Core Mental Model
Rezi applications follow a simple unidirectional data flow:Declarative UI with VNodes
You describe what the UI should look like, not how to draw it:ui.* function returns a VNode (virtual node) — a lightweight plain object describing a widget. The framework automatically:
- Reconciles changes between renders
- Computes optimal layout
- Generates minimal terminal output
- Routes user input to the correct widgets
State-Driven Rendering
Your application state is the single source of truth:useEffect hooks.
Why Rezi?
Compared to Ink (React for CLIs)
- No React runtime overhead — Rezi’s reconciliation is purpose-built for TUIs
- Native rendering engine — C-based Zireael engine handles terminal I/O
- Deterministic rendering — Same input always produces same output
- Type-safe by default — Full TypeScript support without React’s type complexity
Compared to Bubble Tea (Go)
- TypeScript ecosystem — Leverage npm packages and Node.js tooling
- Declarative widgets — No manual layout calculations or cursor positioning
- Built-in components — Rich widget library (tables, modals, forms, charts)
- Hot module reload — Instant feedback during development
Compared to Textual (Python)
- Performance — Binary protocol and native engine for 60 FPS rendering
- Smaller footprint — No Python runtime or CSS engine overhead
- Functional composition — Compose UIs from pure functions and hooks
Key Features
Rich Widget Library
60+ built-in widgets covering common UI patterns:- Layout:
box,row,column,grid,splitPane - Input:
button,input,select,checkbox,slider - Data:
table,virtualList,tree,fileTreeExplorer - Feedback:
modal,toast,progress,spinner - Charts:
barChart,lineChart,sparkline,gauge
Flexible Composition
Build reusable components with local state:Powerful Keybindings
Global shortcuts, modal modes, and chord sequences:Advanced Focus Management
- Automatic Tab/Shift+Tab navigation
- Focus zones for grouped widgets
- Focus traps for modal dialogs
- Mouse click focus support
Binary Protocol Architecture
Rezi uses versioned binary protocols for communication between TypeScript and the native engine:- ZRDL (drawlists): Rendering commands flowing down to the engine
- ZREV (event batches): Input events flowing up from the engine
- Deterministic rendering: Same state produces same output
- Cross-platform consistency: No terminal quirks leak into app logic
- Future-proof: Protocol versioning enables backward compatibility
Runtime Stack
Rezi is organized into layers:- @rezi-ui/core: Runtime-agnostic UI logic (no Node.js APIs)
- @rezi-ui/node: Node.js/Bun backend integration
- @rezi-ui/native: N-API addon exposing the Zireael engine
- Zireael: High-performance C engine for terminal rendering
Quick Example
Here’s a complete counter app:Next Steps
Architecture
Learn about the full stack from TypeScript to the C engine
Widgets
Explore the VNode system and built-in widgets
Composition
Build reusable components with defineWidget
Lifecycle
Master app lifecycle and state updates