SQLite that runs everywhere your TypeScript does.
import { createClient } from '@tursodatabase/api';
const db = createClient({
url: process.env.TURSO_URL!,
authToken: process.env.TURSO_TOKEN!,
});
const result = await db.execute(
'SELECT * FROM products WHERE id = ?',
[id],
);Turso is a SQLite-compatible database that runs in the last place SQLite usually can't: your edge functions. One driver works across Workers, Deno Deploy, Bun, and Node. You ship the same code everywhere.
Install one package, connect with a URL and token, and run your first query. The API is intentionally minimal – it does not add abstractions on top of SQL.
import { createClient } from '@tursodatabase/api';
const db = createClient({
url: process.env.TURSO_URL!,
authToken: process.env.TURSO_TOKEN!,
});
const result = await db.execute(
'SELECT * FROM products WHERE id = ?',
[id],
);Putting SQLite in production hits the same walls every time. Turso was built to take those walls down.
01
Edge runtimesThe HTTP-based driver has zero native dependencies. It runs wherever you can make a fetch request, including V8 isolates that ban Node.js APIs.
import { createClient } from '@tursodatabase/api';
// Runs on Cloudflare Workers, Vercel Edge, Deno Deploy
export default {
async fetch(req: Request): Promise<Response> {
const db = createClient({
url: env.TURSO_URL,
authToken: env.TURSO_TOKEN,
});
const { rows } = await db.execute('SELECT * FROM items');
return Response.json(rows);
},
};02
OfflineEmbedded sync lets your app read from a local replica and write offline. Changes sync to the cloud the next time the device is online.
import { createClient } from '@tursodatabase/sync';
const db = createClient({
url: 'file:local.db',
syncUrl: process.env.TURSO_URL!,
authToken: process.env.TURSO_TOKEN!,
});
// Sync latest writes from the cloud
await db.sync();
// Reads hit local storage; writes sync when online
const result = await db.execute('SELECT * FROM notes');03
Concurrent writeslibSQL uses optimistic concurrency so multiple clients can write simultaneously without the serialization bottleneck of classic SQLite.
import { createClient } from '@tursodatabase/api';
const db = createClient({ url, authToken });
// Multiple writers at the same time via optimistic concurrency
await Promise.all([
db.execute('INSERT INTO events VALUES (1, "login")'),
db.execute('INSERT INTO events VALUES (2, "view")'),
db.execute('INSERT INTO events VALUES (3, "buy")'),
]);04
Multi-tenancyThe platform API lets you spin up isolated databases in milliseconds. Each database shares a schema from a parent and stays isolated at the row level.
import { createClient } from '@tursodatabase/api';
const turso = createClient({
org: process.env.TURSO_ORG!,
token: process.env.TURSO_PLATFORM_TOKEN!,
});
// Isolated database per tenant, spun up in milliseconds
const db = await turso.databases.create(
`tenant-${tenantId}`,
{ group: 'prod', schema: 'main-schema' },
);Use the Drizzle Turso adapter to keep the query-builder ergonomics you already know. Schema migrations, type-safe queries, and relations all work the same way.
Read the Turso Drizzle docsimport { drizzle } from 'drizzle-orm/libsql';
import { createClient } from '@tursodatabase/api';
const client = createClient({ url, authToken });
const db = drizzle(client);
// Type-safe queries with your existing Drizzle schema
const users = await db
.select()
.from(schema.users)
.where(eq(schema.users.active, true));Turso ships three TypeScript packages. Most apps need one.
The default choice for edge runtimes and serverless. Stateless, fetch-based, zero native deps. Works everywhere.
Embeds libSQL as a native module. Use this for Node.js apps that need offline reads or embedded replicas.
Extends the embedded package with two-way sync. Ideal for local-first apps that read from device storage and sync to the cloud.
“Because we can branch and rollback databases quickly with just an API call, we can really scale our AI agents.”
Mike Soylu
Founder, Adaptive
libSQL is MIT-licensed and developed in the open at github.com/tursodatabase/libsql.
The fetch-based driver is maintained by the Turso team. No third-party wrappers in the hot path.
SDK releases track the libSQL release cycle. Changelogs are public.
100 databases free. Unlimited on paid plans.100 databases · 5 GB storage · 500M rows read