# From libSQL to Rust Rewrite: The Architectural Evolution of TursoDB

> Why the Turso team moved from maintaining a C fork of SQLite (libSQL) to building an async, MVCC-capable SQLite engine from scratch in Rust.
> Published: 2026-12-01
> Canonical URL: https://tursodb.cn/blog/libsql-to-turso-rust-evolution/
> Source: TursoDB.cn Independent Developer Community

For twenty-five years, SQLite has been the most widely deployed database engine on earth—embedded in phones, browsers, aircraft, and developer laptops. Yet when teams tried to bring SQLite into cloud-native, multi-tenant, and AI agent workloads, two architectural walls appeared: synchronous C I/O and single-writer locks.

## Phase 1: libSQL — Opening SQLite to the Cloud

When Turso launched **libSQL** as an open-contribution fork of SQLite, the mission was practical and urgent:

- Add an official HTTP/WebSocket protocol (`Hrana`) so serverless runtimes like Cloudflare Workers could talk to SQLite without persistent TCP pools.
- Build `sqld` in Rust to manage replication, WAL frame streaming, and Embedded Replicas.
- Ship native vector types (`F32_BLOB`) and randomized/custom extensions directly inside the database.

libSQL proved that SQLite could power millions of lightweight databases in production. However, patching a decades-old C codebase whenever you want fundamental storage changes—such as true async I/O or lock-free MVCC—becomes exponentially harder over time.

## Phase 2: Rewriting SQLite in Rust (Limbo → TursoDB)

Rather than fighting C's synchronous assumptions forever, the team began a clean-room rewrite in Rust—initially codenamed **Limbo**, and now the foundation of **TursoDB**.

### What Changes Under the Hood?

1. **Step-Driven Virtual Machine**: Instead of blocking an OS thread when a B-tree page is missing from cache, the bytecode VM yields an I/O request and resumes once `io_uring` completes it.
2. **MVCC Concurrent Writes**: `BEGIN CONCURRENT` removes the classic "database is locked" error under concurrent multi-writer workloads.
3. **Deterministic Simulation Testing**: Every I/O syscall goes through a pluggable trait, making it possible to simulate disk corruption, out-of-order writes, and power failures reproducibly in CI.
4. **Native Local-First Sync**: Turso Sync treats local writes as first-class operations rather than mere read-only caches.

## Which One Should You Use Today?

- **Production serverless apps needing battle-tested Drizzle/Prisma support today**: `@libsql/client` + Turso Cloud or self-hosted `sqld` remains rock-solid.
- **Rust native apps, local-first desktop tools, and concurrent embedded workloads**: Start experimenting with the native `turso` Rust crate and track compatibility milestones as TursoDB reaches full parity.
