# jhugman/uniffi-bindgen-react-native architecture

> Architecture diagram of the GitHub repository jhugman/uniffi-bindgen-react-native, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jhugman/uniffi-bindgen-react-native
- Repository: https://github.com/jhugman/uniffi-bindgen-react-native

## Overview

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: [`crates/ubrn_cli/src/codegen/mod.rs`](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/crates/ubrn_cli/src/codegen/mod.rs) (Generator CLI), [`runtimes/core/src/module.rs`](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/runtimes/core/src/module.rs) (FFI module calls), [`channels/worker/src/receiver.ts`](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/channels/worker/src/receiver.ts) (Worker receiver), [`crates/ubrn_bindgen/src/bindings/gen_typescript/api_module/mod.rs`](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/crates/ubrn_bindgen/src/bindings/gen_typescript/api_module/mod.rs) (TypeScript bindings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gen["Binding generation"]
  node_cli["Generator CLI<br/>[mod.rs]"]
  node_config["Project config<br/>[mod.rs]"]
  node_tsgen["TypeScript bindings<br/>[mod.rs]"]
  node_rustgen["Rust bindings<br/>[mod.rs]"]
  node_cppgen["C++ bindings<br/>[mod.rs]"]
end

subgraph group_core["Shared runtime"]
  node_runtimecore["FFI module calls<br/>[module.rs]"]
  node_call["Call handling<br/>[call.rs]"]
  node_callback["Callback handling<br/>[callback.rs]"]
  node_spec["FFI specifications<br/>[spec.rs]"]
  node_tsruntime["TypeScript runtime<br/>[ffi-converters.ts]"]
end

subgraph group_targets["Platform runtimes"]
  node_jsi["React Native JSI<br/>[shim.cpp]"]
  node_wasm["WebAssembly runtime<br/>[callback.ts]"]
  node_napi["Node N-API runtime<br/>[lib.rs]"]
end

subgraph group_channel["Worker channel"]
  node_worker["Worker receiver<br/>[receiver.ts]"]
  node_workerplan["Worker call plans<br/>[plan.ts]"]
  node_workerregistry["Callback registry<br/>[registry.ts]"]
end

node_developer(("Rust developer"))
node_api["Rust API"]
node_generated["Generated bindings"]

node_developer -->|"defines"| node_api
node_developer -->|"runs"| node_cli
node_api -->|"generates from"| node_cli
node_cli -->|"uses"| node_config
node_cli -.->|"generates"| node_tsgen
node_cli -.->|"generates"| node_rustgen
node_cli -.->|"generates"| node_cppgen
node_tsgen -->|"emits"| node_generated
node_rustgen -->|"emits"| node_generated
node_cppgen -->|"emits"| node_generated
node_generated -->|"runs on"| node_jsi
node_generated -->|"runs on"| node_wasm
node_generated -->|"runs on"| node_napi
node_runtimecore -->|"uses"| node_call
node_runtimecore -->|"uses"| node_callback
node_runtimecore -->|"reads"| node_spec
node_tsruntime -->|"supports"| node_generated
node_jsi -->|"installs"| node_generated
node_wasm -->|"supports"| node_generated
node_napi -->|"supports"| node_generated
node_worker -->|"compiles"| node_workerplan
node_worker -.->|"uses"| node_workerregistry

click node_cli "https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/crates/ubrn_cli/src/codegen/mod.rs"
click node_config "https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/crates/ubrn_cli/src/config/mod.rs"
click node_tsgen "https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/crates/ubrn_bindgen/src/bindings/gen_typescript/api_module/mod.rs"
click node_rustgen "https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/crates/ubrn_bindgen/src/bindings/gen_rust/mod.rs"
click node_cppgen "https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/crates/ubrn_bindgen/src/bindings/gen_cpp/mod.rs"
click node_runtimecore "https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/runtimes/core/src/module.rs"
click node_call "https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/runtimes/core/src/call.rs"
click node_callback "https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/runtimes/core/src/callback.rs"
click node_spec "https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/runtimes/core/src/spec.rs"
click node_tsruntime "https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/typescript/src/ffi-converters.ts"
click node_jsi "https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/runtimes/jsi/cpp/shim.cpp"
click node_wasm "https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/runtimes/wasm/core/src/callback.ts"
click node_napi "https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/runtimes/napi/src/lib.rs"
click node_worker "https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/channels/worker/src/receiver.ts"
click node_workerplan "https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/channels/worker/src/plan.ts"
click node_workerregistry "https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/channels/worker/src/registry.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_config,node_tsgen,node_rustgen,node_cppgen toneBlue
class node_runtimecore,node_call,node_callback,node_spec,node_tsruntime toneAmber
class node_jsi,node_wasm,node_napi,node_api toneMint
class node_worker,node_workerplan,node_workerregistry toneRose
class node_developer,node_generated toneIndigo
```

## Components

### Binding generation

- [Generator CLI](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/crates/ubrn_cli/src/codegen/mod.rs): `crates/ubrn_cli/src/codegen/mod.rs`
- [Project config](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/crates/ubrn_cli/src/config/mod.rs): `crates/ubrn_cli/src/config/mod.rs`
- [TypeScript bindings](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/crates/ubrn_bindgen/src/bindings/gen_typescript/api_module/mod.rs): `crates/ubrn_bindgen/src/bindings/gen_typescript/api_module/mod.rs`
- [Rust bindings](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/crates/ubrn_bindgen/src/bindings/gen_rust/mod.rs): `crates/ubrn_bindgen/src/bindings/gen_rust/mod.rs`
- [C++ bindings](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/crates/ubrn_bindgen/src/bindings/gen_cpp/mod.rs): `crates/ubrn_bindgen/src/bindings/gen_cpp/mod.rs`

### Shared runtime

- [FFI module calls](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/runtimes/core/src/module.rs): `runtimes/core/src/module.rs`
- [Call handling](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/runtimes/core/src/call.rs): `runtimes/core/src/call.rs`
- [Callback handling](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/runtimes/core/src/callback.rs): `runtimes/core/src/callback.rs`
- [FFI specifications](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/runtimes/core/src/spec.rs): `runtimes/core/src/spec.rs`
- [TypeScript runtime](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/typescript/src/ffi-converters.ts): `typescript/src/ffi-converters.ts`

### Platform runtimes

- [React Native JSI](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/runtimes/jsi/cpp/shim.cpp): `runtimes/jsi/cpp/shim.cpp`
- [WebAssembly runtime](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/runtimes/wasm/core/src/callback.ts): `runtimes/wasm/core/src/callback.ts`
- [Node N-API runtime](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/runtimes/napi/src/lib.rs): `runtimes/napi/src/lib.rs`

### Worker channel

- [Worker receiver](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/channels/worker/src/receiver.ts): `channels/worker/src/receiver.ts`
- [Worker call plans](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/channels/worker/src/plan.ts): `channels/worker/src/plan.ts`
- [Callback registry](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/channels/worker/src/registry.ts): `channels/worker/src/registry.ts`

### Other components

- **Rust developer**
- **Rust API**
- **Generated bindings**

## Connections

- Rust developer → Rust API: defines
- Rust developer → Generator CLI: runs
- Rust API → Generator CLI: generates from
- Generator CLI → Project config: uses (evidence: `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 (evidence: `runtimes/core/src/module.rs`)
- FFI module calls → Callback handling: uses (evidence: `runtimes/core/src/module.rs`)
- FFI module calls → FFI specifications: reads (evidence: `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 (evidence: `channels/worker/src/receiver.ts`)
- Worker receiver → Callback registry: uses (evidence: `channels/worker/src/receiver.ts`)
