Starting a new project? Use
turso for local/embedded use or sync. For remote access, match the crate to the database engine: turso_serverless for Turso databases, libsql with the remote feature for libSQL databases (no C compiler needed).
turso
For local and embedded use. Built on the Turso Database engine with concurrent writes (MVCC) and async I/O.Installing
Connecting
Querying
Prepared Statements
Transactions
Encryption
Encrypt local databases at rest:aegis256, aegis256x2, aegis128l, aegis128x2, aegis128x4, aes256gcm, aes128gcm.
Encrypted databases cannot be read as standard SQLite databases — you must use the Turso Database engine to open them.
Turso Cloud databases can also be encrypted with bring-your-own-key — learn more.
Sync (Push and Pull)
For local database with cloud sync. All reads and writes happen locally; usepush() to send changes to the cloud and pull() to fetch remote changes.
Enable the sync feature:
Push and Pull
Checkpoint
Compact the local WAL to bound disk usage while preserving sync state:Stats
libsql (Remote)
Use thelibsql crate with the remote feature for over-the-wire access to Turso Cloud. This uses pure Rust HTTP — no C compiler needed.
Installing
Connecting
Querying
libsql (libSQL)
Thelibsql crate is built on libSQL, the open-source fork of SQLite that powers Turso Cloud today. It is production-ready and battle-tested, and is the right choice when you are working with an existing libsql-based codebase.
With
libsql Embedded Replicas, reads are local and writes are sent to the cloud primary, then reflected back to the replica. Embedded Replicas are fully supported. For new projects that need sync, we recommend the turso crate with turso::sync — see the quickstart.Embedded Replicas
You can work with Embedded Replicas that sync from a Turso Cloud database to a local SQLite file. Reads run locally; writes are sent to the cloud primary and then reflected back to the replica:Manual Sync
Sync Interval
Read Your Own Writes
By default, after apush(), the next pull() waits for the server to fully catch up with your changes before returning — guaranteeing you always read your own writes. This is safer but much slower, since the server must process all pending changes. If you can tolerate eventually-consistent reads, disable this for significantly faster pulls:
Encryption
To enable encryption on a SQLite file, pass the encryption key value as an argument to the constructor:Rust
Encrypted databases appear as raw data and cannot be read as standard SQLite databases. You must use the libSQL client for any operations — learn more.
Conditional compilation
Thelibsql crate supports conditionally compiling features: