Expo
Configure optional native SQLite features during Expo prebuild and EAS Build.
SQLite compiles optional modules into the native library. FTS5 adds full-text indexes, while sqlite-vec adds vector search. Changing these modules requires a native rebuild; a JavaScript update cannot enable them.
Use Expo SDK 58 for the 11.0.0 alpha. Its native runtime requires React Native 0.88 or newer and uses Swift Package Manager on iOS. Nitro SQLite autolinks without a config plugin. Add the plugins to change SQLite settings during prebuild. The repository tests these prebuild transformations on Expo SDKs 55 through 58. Run your app in a development or production build because Expo Go does not include Nitro SQLite.
Configure SQLite
Add the plugin to app.json, app.config.js, or app.config.ts:
{
"expo": {
"plugins": [
[
"react-native-nitro-sqlite",
{
"fts5": true,
"ios": {
"appGroup": "group.com.example.shared"
}
}
]
]
}
}fts5 defaults to false and adds SQLITE_ENABLE_FTS5=1 on both platforms when enabled. The plugin leaves manually enabled FTS5 intact when this option is omitted or false.
An App Group lets an iOS app and its extensions access the same container. ios.appGroup sets Nitro SQLite's Info.plist key and adds the identifier to the app target's entitlements. It preserves existing groups. Register the App Group with Apple and configure each extension's entitlement separately. The group container takes precedence over the default database location.
Incremental prebuild keeps existing entitlements and plist entries. When removing ios.appGroup, regenerate with a clean prebuild or remove NitroSQLite_AppGroup and any legacy RNNitroSQLite_AppGroup from the app’s Info.plist and the group identifier from its com.apple.security.application-groups entitlement if the app no longer needs access. Rebuild and sign the app with those changes.
Shared settings such as threadSafe, performanceMode, and enableRTree still belong in your app's package.json.
Enable vector search
Install the companion package and add its plugin:
npx expo install react-native-nitro-sqlite-vec@alpha -- --save-exactExpo passes the arguments after -- to your package manager, so the exact version is saved. With Yarn or Bun, use -- --exact.
{
"expo": {
"plugins": ["react-native-nitro-sqlite", "react-native-nitro-sqlite-vec"]
}
}The react-native-nitro-sqlite-vec plugin enables vector search on iOS and Android. On Android, add the plugin to enable the native extension. On iOS, Swift Package Manager links the extension when the companion package is installed and autolinked. See vector search for queries.
Add compile definitions
Use sqliteFlags in the react-native-nitro-sqlite plugin options for additional bundled SQLite features:
{
"sqliteFlags": {
"ios": ["SQLITE_ENABLE_GEOPOLY=1"],
"android": ["-DSQLITE_ENABLE_GEOPOLY=1"]
}
}Each entry must define a SQLITE_ or HAVE_ macro with an integer or unquoted identifier value. iOS entries use KEY=VALUE; Android entries use -DKEY=VALUE. The plugin rejects compiler arguments, reserved threading, I/O, performance, and ABI settings, and definitions that conflict with existing values. Use the shared configuration options for those settings. Check SQLite's compile options before adding a definition.
Use Apple's system SQLite
Keep bundled SQLite if your iOS app uses sqlite-vec. Apple's system SQLite does not support the extension's automatic registration.
Set ios.useSystemSqlite to true to link the iOS library with Apple's SQLite instead of the bundled version:
{
"ios": {
"useSystemSqlite": true
}
}The SQLite version and available modules then depend on the operating system. Plugin compile definitions and shared build settings cannot change that library. Do not combine this option with fts5 or sqliteFlags.ios; use bundled SQLite when you need those features.
Generate and rebuild
Expo SDK 58 prebuild recreates the native directory for each selected platform. If you have manual changes in ios or android, move them into config plugins so Expo can reapply them, or back them up before running the commands below.
For iOS, add the SwiftPM opt-in to your Expo app config:
{
"expo": {
"experiments": {
"swiftPackageManager": true
}
}
}The Expo SDK 58 template already targets iOS 16.4. To set a higher minimum, use Expo's built-in ios.deploymentTarget setting. Prebuild writes the version into the Xcode app target. The expo-build-properties setting also works, but Expo deprecates it in favor of the built-in setting.
Run prebuild on macOS before your first iOS build and after changing the Expo config. Expo generates the ios directory if needed and sets up SwiftPM with Expo autolinking. The first conversion runs pod deintegrate, so install CocoaPods and check that pod --version works in the shell where you run prebuild. Run prebuild without --no-install to complete the SwiftPM setup.
npx expo prebuild --platform iosIf prebuild changed the SQLite options in ios/Podfile.properties.json, delete ~/Library/Caches/org.swift.swiftpm/manifests before rebuilding. SwiftPM caches the settings for both SQLite packages. See iOS build settings. Then rebuild with npx expo run:ios.
For Android, generate the native project and rebuild after changing configuration:
npx expo prebuild --platform android
npx expo run:androidRepeated prebuilds merge flags and App Groups without duplicates. To remove a plugin entry or a previously generated setting, regenerate the native directories with a clean prebuild.
EAS Build runs these plugins when it generates native directories. If you commit ios or android, regenerate and commit the native changes yourself before building.
Manual configuration remains supported. The plugin merges additional flags and preserves unrelated properties and entitlements. When a manual value conflicts with a requested option, remove the conflicting value or make it match. Build environment switches such as NITRO_SQLITE_VEC=1 and NITRO_SQLITE_USE_PHONE_VERSION=1 must agree with the plugin settings. See iOS configuration and Android configuration for manual setup.
The repository's Expo example uses both plugins and checks FTS5, an extra compile definition, and sqlite-vec at runtime.
After rebuilding with FTS5 enabled, SELECT sqlite_compileoption_used('ENABLE_FTS5') should return 1, and CREATE VIRTUAL TABLE notes_search USING fts5(body) should succeed.