explaingit

neon-bindings/neon

8,411RustAudience · developerComplexity · 3/5LicenseSetup · moderate

TLDR

A tool for writing Node.js add-ons in Rust, compile Rust functions and call them from JavaScript as if they were ordinary JS functions, starting with a single npm command.

Mindmap

mindmap
  root((neon))
    What it does
      Rust to JS bridge
      Node.js add-ons in Rust
      Call Rust from JS
    Tech Stack
      Rust 1.65+
      Node.js
      npm and Cargo
      Bun experimental
    Platforms
      Linux
      macOS
      Windows
    Use Cases
      Fast computation modules
      CPU-intensive tasks
      Performance npm packages
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Build a fast number-crunching module in Rust and call it from a Node.js web server to speed up slow JavaScript code.

USE CASE 2

Write a CPU-intensive image or data processing function in Rust as a drop-in replacement for a slow JavaScript implementation.

USE CASE 3

Create a performance-critical Node.js npm package by writing the core logic in Rust using Neon's safe API.

Tech stack

RustNode.jsnpmCargoBun

Getting it running

Difficulty · moderate Time to first run · 30min

Requires stable Rust 1.65+ and a supported Node.js release installed alongside npm.

Use freely for any purpose including commercial use, choose either Apache 2.0 or MIT, both permissive.

In plain English

Neon is a tool for writing Node.js add-ons in Rust. Node.js normally runs JavaScript, but sometimes developers need faster, lower-level code running alongside it. Add-ons allow that, and Neon makes it possible to write those add-ons in Rust rather than in C or C++. Rust is a programming language known for memory safety and performance. Neon bridges Rust and Node.js so a developer can write Rust functions, compile them, and call them from JavaScript as if they were ordinary JavaScript functions. Getting started takes a single npm command that creates a new project ready to build. The project runs on Linux, macOS, and Windows. It supports all current and maintained releases of Node.js, and has experimental support for Bun, an alternative JavaScript runtime. On the Rust side, it requires stable Rust version 1.65 or higher, and the project is tested against the latest stable, beta, and nightly Rust releases. The README includes a short code sample showing a Rust function that builds a JavaScript array containing a number, a string, and a boolean, then returns it to the caller. This shows how Rust code interacts with JavaScript values through Neon's API. Full documentation lives on the project website, and more examples are available in a separate examples repository. Version 1.0.0 introduced several breaking changes to fix correctness issues and improve consistency. A migration guide is available for developers moving existing projects to the new version. The community communicates through a Slack workspace open to anyone. Testing the project uses both npm and Cargo workspace commands. It is licensed under either Apache 2.0 or MIT, at the user's choice.

Copy-paste prompts

Prompt 1
I'm using neon-bindings/neon. Write a Rust function that accepts a JavaScript array of numbers, sums them, and returns the result to Node.js.
Prompt 2
Help me migrate an existing C++ Node.js native add-on to Rust using the Neon framework, keeping the same JavaScript API.
Prompt 3
Write a Neon module that exposes a function to compress a string with gzip and return a Buffer to the Node.js caller.
Prompt 4
I upgraded to Neon 1.0.0 and my build broke. Help me update my code based on the 1.0.0 migration guide's breaking changes.
Open on GitHub → Explain another repo

← neon-bindings on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.