Introduction to tui-realm
maintui-realm is a framework built on top of ratatui designed for implementing stateful terminal user interfaces (TUIs). It follows an event-driven architecture inspired by React and Elm (specifically The Elm Architecture or TEA).
Core Architecture Pattern
The application lifecycle follows a continuous loop:
-> Event -> Msg -> Update -> View ->
Key Features
- Event-driven: Uses an
Event -> Msgapproach. Ports (event listeners like stdin or HTTP clients) produce Events, which are forwarded to Components to produce Messages. Messages then trigger logic in your application Model. - Component-based: Uses a Component concept (similar to React) where each component represents a UI instance with its own State and Properties.
- Automated Management: The View automatically manages component mounting/unmounting and handles focus management, ensuring only one
AppComponentis active at a time. - Adaptable: Provides advanced concepts like custom Ports and Subscriptions for complex use cases.