UniFFI

A multi-language bindings generator that exposes Rust code to Kotlin, Swift, Python, and Ruby.

Tool
Cargo
v0.32.0
4,877stars
Mozilla Public License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
78/100Good
Development Activity96
Maintenance52
Community64
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
83/100Excellent
Architecture90
Code Quality86
Innovation88
Learning Curve68

UniFFI is a toolkit from Mozilla for building cross-platform software components in Rust. You write your core business logic once in Rust, describe its interface with an object model (via proc-macros or a UDL interface file), and UniFFI compiles the code into a shared library and auto-generates idiomatic bindings for multiple target languages.

UniFFI ships first-class support for Kotlin, Swift, Python, and Ruby, with third-party bindings available for C# and Go. It is used extensively inside Firefox to share a single Rust implementation across Android (Kotlin) and iOS (Swift) apps, and is considered production-ready.

What You Get

  • Automatic generation of Kotlin, Swift, Python, and Ruby bindings from Rust code
  • Two ways to describe your interface: proc-macros or a UDL definition file
  • A generated FFI scaffolding layer that handles safe cross-language calls
  • The uniffi-bindgen CLI plus build helpers for integrating generation into your workflow

Common Use Cases

  • Sharing one Rust implementation across Android (Kotlin) and iOS (Swift) apps
  • Exposing a Rust library to Python or Ruby without hand-writing FFI glue
  • Shipping cross-platform mobile components with a single core codebase

Under The Hood

Architecture - UniFFI is a Cargo workspace of cooperating crates: uniffi is the umbrella crate (with a cli module and lib.rs), uniffi_macros/uniffi_internal_macros provide the proc-macros, uniffi_udl/weedle2/uniffi_parse_rs parse the interface definitions, uniffi_meta models the interface metadata, uniffi_bindgen runs the code-generation pipeline (uniffi_pipeline), uniffi_core provides the runtime FFI primitives, and uniffi_build integrates generation into Cargo builds. Language backends emit Kotlin, Swift, Python, and Ruby.

Tech Stack - Rust (edition 2021) built with Cargo. Dependencies include anyhow for error handling, camino for UTF-8 paths, cargo_metadata for workspace introspection, and clap (color-free) for the bindgen CLI; templates drive the generated foreign code.

Code Quality - The project is mature and heavily tested, with dedicated fixtures/, bindgen-tests/, and examples/ trees exercising round-trip generation across languages, plus a maintained CHANGELOG and versioning policy documented in docs/. Strict inter-crate version pinning (=0.32.0) signals disciplined release management.

API Design - Consumers annotate Rust with ergonomic proc-macros or write a concise UDL file, then invoke uniffi-bindgen; the generated bindings are idiomatic in each target language. The learning curve is moderate given FFI concepts and build wiring, but the user guide and examples smooth onboarding.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search