crux  by redbadger

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

created 2 years ago
2,042 stars

Top 22.2% on sourcepulse

GitHubView on GitHub
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

2 days ago

Responsiveness

Inactive

Pull Requests (30d)
18
Issues (30d)
0
Star History
109 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Taranjeet Singh Taranjeet Singh(Cofounder of Mem0), and
1 more.

fragments by e2b-dev

0.6%
6k
Next.js template for AI-generated apps
created 1 year ago
updated 1 week ago
Feedback? Help us improve.