Turso Database Project Delivers In-Process SQL Engine Built in Rust with SQLite Compatibility
The Turso Database project, an open-source, in-process SQL database built primarily in Rust, provides high compatibility with SQLite while introducing features like concurrent writes and an asynchronous architecture. Released under the MIT License and currently in beta, the datab
The Turso Database project, an open-source, in-process SQL database built primarily in Rust, provides high compatibility with SQLite while introducing features like concurrent writes and an asynchronous architecture. Released under the MIT License and currently in beta, the database engine supports multiple programming languages and incorporates a Model Context Protocol (MCP) server for direct integration with AI assistants.
Reimplementing SQLite in Rust
The Turso database project is designed as an in-process SQL database engine. An in-process database, often called an embedded database, runs directly inside the host application’s memory space rather than operating as a separate background server. This design eliminates the network latency typically associated with sending queries to an external database, allowing for rapid read and write execution.
The project aims for high compatibility with SQLite, matching its SQL dialect, database file formats, and standard C API. Developed under the permissive MIT License, the codebase is written primarily in Rust (which makes up 86% of the repository), with the remaining components comprising C (4%), Python (3%), TypeScript (2%), Java (1%), and C# (1%). Created on August 26, 2023, the repository has accumulated 20,705 stars, 1,059 forks, and 742 open issues, with 87 watchers. Its maintainers note that the software remains in a beta stage of development and warn users to backup their data before deploying it in production.
Multi-Version Concurrency Control and Asynchronous Performance
Standard SQLite databases are restricted by a single-writer lock, meaning only one process can write to the database file at any given time. Turso works around this limitation by implementing Multi-Version Concurrency Control (MVCC). By using the BEGIN CONCURRENT command, the engine permits multiple write transactions to execute simultaneously without blocking each other, resolving conflicts later during the commit phase.
To optimize performance on Linux systems, Turso utilizes io_uring to enable asynchronous input/output operations directly at the kernel level. This approach prevents disk operations from blocking application threads.
The project’s active focus on refining its MVCC engine is reflected in its stable release, version 0.6.1, published on May 22, 2026. Key patches contributed by developers Mikaël Francoeur, Avinash Sajjanshetty, and Pere Diaz Bou resolved several concurrency issues, including:
- Applying virtual gen-col affinity in OLD probe and NEW key (Mikaël Francoeur).
- Making MVCC
integrity_checkreprepare after checkpoint root publication (Avinash Sajjanshetty). - Rolling back savepoints on abandoned statements (Pere Diaz Bou).
- Checking schema cookies during
get_commit_timestamp(Pere Diaz Bou). - Yielding on big serialization of transactions to avoid blocking the main thread (Pere Diaz Bou).
- Preserving the rowid allocator watermark (Avinash Sajjanshetty).
- Rolling back abandoned MVCC commits on cleanup (Mikaël Francoeur).
- Fixing duplicate index entries for interior index keys during checkpoints (Avinash Sajjanshetty).
Built-in Model Context Protocol Server for AI Integration
The database engine includes a built-in server that supports the Model Context Protocol (MCP), an open standard designed to let generative artificial intelligence assistants interact directly with databases. By starting the Turso command-line interface in MCP mode, developers can allow external AI clients to inspect and manage their data.
To enable this, developers can add the tursodb executable to their MCP client configuration file:
{
"mcpServers": {
"turso": {
"command": "/path/to/.turso/tursodb",
"args": ["/path/to/your/database.db", "--mcp"]
}
}
}
For tool integrations like Claude Code, the MCP server can be registered with a direct terminal instruction:
claude mcp add my-database -- tursodb ./path/to/your/database.db --mcp
Once running, the server exposes nine specific tools that AI assistants can execute:
open_database: Open a new databasecurrent_database: Describe the current databaselist_tables: List all tables in the databasedescribe_table: Describe the structure of a specific tableexecute_query: Execute read-only SELECT queriesinsert_data: Insert new data into tablesupdate_data: Update existing data in tablesdelete_data: Delete data from tablesschema_change: Execute schema modification statements (such asCREATE TABLE,ALTER TABLE, andDROP TABLE)
Core Features and Experimental Capabilities
In addition to handling traditional SQL queries, Turso natively supports exact vector search and vector manipulation. This capability is designed to handle mathematical vector representations utilized by machine learning and artificial intelligence workflows. The project’s current roadmap also includes vector indexing for fast approximate vector search.
Turso includes built-in Change Data Capture (CDC), which tracks and broadcasts changes to the database in real time. Developers can use CDC to trigger external actions or sync updates to other services immediately. The engine also speeds up schema alterations by providing extended support for the ALTER SQL command.
Beyond these core features, the repository lists several experimental capabilities currently available for testing:
- Encryption at rest to secure database files locally.
- Full-text search powered by the Tantivy search library.
- Incremental computation using DBSP for incremental view maintenance and query subscriptions.
- Multi-process WAL coordination using a
.tshmsidecar file to allow cross-process Write-Ahead Log (WAL) readers and writers to coordinate.
Language Bindings and Client Setup
Although built primarily in Rust, Turso provides official bindings and client libraries across a wide range of runtime environments. Developers can import and run the engine locally in JavaScript, Go, Python, Java, .NET, Rust, and WebAssembly.
For application developers, integration with existing tech stacks is simplified by several language-specific libraries:
Rust
Add the package to your project:
cargo add turso
Example implementation:
let db = Builder::new_local("sqlite.db").build().await?;
let conn = db.connect()?;
let res = conn.query("SELECT * FROM users", ()).await?;
JavaScript / TypeScript
Install the database package via npm:
npm i @tursodatabase/database
Example implementation:
import { connect } from '@tursodatabase/database';
const db = await connect('sqlite.db');
const stmt = db.prepare('SELECT * FROM users');
const users = stmt.all();
console.log(users);
Python
Install the package using your preferred package manager:
uv pip install pyturso
Example implementation:
import turso
con = turso.connect("sqlite.db")
cur = con.cursor()
res = cur.execute("SELECT * FROM users")
print(res.fetchone())
Go
Fetch and install the official package:
go get turso.tech/database/tursogo
go install turso.tech/database/tursogo
Example implementation:
import (
"database/sql"
_ "turso.tech/database/tursogo"
)
conn, _ = sql.Open("turso", "sqlite.db")
defer conn.Close()
stmt, _ := conn.Prepare("select * from users")
defer stmt.Close()
rows, _ = stmt.Query()
for rows.Next() {
var id int
var username string
_ := rows.Scan(&id, &username)
fmt.Printf("User: ID: %d, Username: %s\n", id, username)
}
.NET
Example implementation in C#:
using Turso;
using var connection = new TursoConnection("Data Source=:memory:");
connection.Open();
connection.ExecuteNonQuery("CREATE TABLE t(a, b)");
var rowsAffected = connection.ExecuteNonQuery("INSERT INTO t(a, b) VALUES (1, 2), (3, 4)");
Console.WriteLine($"RowsAffected: {rowsAffected}");
using var command = connection.CreateCommand();
command.CommandText = "SELECT * FROM t";
using var reader = command.ExecuteReader();
while (reader.Read())
{
var a = reader.GetInt32(0);
var b = reader.GetInt32(1);
Console.WriteLine($"Value1: {a}, Value2: {b}");
}
Java
Java applications can connect using a JDBC driver integrated directly into the Turso Database engine, with specific bindings detailed within the project repository under bindings/java.
Command-Line Interface Installation
On desktop platforms, developers can install the database CLI, known as turso_cli or tursodb, using a prebuilt installer shell script:
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/tursodatabase/turso/releases/download/v0.6.1/turso_cli-installer.sh | sh
For Windows environments, the installer can be retrieved and executed via PowerShell:
powershell -ExecutionPolicy Bypass -c "irm https://github.com/tursodatabase/turso/releases/download/v0.6.1/turso_cli-installer.ps1 | iex"
Once installed, running the tursodb command starts an interactive command-line shell. If no file is specified, the system initiates a transient, in-memory database where users can execute standard SQL statements:
Turso
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database
turso> CREATE TABLE users (id INT, username TEXT);
turso> INSERT INTO users VALUES (1, 'alice');
turso> INSERT INTO users VALUES (2, 'bob');
turso> SELECT * FROM users;
1|alice
2|bob
The team also maintains prebuilt binaries for diverse platforms, including Apple Silicon macOS (turso_cli-aarch64-apple-darwin.tar.xz), and allows the engine to be compiled directly from source using the Cargo package manager by running cargo run or using the provided Makefile targets:
make docker-cli-build && \
make docker-cli-run
Source: View on GitHub
- #Opensource
Author
Krishnan
Contributor
Enterprise Technology Explorer is a business and operations professional with over 15 years of experience across multiple industries working with Fortune 500 companies. With a solid foundation in enterprise processes, digital adoption, and technology evaluation, he excels at bridging business needs with emerging technologies to build scalable enterprise-grade applications.