NitroSQLite
NitroUI

Install on NitroUI

Use the SQLite adapter in a NitroUI app on iOS and Android.

nitro-sqlite runs Nitro SQLite in NitroUI without React Native. The adapter opens SQLite files in the app's storage directory and exposes the shared SQLite API.

The adapter is part of the 11.0.0 alpha and installs from the alpha npm tag. You can add it to an existing app or run the repository example.

Requirements

The adapter uses Nitro Core and Nitrogen 1.0.0-alpha.nightly.137.gd4793c40b8b8. The example pins NitroUI SDK 0.2.0 and React 19.3.0. Keep those versions together. React Native's Nitro bindings use a different version.

For iOS, use Xcode with Swift 6.4 or newer. The adapter's Swift package declares iOS 16 or newer. Android uses the NitroUI host's native build requirements. See supported platforms for the OS coverage.

Run the repository example

Use a source checkout of this repository. The app at examples/nitro-ui has its own package.json, lockfile, and dependencies. It installs the SQLite adapter and its Vec and ORM companions from the local checkout.

From the repository root, enter the example and install its dependencies with the Bun version pinned by the example's packageManager field:

cd examples/nitro-ui
bun install --frozen-lockfile

Installation prepares the local adapter and the native app. The environment check verifies that the app uses one React instance, one Nitro Core instance, and the adapter's SQLite source and generated bindings.

Start the JavaScript development server:

bun run start

In a second terminal in examples/nitro-ui, build and launch the app for your device:

bun run ios --device <simulator-udid>
# or
bun run android --device <emulator-serial>

The app opens the NitroUI SQLite Example home screen. Choose SQL Console to run queries against sample data, or Unit Tests to run the shared tests on the device.

Add the adapter to an existing app

Use an existing NitroUI app with the compatible versions above. The package includes the TypeScript API, native implementation, bundled SQLite, and generated bindings. From your NitroUI app directory, install it from the alpha tag:

bun add --exact nitro-sqlite@alpha

Save exact versions for every 11.0.0 alpha package, including companions. Without an exact version, the package manager saves ^11.0.0-alpha.0. That range also matches the older 11.0.0-nitro-v1.x builds, because npm sorts prerelease names alphabetically. With npm or pnpm, pass --save-exact; with Yarn, pass --exact.

Prepare and rebuild the native app with the compatible NitroUI CLI:

bunx nitro-ui prepare
bunx nitro-ui start

In a second terminal, launch your platform:

bunx nitro-ui ios --device <simulator-udid>
# or
bunx nitro-ui android --device <emulator-serial>

Use your app's scripts instead when they perform these steps. A JavaScript reload alone cannot add the native adapter to an existing binary.

Storage and configuration

iOS uses Documents by default. The iOS storage settings also apply to this adapter, including NitroSQLite_DatabaseLocation and NitroSQLite_AppGroup. Android stores persistent databases in the app's files directory and temporary SQLite files in its cache directory.

In the repository example, edit native-settings.json to change the iOS location or app group. Run bun run prepare:native from examples/nitro-ui, then rebuild. The database lifecycle guide explains relative locations and file migration.

The React Native nitroSQLite build settings do not configure this adapter. The NitroUI adapter bundles SQLite with thread safety and RTree enabled. Use the optional Vec package for vector search or the Drizzle driver to query with Drizzle ORM.

Continue with your first NitroUI query.

On this page