Contact Us
Webflow Premium Partner Ehab Fayez
Back to Agent Skills
Data & Analytics

Turso/LibSQL Edge Database

Deploy SQLite at the edge with Turso and LibSQL for ultra-low latency reads and embedded replicas.

Claude Code Cursor Copilot Windsurf

Overview

Turso is a distributed database built on LibSQL, an open-source fork of SQLite designed for production use. It enables SQLite databases to be deployed at the edge with automatic replication to multiple regions, providing single-digit millisecond read latency globally. LibSQL extends SQLite with features like HTTP-based access, server mode, and vector search.

The @libsql/client TypeScript library provides a simple API for connecting to Turso databases from any JavaScript runtime. It supports both HTTP (for serverless) and WebSocket (for persistent connections) protocols. Embedded replicas allow your application to read from a local SQLite file that is automatically synced with the primary database, enabling zero-latency reads with configurable sync intervals.

Turso is particularly well-suited for read-heavy workloads like content sites, SaaS applications, and mobile backends. Each database can have replicas in multiple regions, with writes routed to the primary location and replicated asynchronously. The platform supports database branching for development workflows, CLI-based management, and integrations with frameworks like Astro, Next.js, and Remix.

Who Is This For?

  • Deploy a globally distributed SQLite database at the edge
  • Use embedded replicas for zero-latency local reads
  • Build local-first applications with sync capabilities
  • Scale read-heavy workloads with multi-region replication

Installation

Setup for Claude Code
npm install @libsql/client

Configuration

import { createClient } from "@libsql/client"

const db = createClient({
  url: process.env.TURSO_DATABASE_URL!,
  authToken: process.env.TURSO_AUTH_TOKEN,
})

const result = await db.execute({
  sql: "SELECT * FROM users WHERE email = ?",
  args: [email],
})

// Embedded replica
const localDb = createClient({
  url: "file:local.db",
  syncUrl: process.env.TURSO_DATABASE_URL!,
  authToken: process.env.TURSO_AUTH_TOKEN,
})
await localDb.sync()