- Install the Turso package
- Connect to a local or remote database
- Execute a query using SQL
- Sync changes to the cloud
Recommended: @tursodatabase/database (Local / Embedded)
@tursodatabase/database is the recommended package for local and embedded use cases (Node.js, Electron, mobile, IoT). It is built on the Turso Database engine — a ground-up rewrite of SQLite with concurrent writes (MVCC) and async I/O.
1
Install
2
Connect
3
Execute
4
Sync (push and pull)
If you need to sync your local database with Turso Cloud, use All reads and writes happen against the local database file — fast, offline-capable.
@tursodatabase/sync:push() sends your changes to the cloud. pull() brings remote changes down. See Turso Sync for details on conflict resolution, checkpointing, and more.Remote Turso database: @tursodatabase/serverless
@tursodatabase/serverless is the package for applications that connect to a remote Turso database on Turso Cloud over the network — including Node.js servers, Docker containers, serverless functions, and edge runtimes (Cloudflare Workers, Vercel Edge, Deno Deploy). It uses only fetch — zero native dependencies, works everywhere.
1
Retrieve database credentials
You will need an existing Turso database to continue. If you don’t have one, create one with Get the database authentication token:Assign credentials to the environment variables inside
turso db create --tursodb (see the quickstart).Get the database URL:.env.You will want to store these as environment variables.
2
Install
3
Connect to your database
@libsql/client API, use the compat module:4
Execute a query using SQL
Remote libSQL database: @libsql/client
@libsql/client is the package for applications that connect to a remote libSQL database on Turso Cloud. It is also the package to use for ORM integration (Drizzle, Prisma). See the reference for full documentation.
1
Install
Begin by installing the
@libsql/client dependency in your project:2
Connect
3
Execute
4
Sync
If you need to sync your local database with a remote Turso Cloud database (local reads and writes with push/pull to the cloud), use Turso Sync. Turso Sync is built on the Turso Database engine and provides local-first sync with explicit
push() and pull() operations.