The Edge Database Problem
Cloudflare D1 is Cloudflare-only. PlanetScale is MySQL-only. Most databases have one region — adding a read replica costs $50+/month.
Turso distributes SQLite globally. Your data replicates to edge locations automatically. Based on libSQL, a fork of SQLite.
What Turso Gives You
Embedded Replicas
import { createClient } from '@libsql/client';
const db = createClient({
url: 'file:local.db',
syncUrl: 'libsql://your-db.turso.io',
authToken: 'your-token',
});
// Reads hit local SQLite file — zero latency
const users = await db.execute('SELECT * FROM users');
// Writes go to primary, then sync to replicas
await db.execute('INSERT INTO users (name) VALUES (?)', ['John']);
// Manual sync
await db.sync();
Your app has a local SQLite copy. Reads are instant. Writes propagate globally.
Multi-Region Replication
# Create database
turso db create my-app
# Add replicas
turso db replicate my-app --location ams # Amsterdam
turso db replicate my-app --location nrt # Tokyo
turso db replicate my-app --location sin # Singapore
Data replicates to each location. Users connect to the nearest replica.
Standard SQL
await db.execute(`
CREATE TABLE posts (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title TEXT NOT NULL,
content TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
)
`);
const posts = await db.execute({
sql: 'SELECT * FROM posts WHERE created_at > ? ORDER BY created_at DESC LIMIT ?',
args: ['2024-01-01', 10],
});
Drizzle ORM Integration
import { drizzle } from 'drizzle-orm/libsql';
const db = drizzle(client);
const users = await db.select().from(usersTable).where(eq(usersTable.active, true));
Branching
turso db create my-app-staging --from-db my-app
# Instant copy — test migrations safely
Free Tier
- 9GB total storage
- 500 databases
- 3 locations
- 1B row reads/month
Why This Matters
SQLite is the most deployed database in the world. Turso gives it the one thing it was missing — global distribution.
Need data for your Turso database? Check out my web scraping actors on Apify Store — structured data for edge import. For custom solutions, email spinov001@gmail.com.
Top comments (0)