bridgerust

Crates.iobridgerust
lib.rsbridgerust
version0.1.2
created_at2026-01-05 08:13:14.033009+00
updated_at2026-01-13 14:59:57.908764+00
descriptionWrite Rust once, deploy to Python and Node.js
homepagehttps://bridgerust.dev
repositoryhttps://github.com/bridgerust/bridgerust
max_upload_size
id2023396
size35,097
KOLOGO B Josias Yannick (dev-josias)

documentation

README

BridgeRust

Write Rust once, deploy to Python and Node.js.

BridgeRust is a unified framework for building cross-language Rust libraries. It eliminates the complexity of managing separate bindings for PyO3 (Python) and napi-rs (Node.js) by providing a single, unified macro system.

Website: bridgerust.dev

🚀 Features

  • Unified Logic: One #[bridgerust::export] macro handles both Python and Node.js generation.
  • Zero Config: No need to manually configure PyO3 or napi-rs builds.
  • Type Safety: Automatic type mapping between Rust, Python, and TypeScript.

🎯 Best Use Cases

BridgeRust is currently SDK-Ready and ideal for:

  1. Unified SDKs / Clients: Perfect for database drivers (like Embex) or API clients. Seamlessly handles async/await and complex JSON objects.
  2. CPU-Intensive Data Processing: Expose high-performance Rust logic (parsers, encryption, image processing) to interpreted languages with minimal overhead.
  3. Shared Logic Cores: Write business validation rules once in Rust structs/enums and reuse them across your Node.js backend and Python data pipelines.

📦 Usage

Add to your Cargo.toml:

[dependencies]
bridgerust = "0.1"

Annotate your Rust functions:

use bridgerust::export;

#[export]
pub fn greet(name: String) -> String {
    format!("Hello, {}!", name)
}

🏗️ Building

BridgeRust creates standard Python wheels and Node.js native modules.

Using the CLI (Recommended)

# Install the CLI
cargo install --path cli/bridge

# Initialize a new project
bridge init my-project

# Build for all targets
bridge build --all

# Run tests
bridge test --all

# Publish packages
bridge publish --all

Manual Building

# Build for Python
cargo build --features python

# Build for Node.js
cargo build --features nodejs

📚 Documentation

🎯 Quick Example

use bridgerust::export;

#[export]
pub fn greet(name: String) -> String {
    format!("Hello, {}!", name)
}

#[export]
pub struct Point {
    pub x: f64,
    pub y: f64,
}

Build and use from both Python and Node.js with a single command!

Commit count: 132

cargo fmt