npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-nitro-cli

v0.0.1-alpha.17

Published

CLI and native build integration for React Nitro applications.

Readme

React Nitro CLI

Prepare, build, and run React Nitro apps. Application components and registerApp come from react-nitro-renderer. Package releases currently require an Apple Silicon Mac and Bun. iOS builds use Xcode 27 and target iOS 16 or newer. Android builds use JDK 17, SDK 36, NDK 29.0.14206865 and CMake 3.22.1 and Python 3, and target Android API 26 or newer. Set ANDROID_HOME and add the SDK platform-tools to PATH for CLI device builds.

bunx create-react-nitro@latest MyApp
cd MyApp
bun run start

bun run start starts the dev server that Debug builds load JavaScript from. Press i or a in it to build and open the app on iOS or Android, or shift+i or shift+a to open the last build without building. To build without the dev server:

bun run ios --device <simulator-UDID>
bun run android --device <adb-serial>

Use xcrun simctl list devices booted to find a running simulator. You can also open ios/ReactNitro.xcodeproj in Xcode, select a simulator, and run the app after installing dependencies. For Android, use adb devices to find a connected device or running emulator, or open android/ in Android Studio.

App files

  • src/App.tsx contains your UI. src/index.tsx calls registerApp(App).
  • ios/ is your permanent Xcode project. Check it into Git. Edit delegates, signing, capabilities, bundle identifiers, versions and targets here. Ordinary app-native Swift code can live alongside AppDelegate.swift.
  • android/ is your permanent Gradle project. Its Activity, manifest, application ID, signing, variants and dependencies belong to the app. It applies the SDK-owned com.margelo.reactnitro Gradle plugin.
  • Modules/ contains local Nitro modules with TypeScript specs, Swift implementations and Kotlin implementations.
  • app.json selects the JavaScript entry, native build target, module locations and optional native layout provider. Set layoutEngine to an installed provider’s package name and rebuild to switch engines. Layout provider contract
  • tsconfig.json extends this package's application configuration.

The CLI creates the initial native projects once through the starter. Preparation never rewrites ios/, android/ or your module implementations. .nitro/ contains disposable build settings, Swift package wrapper manifests, registration glue and directory links. Keep it out of version control.

Node package resolution locates the framework's exact npm dependencies, including the pinned upstream nitro-core. Each wrapper links its source directories to the installed package and supplies a regular Package.swift so SwiftPM can resolve sibling dependencies. There are no mirrored native source trees. Unchanged links and manifests stay in place across preparation, including while Xcode is open. Android Gradle and CMake consume the resolved package paths directly; their generated configuration, registration glue and runtime build output live in .nitro/android/. Native source trees are not copied.

Native modules

react-nitro prepare links packages declared in the app's dependencies and installed optionalDependencies when their nitro.json specifies "environment": "bare". To use a published module, add it as an app dependency and rebuild. The CLI also discovers local modules under Modules/* by default. A workspace module found both ways is linked once.

Generated apps include a react-nitro-native-code agent skill for adding native capabilities and custom views. It routes agents to the instructions shipped with the CLI, including how to adapt a module scaffold into a renderer-native view.

bun run react-nitro module Greeter

This creates a private workspace package in Modules/Greeter and installs it as an app dependency:

  • src/Greeter.nitro.ts declares the JavaScript API and its platform implementations.
  • ios/HybridGreeter.swift and android/src/main/java/…/HybridGreeter.kt implement it.
  • Package.swift owns its native targets and dependencies.
  • nitro.json configures Nitrogen. The scaffold includes iOS and Android implementations.

Use it from your app:

import { Greeter } from 'app-greeter'

const greeter = new Greeter()
const message = greeter.getMessage()

bun install, bun run ios and bun run android prepare the app. After changing specs or module configuration, run bun run react-nitro prepare before building directly in Xcode or Android Studio. The CLI runs the pinned Nitrogen generator when inputs change, links the module's source directories, and generates startup registration. Swift and Kotlin edits compile directly from the module folder. Generated bindings stay in the module's ignored nitrogen/generated/ directory.

For Android, optional Modules/Greeter/android/build.gradle dependencies are applied to the runtime library, where module Kotlin sources compile. C++ implementations under cpp/, shared with iOS, and under android/src/main/cpp/ are compiled into the generated module target. Headers go next to the shared sources in cpp/, and in android/src/main/cpp/include/ for Android-only code. A module can also provide android/react-nitro.cmake to add sources or link native dependencies to its declared android.cxxLibName target.

To run code when a NitroActivity is created, implement com.margelo.reactnitro.runtime.NitroActivityInitializer on a Kotlin object. Set reactNitro.android.activityInitializer in the module's package.json to its fully qualified name, for example com.margelo.nitro.storage.StorageModule. The runtime calls onCreate(activity: NitroActivity) on the main thread for each Activity instance, before starting JavaScript or reattaching a retained session. Activity recreation can call the initializer again in the same process.

On iOS, the scaffolded Package.swift compiles cpp/ with the generated C++ when the folder exists.

Swift module manifests are evaluated from .nitro/native/app-<module-name>. Their source paths are relative to the module root; SDK dependencies use sibling paths such as ../nitro-core. Keep native sources and resources inside directories, as in the scaffold. Other local module dependencies can reference the sibling wrapper name. If you move a workspace dependency, update the app's workspace pattern and run bun install. To include local modules by path, set modules in app.json. Keep module Swift sources outside the app target's synchronized source folder to avoid compiling them twice.

{
  "name": "MyApp",
  "entry": "src/index.tsx",
  "modules": ["ios/Modules/*"],
  "ios": {
    "project": "ios/MyApp.xcodeproj",
    "scheme": "MyApp",
    "target": "MyApp"
  }
}

All fields except name are optional. The defaults are src/index.tsx, Modules/*, ios/ReactNitro.xcodeproj and scheme ReactNitro. Set ios.target when the scheme builds multiple apps. Launching uses the native target's actual product path and bundle identifier.

Upgrade

bun add react-nitro-cli@latest react-nitro-renderer@latest
bun run react-nitro upgrade

Update the CLI and renderer together. Postinstall refreshes the package graph and reports pending native migrations. It never replaces the native project. Committed ios/react-nitro.json and android/react-nitro.json files record each platform's adopted native revision; a package version change needs native edits only when that revision changes.

The starter includes project instructions and a react-nitro-upgrade agent skill. Agents that read them check react-nitro upgrade --json and follow versioned guides shipped with the installed SDK. This check happens when the agent works on the project, not as a background notification. Apply the native changes, validate the app, then run bun run react-nitro upgrade --complete --platform <ios|android> and commit the updated revision record. You can follow the same guides manually.

Each native platform tracks revisions independently; an absent platform does not block upgrades.

Apps created before alpha.8 need the permanent iOS project migration.

Builds

bun run ios --build-only
bun run android --build-only --abi arm64-v8a
bun run android --device <adb-serial>
bun run android --build-only --release
bun run ios --device <simulator-UDID> --release
bun run typecheck
bun run react-nitro prepare --clean

Debug builds bundle JavaScript source. In Release builds, Static Hermes compiles React, its reconciler, and the React Nitro renderer to native code. On Android, Gradle packages the native framework for each target ABI. Application components load from Hermes bytecode.

Xcode compiles native sources, and SwiftPM resolves SimdUTF. iOS app builds need no CMake, Ninja or framework FFI generation. Android uses the SDK's CMake and NDK to compile the packaged native sources, and the included Hermes host compilers. It does not rebuild host compilers from source. Local module bindings use the Nitrogen dependency included with the CLI.

prepare --clean regenerates module bindings and clears build output while preserving the native project and stable package links. Xcode builds generate a native asset catalog for image and font imports. For manual bundles, pass --asset-catalog <directory> for iOS or --android-assets-dir <directory> for Android resource packaging.

Debug builds load JavaScript from the dev server started by bun run start, with Fast Refresh. Import navigation from react-nitro-navigation; the CLI exports build tools only.

Android variants default to debug and release. Set android.project, android.module, android.debugVariant or android.releaseVariant in app.json when customizing the native project, or pass --variant <name> for a build. The CLI reads APK paths and application IDs from Gradle build artifacts, including native application ID suffixes and product flavors. Release signing is configured in the app-owned Gradle project.

Tests

bun add -d react-nitro-harness
bunx react-nitro test --platform ios
bunx react-nitro test --platform android -t 'Storage'

react-nitro test builds and installs the Debug app, then runs *.harness.ts(x) files inside it on a simulator or emulator. See react-nitro-harness.