Photo by Mackenzie Cruz on Unsplash

Krabik: Making Rust Mobile Experiments Less Painful

I’ve been playing with Rust for a while, mostly with cli tools and web servers, my daily job is mostly about mobile development though.

I wanted to play more with Rust on Android and iOS but there was just one problem: every time I wanted to try something, I spent too much time setting up the project before I could actually start experimenting.

So I decided to build a tool to make that process easier. It’s called Krabik.

The setup is part of the problem

Getting Rust code running on a desktop is straightforward. Create a Cargo project, add a dependency, write some code, and run it.

Mobile development is a different story.

Android and iOS each have their own build systems, SDKs, project structures, and platform-specific requirements. When you want to share business logic written in Rust between the two platforms, you also need to think about native libraries, FFI bindings, and how everything fits together.

Everytime I would start with an idea, spend time configuring the project, work through the build setup, and only then get to experiment with Rust itself and that is painful.

I didn’t want to spend my limited experimentation time solving the same setup problems over and over again.

I wanted a shorter path from idea to experiment

The idea behind Krabik is simple: automate the repetitive parts of setting up and running a Rust-based mobile project.

I wanted to be able to create a project with a shared Rust core and native Android and iOS applications, then build and run it without manually connecting all the pieces every time.

That means handling things like:

  • Generating the initial Rust and native project structure.
  • Checking whether the development environment is configured correctly.
  • Managing Rust compilation targets for Android and iOS.
  • Building native Rust libraries and generating Kotlin or Swift bindings with UniFFI.
  • Launching emulators and simulators, then installing and running the app.
  • Rebuilding and relaunching the app while experimenting with Rust code.

With Krabik, the intended workflow is straightforward:

krabik doctor
krabik create my-app
cd my-app
krabik run

There is still a real mobile development toolchain underneath. Krabik doesn’t remove that complexity; it automates config.

Why Rust on mobile?

One thing I like about Rust is the idea of using the same language for both mobile and backend development. No need to switch between Kotlin, Swift, and another language on the server.

Rust is also fast, memory-safe, and doesn’t need a garbage collector. It runs on pretty much everything, from servers and phones to embedded devices.

There are a lot of interesting things to explore here: how to connect Rust with native code, how much logic can be shared, and what kind of architecture makes sense.

That’s also why I wanted to support both Android and iOS from the beginning. Even if I start with one platform, I want to be able to see how easily the same ideas carry over to the other.

A tool for my own workflow

Krabik started as a solution to my own problem. I wanted to make it easier to run Rust on mobile without initial ceremony.

It’s the same idea as Flutter - make start developing as painless as possible.

What’s next?

Krabik is an evolving project, and I expect it to change as I use it for more experiments and discover what else can be automated.

I plan to make UI library next, but that’s yet to decide.

For now, the focus is on making the basic workflow reliable: create a project, build it, run it on a device, and iterate on the Rust code.

If you’re also interested in experimenting with Rust on Android or iOS, you can check out the project on GitHub:

github.com/charafau/krabik

I’d be happy if it saves someone else some setup time, too.