← Back to archive

Repo of the Day

tursodatabase/libsql

Published: Feb 6, 2024

Open repository ↗

libSQL is a fork of SQLite that is both Open Source, and Open Contributions.

Summary

libSQL is an open-source fork of SQLite maintained by Turso that adds networking and replication features on top of standard SQLite while preserving the original file format and C API. It supports embedded replicas (a local copy that talks to a remote primary) and a standalone server for remote access, with drivers for TypeScript, Rust, and Go. The project is distinct from Turso's other database engine, which is a Rust rewrite; new features are being developed there rather than here.

What it is useful for

libSQL is useful when you want SQLite's embedded simplicity but also need to replicate a database across machines or expose it over the network. According to the README, embedded replicas let you keep a replicated copy of the database inside your app, and libsql-server provides remote SQLite access similar to PostgreSQL or MySQL. The repository also lists extensions that SQLite lacks by default: an ALTER TABLE extension for modifying column types and constraints, randomized ROWIDs, WebAssembly-based user-defined functions, and a virtual write-ahead log interface.

It fits well for applications that need offline-capable local databases that periodically sync to a central source, and for teams that want SQLite-compatible behavior without rewriting their tooling, since the file format remains standard and the C API stays 100% compatible.

How engineers can use it

The README documents two build paths. To build the SQLite-compatible C library and CLI tool from source:

cargo xtask build

Then to launch the shell and confirm it works:

$ cd libsql-sqlite3 && ./libsql
libSQL version 0.2.1 (based on SQLite version 3.43.0) 2023-05-23 11:47:56

For application integration, official drivers are listed for TypeScript/JavaScript, Rust, Go, and Go without CGO. Python and C drivers are marked experimental, with community drivers for PHP, D, and Ring also available. Several GUI tools support libSQL out of the box, including Beekeeper Studio, TablePlus, Outerbase (browser-based), Dataflare, and libSQL Studio.

Two limitations worth knowing before adopting it. First, libSQL inherits SQLite's single-writer model, so concurrent writers are not supported. Second, the README recommends that new projects look at the Turso database project instead, since that engine is where active feature development is happening. If you need concurrent writes or bi-directional sync, that distinction matters. Docker-based setup details are referenced but not fully spelled out in the README excerpt, so check docs/DOCKER.md for the container workflow.