Turso Database
SQLite-compatible embedded database for modern applications, AI agents, and edge computing.
Links
Quick Navigation
| Topic |
Reference |
| Installation |
installation.md |
| Encryption |
encryption.md |
| Authorization |
auth.md |
| Sync |
sync.md |
| Agent DBs |
agents.md |
When to Use
- Embedded SQLite database with cloud sync
- AI agent state management and multi-agent coordination
- Offline-first applications
- Encrypted databases (AEGIS, AES-GCM)
- Edge computing and IoT devices
Core Concepts
libSQL
Turso is built on libSQL, an open-source fork of SQLite with:
- Native encryption (AEGIS-256, AES-GCM)
- Async I/O (Linux io_uring)
- Cloud sync capabilities
Deployment Options
- Embedded — runs locally in your app
- Turso Cloud — managed platform with branching, backups
- Hybrid — local with cloud sync (push/pull)
Common Patterns
Encrypted Database
openssl rand -hex 32 # Generate key
tursodb --experimental-encryption "file:db.db?cipher=aegis256&hexkey=YOUR_KEY"
Cloud Sync
import { connect } from "@tursodatabase/sync";
const db = await connect({
path: "./local.db",
url: "turso://...", // also accepts "libsql://..." — both schemes work
authToken: process.env.TURSO_AUTH_TOKEN,
});
await db.push(); // local → cloud
await db.pull(); // cloud → local
Agent Database
import { connect } from "@tursodatabase/database";
// Local-first
const db = await connect("agent.db");
// Or with sync
const db = await connect({
path: "agent.db",
url: "https://db.turso.io",
authToken: "...",
sync: "full",
});
Version
Based on product version: 0.7.2
Release Notes
0.7.1 – 0.7.2
- JS/serverless SDK:
transactionAsync() is the new closure-safe transaction API. transaction() is now deprecated — its closure semantics are unsound once transactions can run concurrently, because statements captured over the outer db/conn instance can be scheduled out of order. Migrate transaction callbacks to use the txn handle passed into transactionAsync() instead of closing over the outer instance (see references/agents.md).
- Breaking:
Connection.execute() was removed from the serverless driver's native-mirroring surface (connect()), which now matches @tursodatabase/database and exposes run/get/all/iterate/exec/batch/transaction(Async) instead. The libsql-compatible createClient() layer keeps its own execute() and is unaffected (see references/auth.md).
- Fixed a stale
inTransaction flag after execute()/batch() that could leave a server-side write transaction open past a constraint error.
- Per-query
requestHeaders, passed through the trailing query-options argument, let you attach custom headers (e.g. a request-identity header) to a single call instead of only at the connection level.
- Sync engine: the remote pull protocol (page-based WAL vs. MVCC logical-log) is now auto-detected on first contact, so the old
logical_mvcc_pull flag becomes an optional manual override instead of a requirement. A WAL-mode local replica is automatically converted to MVCC journal mode in place when it syncs against an MVCC remote.
- Sync bindings (Rust, Python, JavaScript, Go, React Native) accept both
turso:// and libsql:// remote URLs interchangeably.
- Core fixes: an
IN (...) list query-cost regression that degraded InSeek to a full scan, a missing index left behind after UPSERT due to a pre-constraint-check index mutation, a change-count leak from sequences under MVCC, and DELETE/upsert replay bugs for tables with composite or non-rowid primary keys.
0.7.0
- SQL surface: SQL-standard scalar functions with PostgreSQL-compatible aliases, PostgreSQL-style sequences, MVCC-safe
AUTOINCREMENT, window-function work (row_number() on VDBE aggregate machinery, FILTER in window clauses), and WITHIN GROUP ordered-set aggregates.
- MVCC/durability: passive checkpoint for MVCC, portable logical-log metadata for Turso sync, and Aristo WAL verification.
- Collations: core custom collation support and locale-backed collations.
- .NET / platforms: NativeAOT static linking, remote transactions and batches, a Turso EF Core SQLite provider, NuGet native targets, and Windows ARM64 CLI releases.
Earlier (0.6.0)
JS/serverless timeouts, interactive transactions, Python SQLAlchemy improvements (sqlalchemy-libsql), npm-based CLI distribution, and a broader SQL surface for local-first/agent workloads — still in effect, see references/agents.md and references/installation.md.
1---
2name: turso
3description: "Turso SQLite database. Covers encryption, sync, agent patterns. Use when working with Turso/libSQL embedded databases, configuring encryption-at-rest, setting up sync replication, or building agent-friendly database patterns. Keywords: Turso, libSQL, embedded, SQLite, encryption, sync."
4metadata:
5 version: "0.7.2"
6 release_date: "2026-07-30"
7---
8
9# Turso Database
10
11SQLite-compatible embedded database for modern applications, AI agents, and edge computing.
12
13## Links
14
15- [Documentation](https://docs.turso.tech/)
16- [Changelog](https://github.com/tursodatabase/turso/blob/main/CHANGELOG.md)
17- [GitHub](https://github.com/tursodatabase/turso)
18
19## Quick Navigation
20
21| Topic | Reference |
22| ------------- | --------------------------------------------- |
23| Installation | [installation.md](references/installation.md) |
24| Encryption | [encryption.md](references/encryption.md) |
25| Authorization | [auth.md](references/auth.md) |
26| Sync | [sync.md](references/sync.md) |
27| Agent DBs | [agents.md](references/agents.md) |
28
29## When to Use
30
31- Embedded SQLite database with cloud sync
32- AI agent state management and multi-agent coordination
33- Offline-first applications
34- Encrypted databases (AEGIS, AES-GCM)
35- Edge computing and IoT devices
36
37## Core Concepts
38
39### libSQL
40
41Turso is built on libSQL, an open-source fork of SQLite with:
42
43- Native encryption (AEGIS-256, AES-GCM)
44- Async I/O (Linux io_uring)
45- Cloud sync capabilities
46
47### Deployment Options
48
491. **Embedded** — runs locally in your app
502. **Turso Cloud** — managed platform with branching, backups
513. **Hybrid** — local with cloud sync (push/pull)
52
53## Common Patterns
54
55### Encrypted Database
56
57```bash
58openssl rand -hex 32 # Generate key
59tursodb --experimental-encryption "file:db.db?cipher=aegis256&hexkey=YOUR_KEY"
60```
61
62### Cloud Sync
63
64```typescript
65import { connect } from "@tursodatabase/sync";
66
67const db = await connect({
68 path: "./local.db",
69 url: "turso://...", // also accepts "libsql://..." — both schemes work
70 authToken: process.env.TURSO_AUTH_TOKEN,
71});
72
73await db.push(); // local → cloud
74await db.pull(); // cloud → local
75```
76
77### Agent Database
78
79```javascript
80import { connect } from "@tursodatabase/database";
81
82// Local-first
83const db = await connect("agent.db");
84
85// Or with sync
86const db = await connect({
87 path: "agent.db",
88 url: "https://db.turso.io",
89 authToken: "...",
90 sync: "full",
91});
92```
93
94## Version
95
96Based on product version: 0.7.2
97
98## Release Notes
99
100### 0.7.1 – 0.7.2
101
102- **JS/serverless SDK**: `transactionAsync()` is the new closure-safe transaction API. `transaction()` is now deprecated — its closure semantics are unsound once transactions can run concurrently, because statements captured over the outer `db`/`conn` instance can be scheduled out of order. Migrate transaction callbacks to use the `txn` handle passed into `transactionAsync()` instead of closing over the outer instance (see `references/agents.md`).
103- **Breaking**: `Connection.execute()` was removed from the serverless driver's native-mirroring surface (`connect()`), which now matches `@tursodatabase/database` and exposes `run`/`get`/`all`/`iterate`/`exec`/`batch`/`transaction(Async)` instead. The libsql-compatible `createClient()` layer keeps its own `execute()` and is unaffected (see `references/auth.md`).
104- Fixed a stale `inTransaction` flag after `execute()`/`batch()` that could leave a server-side write transaction open past a constraint error.
105- Per-query `requestHeaders`, passed through the trailing query-options argument, let you attach custom headers (e.g. a request-identity header) to a single call instead of only at the connection level.
106- **Sync engine**: the remote pull protocol (page-based WAL vs. MVCC logical-log) is now auto-detected on first contact, so the old `logical_mvcc_pull` flag becomes an optional manual override instead of a requirement. A WAL-mode local replica is automatically converted to MVCC journal mode in place when it syncs against an MVCC remote.
107- Sync bindings (Rust, Python, JavaScript, Go, React Native) accept both `turso://` and `libsql://` remote URLs interchangeably.
108- **Core fixes**: an `IN (...)` list query-cost regression that degraded `InSeek` to a full scan, a missing index left behind after `UPSERT` due to a pre-constraint-check index mutation, a change-count leak from sequences under MVCC, and DELETE/upsert replay bugs for tables with composite or non-rowid primary keys.
109
110### 0.7.0
111
112- **SQL surface**: SQL-standard scalar functions with PostgreSQL-compatible aliases, PostgreSQL-style sequences, MVCC-safe `AUTOINCREMENT`, window-function work (`row_number()` on VDBE aggregate machinery, `FILTER` in window clauses), and `WITHIN GROUP` ordered-set aggregates.
113- **MVCC/durability**: passive checkpoint for MVCC, portable logical-log metadata for Turso sync, and Aristo WAL verification.
114- **Collations**: core custom collation support and locale-backed collations.
115- **.NET / platforms**: NativeAOT static linking, remote transactions and batches, a Turso EF Core SQLite provider, NuGet native targets, and Windows ARM64 CLI releases.
116
117### Earlier (0.6.0)
118
119JS/serverless timeouts, interactive transactions, Python SQLAlchemy improvements (`sqlalchemy-libsql`), npm-based CLI distribution, and a broader SQL surface for local-first/agent workloads — still in effect, see `references/agents.md` and `references/installation.md`.