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.
Nitro SQLite works through autolinking. Use Expo SDK 58 with the Nitro V1 prerelease, which requires React Native 0.88 and Swift Package Manager for iOS. The config plugins set the SQLite options when Expo generates the native projects. Use a development build or a production build, because Expo Go does not contain 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.
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@nitro-v1{
"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
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
Run npx expo prebuild after changing the configuration. On Android, rebuild with npx expo run:android.
On iOS, if 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.
For a generated iOS project that uses CocoaPods, run npx react-native spm add --deintegrate once. For an existing SwiftPM project, run npx react-native spm to refresh its packages. Then rebuild with npx expo run:ios.
Repeated 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. A clean prebuild deletes those directories, so move any manual native changes into config plugins first.
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.