React Native, Meet node.js Native Addons

This ad is not shown to multipass and full ticket holders
React Summit US
React Summit US 2026
November 17 - 20, 2026
New York, US & Online
Upcoming event
React Summit US 2026
React Summit US 2026
November 17 - 20, 2026. New York, US & Online
Bookmark
Rate this content
Sentry
Promoted
Code breaks, fix it faster

Crashes, slowdowns, regressions in prod. Seer by Sentry unifies traces, replays, errors, profiles to find root causes fast.

Get started

From bridgeful, to bridgeless, to Expo Modules and Static Hermes, the landscape of native modules in React Native is ever-evolving. Cross-pollination, however, has always been limited – it is rare for React Native to use native modules from other ecosystems, and vice versa.

In this talk, we introduce Node-API, a popular standard for exposing native APIs to JavaScript in an ABI-stable manner, no matter the engine. Used in Node.js and most other major JavaScript runtimes, it is the ideal technology for sharing native modules cross- ecosystem.

We'll show how it's being used by Microsoft in React Native Windows already, and what it may mean for the future of React Native!

This talk has been presented at React Summit US 2024, check out the latest edition of this React Conference.

FAQ

ABI stability is the commitment to backwards compatibility in an application binary interface, allowing you to swap out library versions without recompiling the rest of the app.

In React Native Windows, NodeAPI is used to create an ABI stable API for Hermes, allowing for the use of the latest Hermes version without recompiling React Native Windows.

NativeScript allows for calling native APIs from JavaScript, enabling cross-ecosystem library sharing by providing JavaScript access to platform-specific SDKs like iOS and Android.

ABI safety allows a binary to be used in an app without recompilation, regardless of build mode, compiler, or language, ensuring efficient integration and execution.

Node.js native add-ons provide the ability to perform native operations from the JavaScript side, enhancing flexibility and performance in application development.

Future developments include upstreaming NodeAPI into Hermes, supporting Node.js native add-ons, and completing the official ABI stable Hermes API to improve module distribution.

Cross-ecosystem collaboration benefits from NodeAPI by enabling the reuse of libraries and technologies across platforms, reducing redundancy and fostering innovation.

Node.js native add-ons are native modules that allow Node.js to interact with other technologies, such as SQLite3, through packages written with NodeAPI, which is engine agnostic.

NodeAPI is important because it is a popular, community-driven, de facto industry standard for creating Node.js native add-ons. It supports various languages and offers interoperability between native and JavaScript contexts.

Jamie Birch
Jamie Birch
18 min
22 Nov, 2024

Comments

Sign in or register to post your comment.
Video Summary and Transcription
We'll be going over the use cases of Node.js native add-ons and how they are written with NodeAPI. ABI stability allows swapping out older versions of a library for newer ones without recompiling the rest of the app. Node API enables the use of the latest Hermes regardless of React Native Windows. NativeScript is a library for calling native APIs from JavaScript, eliminating the need for dealing with native code. To initialize the addon in React Native, we modified the approach by auto-linking the native script XC framework. We can read the battery level using inline JavaScript and make view changes like setting the background color. React Native reanimated can be used to work on the UI thread. Support for Node.js native add-ons and completion of the official ABI stable Hermes API would open up the ecosystem.

1. Introduction to Node.js Native Add-ons

Short description:

We'll be going over the use cases of Node.js native add-ons and how they are written with NodeAPI. NodeAPI is incredibly popular and available for various languages. It allows for first-class interaction between native and JavaScript context. It's already in use in React Native Windows and has an ABI stable API for Hermes, but first, let's understand what an ABI is.

We'll be going over a few things in this talk. Of course, what are Node.js native add-ons? We're going to run into a couple of use cases. One, an ABI stable API for Hermes that is already in use. And two, a proof of concept of cross ecosystem library sharing. We'll wrap it all up afterwards.

So, what are Node.js native add-ons? Well, Node.js has its own native modules called native add-ons. For example, for Node.js to interact with SQLite3, there's an NPM package for that. And just as React native modules are written with JSI, Node.js native add-ons are written with NodeAPI, which is similarly engine agnostic. Now, to put that visually, it's like this. NodeAPI occupies the same position between native code and JavaScript engines as JSI does.

So, why should we care? We've already got JSI. What more do we need? Well, first of all, NodeAPI is incredibly popular. So, if you measure it just by the downloads per week of Node add-on API, which is commonly imported by Node.js native add-ons based on C++, there's 20 million downloads per week. Very popular. It's community driven. It's a de facto industry standard, and it's available for various languages. So, instead of writing in C++, you can write in Swift, as, you know, we can do with Expo modules and Nitro modules, but also Rust, C Sharp, Nim, Zig, Go. And it can express pretty much anything ECMAScript can. You want proxies, you can have it. You can do class extensions, static methods, all sorts of things, very idiomatically, rather than having to do lots of prototype tricks, for example. There's first class interrupt between native and JavaScript context. So, you've got lifetimes, you've got async functions, you've got threading, that sort of thing. And it's ABI stable, which we'll be getting into later.

So, is this all just theorycrafting? It's one thing to say Node API would be great, it's got all these characteristics, but what's the story about bringing it into React Native? Well, the truth is, it's already in use in React Native Windows. So, I'd like to tell a story about an ABI stable API for Hermes. But in order to explain that, first we need to be clear of what an ABI is. So, here we have a lovely image of some binary, which expresses part of this story. So, an application binary interface is the compiled version of an API. So, while you when you're dealing with APIs are dealing with human concepts, like classes and declarations and functions and that sort of thing, an ABI is a lower level. It's like it says inside this big old binary blob, where do I find the stuff that I need and what does it mean? So, it defines the set of functions and their signatures, the data structures, for example layouts of structs and enums, function calling conventions, error handling, and memory management.

2. Understanding ABI Safety and Stability

Short description:

An ideal ABI is both safe and stable, ensuring that a binary can be used in an app without recompilation. ABI stability allows swapping out older versions of a library for newer ones without recompiling the rest of the app. React Native Windows uses a fork of Hermes that implements an API based on Node API. Instead of exposing JSI, which is not ABI safe, Node API is exposed, ensuring ABI safety. Node API JSI, which is source only, then exposes JSI to React Native Windows and implements it on top of Node API.

And an ideal ABI is both safe and stable. Let me explain what I mean by that. There's a concept of ABI safety, where you have your app and a library that it consumes, let's say Hermes. And for building your app as fast as possible, you want to be building your app and your userland code in debug mode. But libraries such as Hermes, you'll want precompiled in release mode. You don't want to be compiling them from scratch each time. And you want it to be running as fast as possible. That's why you want all the optimizations of release compilation.

Now, ABI safety, therefore, lets a binary be used in your app without recompilation, regardless of the build mode, compiler, or language. ABI stability is another thing that goes along with it. We've got our app again. We've got Hermes again. But, say we wanted to swap out an older version of Hermes for a newer one, without recompiling the rest of our app. This is what ABI stability is about. It's a commitment to backwards compatibility, saying, for example, if we're going to add any new case to an enum or any new method to a class, we do it, you know, we commit to doing things additively, and we never remove stuff.

So, this is put into practice in React Native Windows. In order to realize these benefits, React Native Windows uses a fork of Hermes, that implements an API based on Node API. Since its development, Hermes has begun developing an official API, but for now, let's study how Hermes Windows works. The way things started off, the Hermes library would expose JSI, as the API by which React Native uses it. JSI being a C++ library is not ABI safe. In future, this will get a bit better, we'll have a Hermes ABI safe API, which React Native can code against. But, as that was not originally available, Hermes Windows took a certain approach to expose an ABI safe API for React Native Windows. How did they do that? Well, they made a library called Node API, JSI. And I'll get into that in just a second, but instead of exposing JSI, which was not ABI safe, they exposed Node API, which is ABI safe. And then, Node API JSI can expose JSI to React Native Windows, and it implements JSI on top of Node API. This is a little bit confusing, but this is how it all is set up. The key thing about this is Node API JSI is source only. So, any symbols it's exporting, JSI symbols, don't matter because they're internal to the React Native DLL. So, it doesn't matter that JSI is not ABI disabled if it's not, you know, if it's private.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Raising the Bar: Our Journey Making React Native a Preferred Choice
React Advanced 2023React Advanced 2023
29 min
Raising the Bar: Our Journey Making React Native a Preferred Choice
This Talk discusses Rack Native at Microsoft and the efforts to improve code integration, developer experience, and leadership goals. The goal is to extend Rack Native to any app, utilize web code, and increase developer velocity. Implementing web APIs for React Native is being explored, as well as collaboration with Meta. The ultimate aim is to make web code into universal code and enable developers to write code once and have it work on all platforms.
Opensource Documentation—Tales from React and React Native
React Finland 2021React Finland 2021
27 min
Opensource Documentation—Tales from React and React Native
Documentation is often your community's first point of contact with your project and their daily companion at work. So why is documentation the last thing that gets done, and how can we do it better? This talk shares how important documentation is for React and React Native and how you can invest in or contribute to making your favourite project's docs to build a thriving community
Bringing React Server Components to React Native
React Day Berlin 2023React Day Berlin 2023
29 min
Bringing React Server Components to React Native
Top Content
React Server Components (RSC) offer a more accessible approach within the React model, addressing challenges like big initial bundle size and unnecessary data over the network. RSC can benefit React Native development by adding a new server layer and enabling faster requests. They also allow for faster publishing of changes in mobile apps and can be integrated into federated super apps. However, implementing RSC in mobile apps requires careful consideration of offline-first apps, caching, and Apple's review process.
React Native Kotlin Multiplatform Toolkit
React Day Berlin 2022React Day Berlin 2022
26 min
React Native Kotlin Multiplatform Toolkit
Top Content
The Talk discusses the combination of React Native and Kotlin Multiplatform for cross-platform app development. Challenges with native modules in React Native are addressed, and the potential improvements of using Kotlin Multiplatform Mobile are explored. The integration of Kotlin Multiplatform with React Native streamlines native implementation and eliminates boilerplate code. Questions about architecture and compatibility, as well as the possibility of supporting React Native Web, are discussed. The React Native toolkit works with native animations and has potential for open-source development.
“Microfrontends” for Mobile in React Native
React Advanced 2023React Advanced 2023
24 min
“Microfrontends” for Mobile in React Native
Top Content
Micro frontends are an architectural style where independent deliverable frontend applications compose a greater application. They allow for independent development and deployment, breaking down teams into feature verticals. React Native's architecture enables updating the JavaScript layer without going through the app store. Code Push can be used to deploy separate JavaScript bundles for each micro frontend. However, there are challenges with managing native code and dependencies in a micro frontend ecosystem for mobile apps.
Run Games Within Your React Native Apps
React Day Berlin 2022React Day Berlin 2022
28 min
Run Games Within Your React Native Apps
Top Content
Today's Talk discusses integrating Unity into React Native apps for game development. Unity provides a wide range of capabilities and can be seamlessly integrated with React Native. The integration involves using the Unity View component and the Unity Message callback to enable communication between the two platforms. Native plugins are created to facilitate communication between Unity and React Native. The performance of Unity in React Native apps is comparable to regular React Native apps, and the decision to use Unity or React Native depends on the app's use case and need for advanced UI and gaming capabilities.

Workshops on related topic

Introducing FlashList: Let's build a performant React Native list all together
React Advanced 2022React Advanced 2022
81 min
Introducing FlashList: Let's build a performant React Native list all together
Top Content
Featured Workshop
David Cortés Fulla
Marek Fořt
Talha Naqvi
3 authors
In this workshop you’ll learn why we created FlashList at Shopify and how you can use it in your code today. We will show you how to take a list that is not performant in FlatList and make it performant using FlashList with minimum effort. We will use tools like Flipper, our own benchmarking code, and teach you how the FlashList API can cover more complex use cases and still keep a top-notch performance.You will know:- Quick presentation about what FlashList, why we built, etc.- Migrating from FlatList to FlashList- Teaching how to write a performant list- Utilizing the tools provided by FlashList library (mainly the useBenchmark hook)- Using the Flipper plugins (flame graph, our lists profiler, UI & JS FPS profiler, etc.)- Optimizing performance of FlashList by using more advanced props like `getType`- 5-6 sample tasks where we’ll uncover and fix issues together- Q&A with Shopify team
Detox 101: How to write stable end-to-end tests for your React Native application
React Summit 2022React Summit 2022
117 min
Detox 101: How to write stable end-to-end tests for your React Native application
Top Content
Workshop
Yevheniia Hlovatska
Yevheniia Hlovatska
Compared to unit testing, end-to-end testing aims to interact with your application just like a real user. And as we all know it can be pretty challenging. Especially when we talk about Mobile applications.
Tests rely on many conditions and are considered to be slow and flaky. On the other hand - end-to-end tests can give the greatest confidence that your app is working. And if done right - can become an amazing tool for boosting developer velocity.
Detox is a gray-box end-to-end testing framework for mobile apps. Developed by Wix to solve the problem of slowness and flakiness and used by React Native itself as its E2E testing tool.
Join me on this workshop to learn how to make your mobile end-to-end tests with Detox rock.
Prerequisites- iOS/Android: MacOS Catalina or newer- Android only: Linux- Install before the workshop
How to Build an Interactive “Wheel of Fortune” Animation with React Native
React Summit Remote Edition 2021React Summit Remote Edition 2021
60 min
How to Build an Interactive “Wheel of Fortune” Animation with React Native
Top Content
Workshop
Oli Bates
Oli Bates
- Intro - Cleo & our mission- What we want to build, how it fits into our product & purpose, run through designs- Getting started with environment set up & “hello world”- Intro to React Native Animation- Step 1: Spinning the wheel on a button press- Step 2: Dragging the wheel to give it velocity- Step 3: Adding friction to the wheel to slow it down- Step 4 (stretch): Adding haptics for an immersive feel
Deploying React Native Apps in the Cloud
React Summit 2023React Summit 2023
88 min
Deploying React Native Apps in the Cloud
Top Content
WorkshopFree
Cecelia Martinez
Cecelia Martinez
Deploying React Native apps manually on a local machine can be complex. The differences between Android and iOS require developers to use specific tools and processes for each platform, including hardware requirements for iOS. Manual deployments also make it difficult to manage signing credentials, environment configurations, track releases, and to collaborate as a team.
Appflow is the cloud mobile DevOps platform built by Ionic. Using a service like Appflow to build React Native apps not only provides access to powerful computing resources, it can simplify the deployment process by providing a centralized environment for managing and distributing your app to multiple platforms. This can save time and resources, enable collaboration, as well as improve the overall reliability and scalability of an app.
In this workshop, you’ll deploy a React Native application for delivery to Android and iOS test devices using Appflow. You’ll also learn the steps for publishing to Google Play and Apple App Stores. No previous experience with deploying native applications is required, and you’ll come away with a deeper understanding of the mobile deployment process and best practices for how to use a cloud mobile DevOps platform to ship quickly at scale.
Effective Detox Testing
React Advanced 2023React Advanced 2023
159 min
Effective Detox Testing
Workshop
Josh Justice
Josh Justice
So you’ve gotten Detox set up to test your React Native application. Good work! But you aren’t done yet: there are still a lot of questions you need to answer. How many tests do you write? When and where do you run them? How do you ensure there is test data available? What do you do about parts of your app that use mobile APIs that are difficult to automate? You could sink a lot of effort into these things—is the payoff worth it?
In this three-hour workshop we’ll address these questions by discussing how to integrate Detox into your development workflow. You’ll walk away with the skills and information you need to make Detox testing a natural and productive part of day-to-day development.
Table of contents:
- Deciding what to test with Detox vs React Native Testing Library vs manual testing- Setting up a fake API layer for testing- Getting Detox running on CI on GitHub Actions for free- Deciding how much of your app to test with Detox: a sliding scale- Fitting Detox into you local development workflow
Prerequisites
- Familiarity with building applications with React Native- Basic experience with Detox- Machine setup: a working React Native CLI development environment including either Xcode or Android Studio
Building for Web & Mobile with Expo
React Day Berlin 2022React Day Berlin 2022
155 min
Building for Web & Mobile with Expo
Workshop
Josh Justice
Josh Justice
We know that React is for the web and React Native is for Android and iOS. But have you heard of react-native-web—for writing an app for Android, iOS, and the web in one codebase? Just like React Native abstracts away the details of iOS and Android, React Native Web extracts away the details of the browser as well. This opens up the possibility of even more code sharing across platforms.
In this workshop you’ll walk through setting up the skeleton for a React Native Web app that works great and looks awesome. You can use the resulting codebase as a foundation to build whatever app you like on top of it, using the React paradigms and many JavaScript libraries you’re used to. You might be surprised how many types of app don’t really require a separate mobile and web codebase!
What's included1. Setting up drawer and stack navigators with React Navigation, including responsiveness2. Configuring React Navigation with URLs3. Setting up React Native Paper including styling the React Navigation drawer and headers4. Setting up a custom color theme that supports dark mode5. Configuring favicons/app icons and metadata6. What to do when you can’t or don’t want to provide the same functionality on web and mobile
Prerequisites- Familiarity with building applications with either React or React Native. You do not need to know both.- Machine setup: Node LTS, Yarn, be able to successfully create and run a new Expo app following the instructions on https://docs.expo.dev/get-started/create-a-new-app/