Documentation Index
Fetch the complete documentation index at: https://mintlify.com/iterate/sqlfu/llms.txt
Use this file to discover all available pages before exploring further.
expo-sqlite gives React Native apps on-device SQLite storage. The createExpoSqliteClient adapter wraps an expo-sqlite database handle as an AsyncClient, so generated query wrappers return promises and work naturally with async/await in your components and hooks.
Install dependencies
expo-sqlite requires Expo SDK 50 or later for the async API (openDatabaseAsync). Older versions used a synchronous API. This guide covers the async API.Configure sqlfu
The mobile runtime cannot read migration files from disk at runtime — they must be bundled. Leave Generated wrappers are async by default, matching
db out of the config; sqlfu uses definitions.sql for type generation and generates a migration bundle that the app imports directly:sqlfu.config.ts
expo-sqlite.Write schema and queries
Add your schema to Add a query to
definitions.sql:definitions.sql
sql/queries.sql:sql/queries.sql
Draft and generate
Run the authoring commands on your development machine:
sqlfu draft writes the next migration file to migrations/. sqlfu generate creates TypeScript wrappers in sql/.generated/ and the migration bundle in migrations/.generated/migrations.ts. Both are committed to your repo and bundled into the app.Do not run
sqlfu migrate as your app’s migration step. Instead, import the generated migrate function and call it at database open time — see the next step.Open the database and call your queries
Open the database with The migration bundle is idempotent. It applies any missing migrations and skips ones already recorded in the on-device
SQLite.openDatabaseAsync, wrap it with createExpoSqliteClient, and apply migrations before returning the client:src/db.ts
sqlfu_migrations table. Calling it on every app open is safe.Async behavior
expo-sqlite is asynchronous. All generated wrappers and client.all(...) calls return promises:
Read next
Adapters reference
The Expo SQLite adapter snippet and the full compatibility matrix.
SQL migrations
Migration history, the generated bundle, and drift detection.