Skip to main content

What is Kraken TUI?

Kraken TUI is a high-performance terminal interface library that brings native speed to TypeScript development. Built with Rust at its core and exposed through elegant TypeScript bindings, it enables you to create polished, interactive terminal applications without sacrificing performance or developer experience.
Experimental - Pre-GA: Kraken TUI is currently in active development. v1 (themes + animation) is complete, and v2 (native state hardening, JSX reconciler, accessibility foundation) is implemented. Not recommended for production use yet.

Key Features

Native Performance

Rust-powered core handles all layout, rendering, and event processing. Memory footprint under 20MB for 100 widgets.

Familiar Layout

Flexbox-based layout system using Taffy. Write layouts with the same mental model as CSS Flexbox.

Rich Widgets

Pre-built composable widgets: Box, Text, Input, Select, ScrollBox, and TextArea with markdown and syntax highlighting.

Dual APIs

Choose between imperative API for direct control or JSX with signals for reactive, declarative interfaces.

Smooth Animation

Built-in animation system with easing functions, property transitions, and choreography groups.

Full Input Support

Keyboard focus traversal, mouse events (click, scroll, hit-testing), and comprehensive event handling.

Theming System

Runtime theme switching with built-in dark/light themes. Define custom themes with per-widget-type defaults.

Cross-Platform

Works on macOS, Linux, and Windows with automatic terminal capability detection and graceful degradation.

Architecture at a Glance

Kraken TUI follows a Modular Monolith with Cross-Language Facade pattern:
TypeScript/Bun Layer (thin command client)

         │ 97 FFI functions via bun:ffi

Rust Native Core (performance engine)
  ├─ Tree Module      → Widget composition & handle allocation
  ├─ Layout Module    → Flexbox constraint resolution (Taffy)
  ├─ Style Module     → Color resolution & text decoration
  ├─ Theme Module     → Named style defaults & inheritance
  ├─ Animation Module → Timed property transitions
  ├─ Text Module      → Markdown & syntax highlighting
  ├─ Render Module    → Double-buffered cell grid & dirty diffing
  ├─ Event Module     → Input capture & focus management
  └─ Terminal Module  → Cross-platform I/O (crossterm)

Core Invariant

Rust is the performance engine; TypeScript is the steering wheel.
  • All mutable state lives in Rust — layout, rendering, events, text parsing
  • TypeScript holds opaque handlesu32 references to native widgets
  • Unidirectional control flow — TypeScript calls Rust, never the reverse
  • Zero business logic in TypeScript — only ergonomic API wrappers

Design Principles

Performance First

  • < 50ms input latency from keystroke to screen update
  • < 16ms render budget for 60fps capable rendering
  • Incremental rendering with dirty-flag diffing (only changed regions recompute)
  • Bounded memory with LRU caching for text parsing/highlighting

Developer Experience

  • < 15 minutes to Hello World for TypeScript developers
  • Composable widget system with familiar Flexbox layout
  • Type-safe API with full TypeScript definitions
  • Choose your style: imperative or declarative (JSX + signals)

Production Ready (Soon)

  • Graceful error handling at the FFI boundary with typed exceptions
  • Cross-platform terminal abstraction with capability detection
  • Observable with performance counters and debug logging
  • Semantic versioning guarantees beginning at public v1.0 GA

When to Use Kraken TUI

Perfect for:
  • Interactive CLI tools and wizards
  • Real-time dashboards and monitoring tools
  • Terminal-based development tools
  • System administration interfaces
  • CI/CD status displays
  • AI agent terminal interfaces
Not ideal for:
  • Simple one-shot CLI commands (use plain console output)
  • Applications requiring web browser compatibility
  • Production systems (wait for v1.0 GA)
  • Windows-only deployments without terminal emulator support

Project Status

Current Version: 0.1.0 (Pre-GA)
  • v0 Complete: Widget composition, Flexbox layout, rich text, keyboard/mouse input
  • v1 Complete: Animation system, theming foundation with dark/light built-ins
  • v2 Complete: Safe state management, tree operations, JSX reconciler, TextArea, accessibility foundation
  • 🚧 v3 In Progress: Writer optimization, text cache, dashboard widgets, editor extensions

Community & Support

Kraken TUI is open source under the Apache License 2.0.
  • Repository: GitHub (check source for actual link)
  • Documentation: You’re reading it!
  • Issues & Discussions: GitHub Issues
  • License: Apache License 2.0

Next Steps

Installation

Install Kraken TUI and build the native core

Quickstart

Build your first interactive terminal app in minutes

Build docs developers (and LLMs) love