How jhugman/uniffi-bindgen-react-native works
This repository generates TypeScript bindings that let Rust APIs run from React Native, web, and Node.js. The user-facing path is to describe an API in Rust, invoke the generator for a target, and use the generated bindings with that target’s runtime. The map also shows shared FFI support and the worker channel. Relationships among generator and runtime internals are limited to documented capabilities or references in the supplied source index; unsampled implementations are represented only where the tree and README establish their role.
Main entry points: codegen/mod.rs Generator CLI · module.rs FFI module calls · receiver.ts Worker receiver · api_module/mod.rs TypeScript bindings
Components 19
Binding generation
- Generator CLI
crates/ubrn_cli/src/codegen/mod.rs - Project config
crates/ubrn_cli/src/config/mod.rs - TypeScript bindings
crates/ubrn_bindgen/src/bindings/gen_typescript/api_module/mod.rs - Rust bindings
crates/ubrn_bindgen/src/bindings/gen_rust/mod.rs - C++ bindings
crates/ubrn_bindgen/src/bindings/gen_cpp/mod.rs
Shared runtime
- FFI module calls
runtimes/core/src/module.rs - Call handling
runtimes/core/src/call.rs - Callback handling
runtimes/core/src/callback.rs - FFI specifications
runtimes/core/src/spec.rs - TypeScript runtime
typescript/src/ffi-converters.ts
Platform runtimes
- React Native JSI
runtimes/jsi/cpp/shim.cpp - WebAssembly runtime
runtimes/wasm/core/src/callback.ts - Node N-API runtime
runtimes/napi/src/lib.rs
Worker channel
- Worker receiver
channels/worker/src/receiver.ts - Worker call plans
channels/worker/src/plan.ts - Callback registry
channels/worker/src/registry.ts
Other components
- Rust developer
- Rust API
- Generated bindings
Connections 22
- Rust developer → Rust API: defines
- Rust developer → Generator CLI: runs
- Rust API → Generator CLI: generates from
- Generator CLI → Project config: uses
crates/ubrn_cli/src/codegen/mod.rs - Generator CLI → TypeScript bindings: generates
- Generator CLI → Rust bindings: generates
- Generator CLI → C++ bindings: generates
- TypeScript bindings → Generated bindings: emits
- Rust bindings → Generated bindings: emits
- C++ bindings → Generated bindings: emits
- Generated bindings → React Native JSI: runs on
- Generated bindings → WebAssembly runtime: runs on
- Generated bindings → Node N-API runtime: runs on
- FFI module calls → Call handling: uses
runtimes/core/src/module.rs - FFI module calls → Callback handling: uses
runtimes/core/src/module.rs - FFI module calls → FFI specifications: reads
runtimes/core/src/module.rs - TypeScript runtime → Generated bindings: supports
- React Native JSI → Generated bindings: installs
- WebAssembly runtime → Generated bindings: supports
- Node N-API runtime → Generated bindings: supports
- Worker receiver → Worker call plans: compiles
channels/worker/src/receiver.ts - Worker receiver → Callback registry: uses
channels/worker/src/receiver.ts