In this TypeScript quickstart we will learn how to:Documentation Index
Fetch the complete documentation index at: https://docs.turso.tech/llms.txt
Use this file to discover all available pages before exploring further.
- 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.
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.Recommended: @tursodatabase/serverless (Remote / Over-the-Wire)
@tursodatabase/serverless is the recommended package for any application that connects to a remote Turso Cloud database 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.
Retrieve database credentials
You will need an existing database to continue. If you don’t have one, create one.Get the database URL:Get the database authentication token:Assign credentials to the environment variables inside
.env.You will want to store these as environment variables.
@libsql/client (ORM & Legacy)
Use@libsql/client for ORM integration (Drizzle, Prisma) or if you have an existing codebase built on it. See the reference for full documentation.
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 true local-first sync with explicit
push() and pull() operations.