Open-source project
redbadger/crux avatar
redbadger/crux

Crux: one side-effect-free Rust core, three shells, and a code generator with a rule

Cross-platform app development in Rust

2,856 stars117 forksRustApache-2.0

At a glance

What is it?
Crux puts application logic in a Rust core that cannot call anything outside itself, and links it into iOS, Android and browser shells with generated types. The dependency file carries an unusual constraint: the attribute generator and its helper have to come from the same git checkout or code generation stops.
Who is it for?
Crux suits a team that wants one behaviour core tested in Rust and shipped to several platforms, and the reasons are structural rather than promotional. The core cannot reach an external API, the shell is the only place effects run, and a test can stand in for the shell, which is why the project claims journey tests run in milliseconds with no fakes or mocks to maintain.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 3 days ago.
What is it written in?
Mainly Rust, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 22, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • redbadger/crux2,856 ★ · +109
Star history
Repository2026-09-302026-11-22
redbadger/crux2.7k2.9k

109 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The core cannot call anything outside itself, and the browser target is the reason

The side-effect-free rule is not a style guideline here, it is forced by one of the compilation targets. Because WebAssembly is a target, the core must stay pure, since a Wasm module runs in a sandbox with no access to external APIs. Everything the core can do is calculate and keep internal state. From there the same library is packaged three ways depending on the platform: a native static library with BoltFFI Swift bindings on iOS and macOS, a dynamic library with BoltFFI Kotlin bindings and native assets on Android, and a WebAssembly module in a browser. The stated consequence is that the core is isolated against software supply-chain attacks, since a component with no access to any external API has nothing to be tricked into calling. The UI side is expected to stay thin, written in SwiftUI, Jetpack Compose, React or Vue, or in a WebAssembly framework such as Leptos or Yew, and the boundary is typed rather than described: types and serialization code are generated for Swift, Kotlin and TypeScript, while a shell written in Rust imports the core directly.

Four types and one function are the entire interface

The component types follow the Elm architecture and the page names each one. `Event` is an enum describing the events the core can handle. `Model` describes the internal state of the application. `Effect` is the set of side-effects the core will request. `ViewModel` represents the information that should be displayed to the user. The first three are tied together by the `update` function, familiar from Elm, Redux and other event-sourcing shapes, and its signature is where the whole contract shows up:

```rust,ignore fn update( &self, event: Event, model: &mut Model, ) -> Command<Effect, Event> { // ... } ```

The function takes an event and a mutable model and returns a `Command` built from effects and events, which means a core never performs the work it requests; it describes the work and hands it outward. Effects themselves come in three shapes, fire-and-forget, request with a response, and streaming, so a single core can ask for a one-off side-effect, wait for an answer, or hold an open stream, without the interface changing shape per call.

Render is the only built-in capability and the visible list stops mid-entry

Capabilities are the reusable interfaces for common side-effects, offered to the core as a more ergonomic API than raw effects. The published set on the page has three entries and the third is cut off partway through. `Render` asks the UI to render the view model, is built into `crux_core`, is request only, and its source is given as a file path inside the core crate's capabilities directory. `Http` is a full HTTP implementation living in `crux_http`, published as its own crate, and is request and response. `KeyValue` is a basic key-value store API in `crux_kv`, and the sentence describing it ends without finishing. The workspace file shows more members than the list names: `crux_macros` and `crux_time` are both workspace members alongside the three capabilities above, and neither appears in the visible part of the page. The examples list is ordered as a progression, all six entries numbered one: a counter to get the basics, a counter with HTTP to see talking to an API, a weather app, notes for real-time collaboration, then a counter using middleware for Rust-side effects and a counter using effect routing for type-based per-effect dispatch.

A test can stand in for the shell, which is where the speed claim comes from

The testing section describes something more useful than a mocking guide. Tests can act as another shell, exercising the core the same way a real app would, observing and resolving the effects the core requests and then checking that the model and the view model came out right. Because the core is pure and the shell is the only place effects run, there is nothing to fake: no mocks, no stubs, and nothing that has to be kept in step with the real network. The performance claim follows from the same design, since the project says high-level user journey tests run in milliseconds rather than minutes or hours, because the expensive part of a mobile test, driving the device, is gone. Two workspace members support that story. `doctest_support` exists to let documentation examples run with a shell attached, and `examples_support/api_server` provides an API server for the example applications, so the examples are runnable rather than illustrative.

The attribute generator and its helper must come from one git checkout

The dependency file contains the longest comment in the project and it is about a failure mode rather than a feature. Two dependencies are taken from a git repository at revision `d9d4fc7b`: the generator itself and a crate holding its attributes. The comment explains why both must come from the same source rather than from the registry. The generator resolves the attributes crate by path inside its own checkout, so a registry copy alongside it becomes a second and unrelated `Attr` type, and the attribute that generation writes is then invisible to the code that reads it back, which fails generation with `bad attribute format`. Two commented-out lines show the alternative of using local paths inside a sibling checkout, and a third line is a to-do saying the generator should move to the published version 0.21 once it is available, at which point the coupling disappears. Until then, a lockfile update or a checkout that resolves one crate from git and the other from the registry produces a confusing error far from its cause.

Exact version pins, a git revision, and a Renovate file in the same repository

Three dependencies are held at exact versions with the equality operator, `facet` at 0.46.5, `uniffi_bindgen` at 0.29.4 and `boltffi` at 0.30.1, and a fourth pair comes from a git revision, which no registry update can move. Two binding generators therefore sit side by side, uniffi_bindgen for one path and BoltFFI for the bindings named on the page, and both are pinned hard. Next to that sits `renovate.json` in the root, which is the configuration for automated dependency updates, so the repository has machinery for moving versions forward while three of its most important dependencies cannot move without an edit. Other version surfaces agree with each other: `rust-toolchain.toml` pins the toolchain for the checkout, the workspace declares edition 2024 with `rust-version` 1.90 and resolver 3, and lints are set at workspace level with clippy pedantic and nursery as warnings and `unsafe_code` forbidden outright. Only the development profile is customised, with unpacked split debuginfo.

Pre-1.0, and a documentation order that starts with a book

The project sets expectations in a note rather than burying them. Crux is pre-1.0, occasional breaking API changes can be expected, and it is described as production-ready in the same paragraph, with a stated intention to limit the extent of those changes and provide a gradual migration path. Entry points are ordered by depth rather than by convenience. The suggested path is the book first, then the examples in order, with an introductory talk from Rust Nation 2023 as the alternative for people who would rather watch, then the API documentation on docs.rs, and a Zulip channel for questions. The book is where the Command API is explained, and the page defers to a specific chapter on managed effects rather than duplicating it. Development commands are not npm-style scripts either: the root carries a `Justfile` and a `lib.just`, so tasks are run through the `just` runner, and `release.md` documents the release process beside a changelog that the tree does not otherwise surface.

Editorial conclusion

Crux suits a team that wants one behaviour core tested in Rust and shipped to several platforms, and the reasons are structural rather than promotional. The core cannot reach an external API, the shell is the only place effects run, and a test can stand in for the shell, which is why the project claims journey tests run in milliseconds with no fakes or mocks to maintain. The cost is the shape of the change. The project states it is pre-1.0 and expects occasional breaking API changes, and the workspace pins `facet`, `uniffi_bindgen` and `boltffi` to exact versions while pulling the generator from a git revision, so a lockfile refresh is part of any upgrade. Read the book before the examples, because the examples are ordered as a progression from a counter to middleware and effect routing, and check the `rust-toolchain.toml` and the declared 1.90 floor before pinning a toolchain. The default branch was last pushed on 2026-10-02.

Frequently asked questions

What does Crux do with a Rust application?

It puts the business logic and behaviour in a single reusable Rust core and links that core into a thin shell per platform, on iOS and macOS as a static library with BoltFFI Swift bindings, on Android as a dynamic library with BoltFFI Kotlin bindings, and in a browser as a WebAssembly module. Types and serialization code are generated for Swift, Kotlin and TypeScript.

Is Crux a Rust framework for mobile app development?

It is a cross-platform architecture rather than a mobile UI framework. The mobile side is a shell written in SwiftUI or Jetpack Compose that renders a view model the Rust core produces, and the same core also compiles for the browser, which is why the core is required to stay free of side effects. The UI frameworks themselves are not part of this project.

How does Crux handle side effects such as HTTP calls?

The core captures the side effect as a value and the shell executes it, so the core never calls out itself. Effects come as `Event`, `Model` and `Effect` types tied together by an update function returning a Command, and effects support fire-and-forget, request and response, and streaming. Reusable interfaces for common effects are called capabilities, of which Render is the only one built into the core.

Do Crux tests need mocks or fakes?

No. Because tests can act as the shell, they exercise the core the same way a real app does, observe and resolve the requested effects and check the model and view model. That is also why the project says high-level user journey tests run in milliseconds rather than minutes or hours.

Can Rust target the browser with Crux?

Yes, the core is packaged as a WebAssembly module for the browser, and Leptos and Yew are named as suitable WebAssembly UI frameworks for that shell. That target is also the reason the core has to remain side-effect-free, since a Wasm runtime is sandboxed and cannot reach external APIs.

Official sources

  1. License: Apache-2.0
  2. Project website
  3. README
  4. redbadger/crux on GitHub
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/redbadger-crux.svg)](https://hysenlabs.com/projects/redbadger-crux)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/redbadger-crux.svg)](https://hysenlabs.com/projects/redbadger-crux)

Was this useful?