Architecture

Overview

Krust uses a two-layer architecture — a Rust core handles all Kubernetes operations, while Swift/SwiftUI provides the native macOS UI. This separation keeps data processing fast and memory-efficient while delivering a first-class desktop experience.

Rust Core (krust-core)

Built with the kube-rs crate, the Rust core handles all K8s API communication, watch streams, data processing, log buffering, and metrics caching. It compiles as a dynamic library (.dylib) that the Swift app loads at runtime.

UniFFI Bridge

Mozilla's UniFFI generates Swift bindings from Rust. The bridge provides type-safe FFI with automatic memory management. All Kubernetes data types are defined as UniFFI Records, ensuring safe, zero-overhead interop between the two languages.

Swift UI Layer

The UI layer combines multiple frameworks for optimal performance:

Data Flow

Data flows through a unidirectional pipeline: K8s API → Rust watcher → RwLock store → UniFFI → Swift ViewModel → SwiftUI view. List views use zero-copy snapshots from the Rust store, ensuring minimal memory overhead even with thousands of resources.

Key Dependencies