React Native

RNRepo: Faster React Native Builds Through Prebuilt Artifacts

Krzysztof MagieraDec 3, 20256 min read

Announcing RNRepo: Faster React Native Builds Through Prebuilt Artifacts

Today, we’re excited to announce RNRepo.org, an infrastructure and tooling project from Software Mansion that addresses one of the most critical and underserved pain points in React Native development: slow native build times.

We’ve developed a system that builds and stores intermediate binaries for ecosystem libraries, serving them so you can avoid repeating the same compilation work over and over.

Why are native builds so hard

Native build times in React Native shouldn’t be slow. In most React Native projects, the majority of build time is spent compiling code you never wrote. That code largely comes from libraries you install, is generated by tools like codegen, or sometimes both.

As a consequence, React Native developers around the world, along with countless machines running CI/CD, repeatedly compile the same source files, generating identical outputs while wasting time and resources.

The root cause lies in one of React Native’s biggest strengths: its ties to the JavaScript and React community. The JavaScript ecosystem relies on npm for distributing dependencies, and React Native inherited that approach. Historically, when publishing to npm, packages would submit source code that could later be picked up and bundled. This system is optimized for storing and delivering JavaScript source code packages — not native build artifacts.

When publishing React Native libraries, maintainers often ship not just JavaScript but also platform-native and/or C++ code. Submitting different build artifacts to different repositories is error-prone and complicated, so the React Native ecosystem settled on publishing libraries as sources only to npm. As a result, apps consuming these libraries must compile the sources, which is a much longer and resource-consuming process compared to bundling JavaScript.

This problem is already solved in Android native development, where libraries are distributed in precompiled form via repositories like Maven Central. So why can’t we do the same? We actually can — React Native core itself is distributed in this exact form.

The challenge comes with community libraries. Many libraries (especially those shipping C++ code, which is now extremely common) bind against a specific React Native version during compile time by including headers from React Native. This isn’t a problem when you build locally, since your app has a specific version of React Native installed. However, if we were to publish build artifacts, they could only be used in projects with that exact React Native version.

If a library maintainer wanted to publish prebuilt artifacts, they’d need to build and publish them for every React Native version they want to support, then re-publish when new React Native versions are released. This makes the whole setup very complex and unapproachable for most library maintainers.

Today, we’re excited to share the first beta version of RNRepo — our answer to the slow native build time problem.

RNRepo is a build service and delivery platform that seamlessly integrates into existing React Native build workflows, following best practices specific to native platforms for dependency management. It builds and delivers community artifacts, allowing your computer or CI/CD workflows to skip the repetitive compilation work.

This beta release supports Android builds of React Native projects using the New Architecture. You can try it today by following the instructions at rnrepo.org.

How it works

RNRepo is configured to build selected libraries for a number of recent React Native versions. Whenever there’s a new library release or a React Native release, our build pipeline automatically picks it up and schedules a build workflow.

The build workflow mirrors what would happen on your computer when building an app with that library installed: it creates a new React Native project with a specific version, installs the library, and builds the project. We then extract the intermediate build artifact and store it for publishing.

At the heart of RNRepo is our hosted Maven repository, which we use for publishing and distributing binary artifacts. Each library version is built in combination with a React Native version and published there, complete with file hashes and GPG signatures.

Since everything is open source, you can trace any binary back to the exact GitHub workflow that produced it, giving the whole system full transparency. You may already be familiar with this approach from npm’s green check marks, which indicate that the package was built and signed with provenance.

When you enable RNRepo in your app, the Gradle plugin scans all your react-native dependencies and matches ones that are available as prebuilds. It then substitutes building from source with prebuilt artifacts downloaded from our Maven server. Thanks to standard Android tooling for dependency management, the installed prebuilt artifacts are cached locally — you won’t need to download them again for future builds.

We are currently building over 40 libraries across 14 different React Native versions, and hosting over 2000 unique build artifacts on our Maven repository. If a library isn’t available or the version you’re using doesn’t have a prebuild ready yet, the system gracefully falls back to building from source.

What you get

The most obvious benefit is time saved on builds. In our testing, using RNRepo for some projects cut build times in half on CI. But there are also some welcome side effects of using platform native dependency distribution instead of building from source.

When you build locally, you’re not just spending time — you’re also consuming disk space. Native builds store not just the library artifacts but a ton of intermediate files created during the build process. Those files can take up significant space and, for Android, are typically saved under node_modules/<library_name>/android/build, contributing substantially to the overall size of your node_modules folder. The intermediate build artifacts are typically orders of magnitude larger than the resulting .so or .jar files delivered as part of the .aar archive from RNRepo. By using prebuilt artifacts, you avoid generating all these intermediate files entirely.

If you work on a brownfield project or frequently open your app in Android Studio, you may have noticed that React Native dependencies are listed as sub-projects, not as dependencies. This can be frustrating because the sub-projects are displayed at the same level as your main project, polluting the project hierarchy view in Android Studio. Since RNRepo swaps out dependencies added by React Native’s autolinking (which appear as sub-projects) with normal remote dependencies, it cleans up the project hierarchy view, making your Android Studio experience much cleaner.

Try it Today

We put a lot of effort into making RNRepo easy to set up. Unless you have many patches for libraries in your project, you should be able to install it by adding just a few lines of code to your build files.

Check out our website for detailed instructions and share your feedback on X or via GitHub Issues. Help us expand the list of libraries we support by letting us know which libraries consume the most time in your native builds.

We’re excited to see how RNRepo helps the React Native community build faster!

We are Software Mansion — multimedia experts, AI explorers, React Native core contributors, community builders, and software development consultants. Need help with building your next dream product? You can hire us.

More in this category