Melon-dbMelon-db
Architecture

Native SQLite

Expo Go vs dev build paths, TurboModule, and C++ JSI bindings.

React Native has two supported SQLite paths. Choosing the wrong import is the most common setup mistake — use this page as a decision guide.

See @melon-db/db-sqlite-native for setup and limitations. For the dual-path rationale see ADR-005 and ADR-006.

Path decision

EnvironmentPackage / entryNative module
Expo Go@melon-db/db-sqlite/expoexpo-sqlite (async)
Dev build (iOS/Android)@melon-db/db-sqlite/rn@melon-db/db-sqlite-native
Override to Expo driver in dev clientEXPO_PUBLIC_MELON_SQLITE=expoexpo-sqlite
Force TurboModule onlyEXPO_PUBLIC_MELON_SQLITE=turboTurboModule promises

Example apps:

Native stack layers

Phases 20–26 built a layered native module:

Phase 22–23: TurboModule codegen (MelonSQLiteSpec) on iOS and Android.

Phase 25–26: C++ JSI host object installed as global.melonSqliteJsi on first Turbo call. Sync methods (openSync, queryAllSync, …) run on a dedicated native DB queue. JS thread blocks until the queue completes (documented trade-off for v1).

When JSI is present, getMelonSQLiteNativeMode() returns jsi-sync; otherwise turbo.

Platform matrix

PlatformC++ JSI syncTurboModule fallbackExpo Go
iOS dev buildYesYesNo
Android dev buildYesYesNo
Expo GoNoNoYes (expo-sqlite)

v1 native limitations

  • No BLOB round-trip on the native JSI path
  • Predicate-aware observeQuery in @melon-db/db-sqlite (all paths including native JSI)
  • RN on-device benchmark harness deferred (Node bench:compare vs WatermelonDB ships today)