Turso
Turso is a database platform built on libSQL, its open-source fork of SQLite. Its databases are cheap enough to have thousands, one per customer, user or pull request, and can sync to replicas embedded in your app.
New to Turso? Start with What is Turso?.
A quick example
Section titled “A quick example”Every database lives in a group. The group decides where its databases run.
import * as Turso from "@alchemy.run/turso";import * as Effect from "effect/Effect";
export const Group = Turso.Group("Group", { location: "aws-us-east-1" });
export const Db = Effect.gen(function* () { const group = yield* Group; return yield* Turso.Database("Db", { group: group.name, migrations: "./migrations", });});Each deploy runs any new migrations. See Migrations.
Turso.Connect gives the Worker the database’s URL and a token. Pass it to Drizzle or Effect SQL:
const conn = yield* Turso.Connect(Db);const db = yield* Drizzle.LibSQL(conn);See Connections.
Turso databases are cheap, so you can give each customer their own. Turso.ManageDatabases lets a Worker create, query, and delete databases in one group:
const tenants = yield* Turso.ManageDatabases(Tenants);const acme = yield* tenants.create("acme");const sql = yield* SQL.LibSQL(tenants.connect(acme.name));See Database per tenant.
Where to start
Section titled “Where to start”Want to build? The tutorial builds a database per tenant, step by step. Start with Setup to connect your organization.
Looking for something specific? Every section of these docs is listed below, and every resource is in the generated API reference.