expo-sqlite is basically “SQLite wrapped for React Native / Expo.”
Anytime you need a real relational database on the device—but don’t want to eject or add native code—it’s the go-to choice.
Below are the most common situations where expo-sqlite makes sense (with a few concrete examples to spark ideas).
────────────────────────────────────────
-
Structured/relational data you need to query
• Complex objects with parent/child relationships (courses ⇢ lessons ⇢ questions)
• Inventory / product catalogs (products, categories, tags, stock levels)
• Finance or budgeting apps (accounts, transactions, categories, budgets)
-
Large, filterable lists
• Contact managers, CRM mini-apps
• Offline dictionaries / glossaries / Bible apps where you need fast full-text search
• City guide / travel apps with thousands of POIs that users can filter by type, distance, etc.
-
“Offline-first” / sync-later workflows
• Field-data collection (farm surveys, deliveries, inspection checklists)
• Sales reps saving orders in poor-signal zones, then syncing when online
• Note-taking apps with rich metadata (tags, notebooks, attachments)
-
Local caching of server data
• Speeding up list views: store the last API response in SQLite, show instantly on next launch, and refresh in the background
• Caching paginated feeds, chat history, or forum threads
-
Complex querying beyond key-value lookups
• JOINs, GROUP BY, ORDER BY, aggregate stats (e.g., average lesson-completion time per course)
• Full-text search using the SQLite FTS extension (Android/iOS already compile it in)
-
Storing user-generated content
• Draft posts, blog articles, or MDX lessons if you need powerful search/filter later
• Local save of quizzes with many questions + answers
-
Event logging / analytics when network isn’t reliable
• Buffer events in SQLite, periodically POST in batches
• Keep a rolling 10,000-row log, prune old rows with DELETE
-
Secure or private data (paired with encryption)
• Combine expo-sqlite with an encryption library (e.g., SQLCipher build or by encrypting blobs yourself) for local vaults
────────────────────────────────────────
When NOT to use it
• Small, simple key-value pairs (use AsyncStorage / MMKV / SecureStore)
• Very large binary blobs (videos, images ⇒ put them in FileSystem; store only the file path in SQLite)
• Super-high-write frequency analytics (better to buffer in memory and flush)
────────────────────────────────────────
Tiny usage sample
import * as SQLite from 'expo-sqlite';
const db = SQLite.openDatabase('app.db');
export const initDb = () =>
new Promise<void>((resolve, reject) => {
db.transaction(tx => {
tx.executeSql(
`CREATE TABLE IF NOT EXISTS lessons (
id TEXT PRIMARY KEY NOT NULL,
title TEXT,
mdx TEXT,
videoPath TEXT
);`,
[],
() => resolve(),
(_, err) => { reject(err); return false; }
);
});
});
export const saveLesson = (id, title, mdx, videoPath) =>
new Promise<void>((resolve, reject) => {
db.transaction(tx => {
tx.executeSql(
`INSERT OR REPLACE INTO lessons (id, title, mdx, videoPath)
VALUES (?, ?, ?, ?);`,
[id, title, mdx, videoPath],
() => resolve(),
(_, err) => { reject(err); return false; }
);
});
});
export const listLessons = () =>
new Promise<any[]>((resolve, reject) => {
db.transaction(tx => {
tx.executeSql(
'SELECT * FROM lessons ORDER BY title;',
[],
(_, { rows }) => resolve(rows._array),
(_, err) => { reject(err); return false; }
);
});
});
────────────────────────────────────────
Rule of thumb 🤓
If you catch yourself saying “I wish I could run a SQL query on this local data,” or you need to store thousands of records with relationships, expo-sqlite is the right fit. For truly massive blobs (videos), pair it with expo-file-system—store the file path in the DB, not the binary itself.