Realm is a mobile database that runs directly inside phones, tablets or wearables. This project hosts the JavaScript versions of Realm. Currently we only support React Native (both iOS & Android) and Node.js (on MacOS and Linux) but we are considering adding support for Cordova/PhoneGap/Ionic as well.


  • Mobile-first: Realm is the first database built from the ground up to run directly inside phones, tablets and wearables.
  • Simple: Data is directly exposed as objects and queryable by code, removing the need for ORM's riddled with performance & maintenance issues.
  • Modern: Realm supports relationships, generics, and vectorization.
  • Fast: Realm is faster than even raw SQLite on common operations, while maintaining an extremely rich feature set.

Building Realm

In case you don't want to use the precompiled version on npm, you can build Realm yourself from source. You’ll need an Internet connection the first time you build in order to download the core library.


First clone this repository:

git clone

Then in the cloned directory:

git submodule update --init --recursive

Note: If you have cloned the repo previously make sure you remove your node_modules directory since it may contain stale dependencies which may cause the build to fail.

Building for iOS:

  • Open react-native/ios/RealmReact.xcodeproj
  • Select RealmReact.framework as the build target
  • Build

Building for Android:

  • cd react-native/android
  • ./gradlew publishAndroid
  • The compiled version of the Android module is here: <project-root>/android

Building for nodejs:

Be sure you have python2.7 as the default python. 3.x won't work, and it's not enough to use --python=python2.7 as parameter to npm.

npm install --build-from-source=realm
  • On Windows you will need to setup the environment for node-gyp

    • Option 1: Install windows-build-tools node package

      • Open an elevated command prompt (As Administrator)

        npm install -g --production windows-build-tools
    • Option 2: Manually install and configure

      • Check node-gyp manual for custom installation procedure for Windows

Building docs:

API documentation is written using JSDoc.

  • npm run jsdoc

The generated docs can be found by opening docs/output/realm/<version>/index.html.

Debugging the node addon

You can use (Visual Studio Code)[] to develop and debug. In the .vscode folder, configuration for building and debugging has been added for your convience.

VSCode has good support for debugging JavaScript, but to work with C++ code, you are required to install two additional VSCode extensions:

  • Microsoft C/C++
  • CodeLLDB

To begin, you will need to build the node addon and prepare the test environment:

npm install --build-from-source --debug
(cd tests && npm install)

Prior to begin debugging, you must start Realm Object Server. In VSCode, under menu Tasks/Run Task, find Download and Start Server.

In the debugging pane, you can find Debug LLDB + NodeJS in the dropdown. First select Start Debugging in the Debug menu.

Issues with debugging

Some users have reported the Chrome debugging being too slow to use after integrating Realm into their react-native project. This is due to the blocking nature of the RPC calls made through the Realm library. It is an ongoing issue and we are actively working on fixing it. See for more information.

Running the tests

You will need to install nvm to run the tests. Currently it is only possible to test using node 6, so please nvm install 6.11.3.

The tests will spawn a new shell when running, so you need to make sure that new shell instances use the correct version of npm. On Mac you can add the following to your prefered shell setup:

export NVM_DIR="$HOME/.nvm"
. "$(brew --prefix nvm)/"

You can now use scripts/ to run the various tests.
You will need yarn installed on the machine. options

  • eslint - lints the sources
  • react-tests - runs all React Native tests on iOS Simulator
  • react-tests-android runs all React Native Android tests on Android emulator
  • node - runs all tests for node
  • test-runners - checks supported tests runners are working correctly

If you modify or add a test, please remove tests/react-test-app/node_modules/realm-tests before running (of course, only if you are testing with React Native).

Testing on Windows

On Windows some of these targets are available as npm commands.

npm run eslint
npm run node-tests
npm run test-runners

Debugging the tests

You can attach a debugger to react-native tests by passing "Debug" to the script. A Chrome browser will open and connect to the react native application. Use the built-in Chrome Debugger to debug the code.

./scripts/ react-tests Debug

Using Visual Studio Code

You can debug node tests using Visual Studio Code. Just use one of the launch configurations.