expo-modules-rs 0.1.1

Rust SDK for writing Expo native modules via direct JSI integration
Documentation

expo-modules-rs

Rust SDK for writing Expo native modules that integrate directly with the JavaScript Interface (JSI) runtime.

This crate provides:

  • The ExpoModule trait and ModuleBuilder for defining modules
  • JsValue types and conversion traits (FromJsValue, IntoJsValue)
  • The cxx bridge to the JSI C++ layer
  • The #[expo_module] and #[derive(ExpoRecord)] proc macros

Architecture

+---------------+     +----------------+     +----------------+
|  JavaScript   |---->|   JSI (C++)    |---->|  Rust Module   |
|   (Hermes)    |<----|  jsi_shim.cpp  |<----|  (your crate)  |
+---------------+     +----------------+     +----------------+
        |                    |                      |
   JS calls             cxx bridge             ExpoModule
   module.fn()          FfiValue               trait impl

Quick Start

use expo_modules_rs::prelude::*;

struct MathModule;

#[expo_module("RustMath")]
impl MathModule {
    #[constant]
    const PI: f64 = std::f64::consts::PI;

    fn add(a: f64, b: f64) -> f64 {
        a + b
    }
}