crux  by redbadger

Rust SDK for cross-platform app development with shared core logic

Created 3 years ago
2,321 stars

Top 19.4% on SourcePulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

Crux enables cross-platform application development by sharing a Rust-based business logic core across mobile (iOS/Android) and web targets. It targets developers seeking to maximize code reuse for application behavior while leveraging native or declarative UI frameworks like SwiftUI, Jetpack Compose, or React/Vue. This approach aims to reduce development time and improve consistency by centralizing complex logic in a single, testable Rust codebase.

How It Works

Crux employs an architecture inspired by Elm, strictly separating pure computational logic from side effects. The Rust core is compiled into platform-specific libraries (static library for iOS, dynamic library via JNI for Android, WebAssembly for web). Side effects, such as API calls or time-based operations, are managed by the core as explicit Effect requests, which are then executed by the platform-specific "Shell." This isolation makes the core side-effect-free, enabling fast, high-level user journey tests without needing mocks or stubs. Communication between the core and shell is message-based, with type generation ensuring static type checking across languages for events, models, and effects.

Quick Start & Requirements

  • Install/Run: Follow the "Getting Started" guide for project setup.
  • Prerequisites: Rust toolchain, platform-specific SDKs (iOS, Android, Web).
  • Resources: Project setup involves compiling Rust code and integrating with platform UI projects.
  • Links: Introductory Talk, Book, API Docs, Zulip Community

Highlighted Details

  • Managed Effects: Side effects are captured as values, allowing for portable and testable core logic.
  • Type Generation: Static type checking across Rust, Swift, Kotlin, and TypeScript for core interfaces.
  • Elm Architecture: Utilizes Event, Model, Effect, and ViewModel components with an update function for state management.
  • WebAssembly Target: Core logic can be compiled to Wasm, ensuring isolation and security.

Maintenance & Community

Crux is actively developed and sponsored by Red Badger Consulting Limited. A Zulip community channel is available for discussion.

Licensing & Compatibility

The project appears to be licensed under the MIT license, allowing for commercial use and integration with closed-source applications.

Limitations & Caveats

Crux is pre-1.0 and under active development, meaning occasional breaking API changes may occur. The Capability API is being deprecated in favor of a new Command API, indicating ongoing architectural evolution.

Health Check
Last Commit

3 weeks ago

Responsiveness

1 day

Pull Requests (30d)
9
Issues (30d)
3
Star History
53 stars in the last 30 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Ishaan Jaffer Ishaan Jaffer(Cofounder of LiteLLM), and
10 more.

llama-stack by llamastack

0.2%
8k
Composable building blocks for Llama apps
Created 1 year ago
Updated 2 days ago
Feedback? Help us improve.