Skip to content

Quick Start

import { Tabs, TabItem } from ‘@astrojs/starlight/components’;

BridgeRust makes it easy to write high-performance Rust libraries for Python and Node.js.

  • Rust: Install from rustup.rs
  • Python: 3.7+ (for Python bindings)
  • Node.js: 14+ (for Node.js bindings)

The bridge CLI is your main tool for creating and managing BridgeRust projects.

Terminal window
cargo install bridge
bridge --version

Generate a new project with the default template.

Terminal window
bridge new my-library
cd my-library

This creates a project structure ready for both Python and Node.js.

Open src/lib.rs and define your exposed API using the #[bridge] macro.

use bridgerust::prelude::*;
#[bridge]
pub fn add(a: i32, b: i32) -> i32 {
a + b
}

Use the live development server to watch for changes and rebuild automatically.

Terminal window
bridge dev

To build release artifacts:

Terminal window
bridge build --all

You now have a native Python wheel in dist/*.whl and a Node.js package in dist/*.tgz. python

Terminal window
python -c "import my_library; print(my_library.add(1, 2))"