Turso (libSQL) & Edge SQLite

Where Turso fits in a mobile stack: SQLite compatibility, per-user databases, and reaching it safely through your backend.

Turso is a hosted database built on libSQL, a SQLite fork. It is often written 'turbo' by mistake; it is unrelated to Turborepo. It suits edge backends and per-tenant databases.

Core concepts

  1. What libSQL is: A SQLite-compatible engine with network access, replication and extensions. Anything you know about SQLite largely applies. — Turso docs
  2. Reach it through your backend: Keep the auth token on the server. Your app calls an API or edge function, which queries Turso with parameterised SQL. — Turso docs
  3. Local SQLite + server sync: Use expo-sqlite on the device for offline data and Turso as the server-side store, syncing through your API. Check Turso's current docs for any native React Native or embedded-replica support before relying on it. — Expo SQLite
  4. Per-user databases: Turso can host many small databases, one per user or tenant, which isolates data and simplifies deletion requests. — Turso docs

Concept videos

YouTube channels and searches for these topics. On a large screen they open in the reading panel next to the roadmap.

Explanation

When to pick it

Choose Turso when you want SQLite semantics on the server, edge latency, or one database per tenant. Choose Supabase or Postgres when you want rich relational features and built-in auth.

Do not confuse it with Turborepo

Turborepo is a monorepo build tool. If your agent suggests 'Turbo' for a database, check which product it means.

What Is It?

Turso is a managed SQLite-compatible database service built on libSQL.

Why Should I Care?

It gives SQLite's simplicity with a networked, replicated database.

Real World Analogy

It is a pocket ledger (SQLite) that also has a branch office network so many people can read the same book.

Visual Mental Model

text
App -> your API (holds token) -> Turso (libSQL)
App -> local expo-sqlite (offline)

Smallest Possible Example

ts
import { createClient } from '@libsql/client';

const db = createClient({
  url: process.env.TURSO_DATABASE_URL!,
  authToken: process.env.TURSO_AUTH_TOKEN!,
});

const result = await db.execute({ sql: 'select * from notes where user_id = ?', args: [userId] });

Common Mistakes

❌ Putting the Turso auth token in the app.

It would be extractable; keep it on the server.

❌ Assuming every SQLite feature works identically.

Check libSQL notes for differences and limits.

Build This Mini Project

Create a Turso database, a notes table and an API route that lists a user's notes with a parameterised query.

Prompts for Cursor, Claude Code & Codex

Paste these into Cursor, Claude Code, Codex, or any coding agent. Replace the bracketed parts with your app details, and keep the agent in plan mode first so you review the approach before it edits files.

Turso API route

text
Create an API route that lists and creates notes in Turso using @libsql/client with parameterised queries, authenticated by the user's session. Keep TURSO_AUTH_TOKEN server-side only and return typed JSON.

Rules, databases & blogs to use

Resources

Threads in the same domain as this chapter — go deeper on iHateReading without leaving the roadmap.

Firebase, Supabase and Clerk authentication cover

Firebase, Supabase and Clerk authentication

Auth options for apps compared.

How to build an AI chat app with Vercel AI SDK and Firebase cover

How to build an AI chat app with Vercel AI SDK and Firebase

Chat UI, streaming and backend wiring for an AI feature.

Hosting under $100/month at 10k visitors cover

Hosting under $100/month at 10k visitors

Cut hosting burn for agent-heavy apps with sane infra choices.