whatisgithub

What is uniffi-rs?

mozilla/uniffi-rs — explained in plain English

Analysis updated 2026-06-26

4,588RustAudience · developerComplexity · 4/5Setup · hard

In one sentence

UniFFI is Mozilla's tool that lets you write core logic once in Rust and automatically generates the code needed to call it from Kotlin, Swift, Python, or other languages.

Mindmap

mindmap
  root((uniffi-rs))
    What it does
      Generate language bindings
      Rust core to other langs
      Auto bridging code
    Supported languages
      Kotlin and Swift
      Python and Ruby
      Community Go C# Dart
    How it works
      UDL interface file
      Rust proc-macro annotations
      Shared library compile
    Use cases
      Mobile SDK sharing
      Firefox for Android iOS
      Cross-platform libraries
    Audience
      Rust developers
      Mobile engineers
      SDK authors
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Write shared business logic in Rust once and use UniFFI to expose it to both Android (Kotlin) and iOS (Swift) without writing bridge code by hand.

USE CASE 2

Generate Python or Ruby bindings for a Rust library so data-science or scripting teams can use high-performance Rust code from their preferred language.

USE CASE 3

Build a cross-platform mobile SDK in Rust that ships native bindings for multiple languages from a single codebase.

USE CASE 4

Use UniFFI in a Firefox-like project where a Rust core needs to be called from platform-specific language layers.

What is it built with?

RustKotlinSwiftPythonRuby

How does it compare?

mozilla/uniffi-rsgreenbone/openvas-scannerplotters-rs/plotters
Stars4,5884,5954,576
LanguageRustRustRust
Setup difficultyhardhardeasy
Complexity4/54/53/5
Audiencedeveloperops devopsdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1h+

Requires a working Rust toolchain plus the target language SDK (Android NDK for Kotlin, Xcode for Swift), multi-step build pipeline.

Open source (Mozilla project), check repository for the exact license, suitable for production use including commercial mobile apps.

So what is it?

UniFFI is a tool built by Mozilla that solves a specific cross-platform development problem: you write your core logic once in Rust, and UniFFI automatically generates the glue code needed to call that logic from other programming languages like Kotlin, Swift, Python, or Ruby. The practical use case at Mozilla is Firefox for mobile devices. The core browser functionality is written in Rust, and UniFFI generates the bindings that let Android apps call that code through Kotlin and iOS apps call it through Swift. Without a tool like this, developers would have to write and maintain that bridging code by hand for each language, which is tedious and error-prone. The way it works is that you describe your Rust code's public interface in either a dedicated definition file (using a language UniFFI calls UDL) or by adding special annotations directly to your Rust code. UniFFI then reads that description and generates the appropriate bindings files for whichever target languages you need. It also compiles your Rust code into a shared library that the generated bindings can load. Beyond the officially supported languages, the community has built additional bindings for Go, C#, Dart, Java, JavaScript, and Node.js. There are also third-party plugins and helper tools for workflows like building Swift packages or integrating with Android's build system. Mozilla considers UniFFI ready for production use, though it has not reached a 1.0 release and may make breaking changes in more advanced usage over time. The project is open-source, welcomes contributions, and has a community chat room on Matrix. The name is pronounced to rhyme with "unify" and stands for Uniform Foreign Function Interface.

Copy-paste prompts

Prompt 1
I have a Rust library that does JSON parsing. Using UniFFI, show me how to write a UDL file that exposes a parse function taking a string and returning a struct, then generate Kotlin bindings for Android.
Prompt 2
Show me a minimal UniFFI project layout in Rust: Cargo.toml, a UDL interface definition, and the Rust implementation, targeting Swift bindings for iOS.
Prompt 3
I want to call my Rust library from Python using UniFFI. Walk me through the steps: annotate the Rust code, build the shared library, generate bindings, and call a function from a Python script.
Prompt 4
Explain the difference between defining a UniFFI interface using a UDL file vs using proc-macro annotations directly in Rust code. When should I choose each approach?
Prompt 5
My UniFFI-generated Kotlin bindings compile but crash at runtime when loading the native library. What are the most common causes and how do I debug them on Android?

Frequently asked questions

What is uniffi-rs?

UniFFI is Mozilla's tool that lets you write core logic once in Rust and automatically generates the code needed to call it from Kotlin, Swift, Python, or other languages.

What language is uniffi-rs written in?

Mainly Rust. The stack also includes Rust, Kotlin, Swift.

What license does uniffi-rs use?

Open source (Mozilla project), check repository for the exact license, suitable for production use including commercial mobile apps.

How hard is uniffi-rs to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is uniffi-rs for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.