Sync a SQLite database to Turso's edge replica for low-latency global reads
domain: docs.turso.tech · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Install the Turso CLI and authenticate: `turso auth login`.
Create a Turso database from a local SQLite file: `turso db create mydb --from-file ./local.db` — uploads the file and returns a `libsql://` URL.
Add edge replicas in additional regions: `turso db replicate mydb --location lhr` (London); repeat for each region you need.
In your application, use the `@libsql/client` package and connect with the Turso URL and an auth token: `createClient({ url: 'libsql://...', authToken: 'YOUR_TOKEN' })`.
Reads are automatically routed to the nearest replica; writes go to the primary and propagate to replicas asynchronously — use `sync()` to force replica refresh if needed.
Known gotchas
Replica reads are eventually consistent — reads immediately after a write may return stale data unless you call `sync()` or read from the primary URL.
The embedded replica mode (local SQLite + sync) keeps a local copy on disk; ensure you call `sync()` on startup and periodically to receive latest changes.
Auth tokens are long-lived by default — rotate them regularly and use short-lived tokens for client-facing deployments.
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?