Skip to content

yeshks/featherdb

πŸͺΆ FeatherDB

The embedded SQL database built for AI agents.

True MVCC Β· Built-in encryption Β· Per-session isolation Β· Rust & Python

CI Rust License Version


FeatherDB is a full SQL database that compiles into your binary. No servers, no sockets, no C dependencies. It uses real database internals β€” B-trees, write-ahead logging, MVCC snapshot isolation β€” and adds the features AI agents actually need: concurrent writers, encryption at rest, API key auth, and per-conversation session isolation.

v1.0.0 "Louise" β€” First production release. True MVCC with write-write conflict detection, MCP server, all 22 TPC-H queries.

⚑ Quick Start

Rust

[dependencies]
featherdb = "1.0"
use featherdb::{Database, Result};

fn main() -> Result<()> {
    let db = Database::open("myapp.db")?;

    db.execute("CREATE TABLE tasks (
        id INTEGER PRIMARY KEY,
        title TEXT NOT NULL,
        status TEXT DEFAULT 'pending'
    )")?;

    db.execute("INSERT INTO tasks (id, title) VALUES (1, 'Build something cool')")?;

    let rows = db.query("SELECT * FROM tasks WHERE status = 'pending'")?;
    println!("Found {} pending tasks", rows.len());

    Ok(())
}

Python

import featherdb

with featherdb.Database("myapp.db") as db:
    db.execute("CREATE TABLE tasks (id INTEGER PRIMARY KEY, title TEXT)")
    db.execute("INSERT INTO tasks VALUES (1, 'Build something cool')")

    for row in db.query("SELECT * FROM tasks"):
        print(f"Task #{row['id']}: {row['title']}")

πŸ”‘ Why FeatherDB?

FeatherDB SQLite
Concurrency True MVCC β€” readers never block writers Single-writer (WAL mode)
Encryption Built-in AES-256-GCM Requires paid extension (SEE)
Auth API keys with Argon2id hashing N/A
Permissions Table-level GRANT / REVOKE N/A
Sessions Per-conversation isolation N/A
Language Pure Rust, zero C deps C with bindings

🧩 Features

πŸ—„οΈ SQL Engine

JOINs (inner, left, right, full, cross) Β· Subqueries (IN, EXISTS, scalar, correlated) Β· CTEs Β· Window functions (ROW_NUMBER, RANK, DENSE_RANK) Β· UNION / UNION ALL Β· Views Β· GROUP BY + HAVING Β· CASE Β· 30+ built-in functions Β· Passes all 22 TPC-H queries

πŸ”„ Transactions

MVCC snapshot isolation Β· Multiple concurrent readers and writers Β· Deadlock detection Β· Configurable timeouts Β· Savepoints for partial rollback

πŸ’Ύ Storage

B-tree engine Β· Write-ahead logging Β· Crash recovery Β· Adaptive compression (LZ4 / ZSTD) Β· Three eviction policies (Clock, LRU-2, LIRS)

πŸ” Security

AES-256-GCM page encryption with hardware acceleration Β· API key auth (Argon2id) Β· Table-level GRANT / REVOKE Β· Per-session isolation

πŸ€– MCP Server

Built-in Model Context Protocol server for AI agents. Tools: query, execute, list_tables, describe_table, create_table, get_status. Works with Claude Desktop, Cursor, and any MCP client.

# Start the MCP server
cargo run -p featherdb-mcp -- --db myapp.db

βš™οΈ Performance

Cost-based optimizer Β· Index selection + join ordering Β· Predicate pushdown Β· Plan cache (5–10x on repeated queries) Β· Prepared statements

πŸ› οΈ Developer Experience

// Type-safe schema mapping
#[derive(Table)]
#[table(name = "users")]
struct User {
    #[column(primary_key)]
    id: i64,
    name: String,
    email: Option<String>,
}
// Fluent query builder
let users = QueryBuilder::select(&["name", "email"])
    .from("users")
    .where_gt("age", 21)
    .order_by("name", Ordering::Asc)
    .limit(10)
    .execute(&db)?;

πŸ“ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  PUBLIC API     Database Β· Transaction Β· QueryBuilder     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  QUERY ENGINE   Parser β†’ Planner β†’ Optimizer β†’ Executor   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  MVCC           Snapshots Β· Version Chains Β· GC            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  STORAGE        Buffer Pool Β· B-Tree Β· WAL Β· Encryption    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

10 crates, clear boundaries:

Crate What it does
featherdb Public API β€” Database, Transaction, QueryBuilder
featherdb-core Value types, errors, configuration
featherdb-query SQL parser, planner, optimizer, executor
featherdb-storage B-tree, buffer pool, WAL, compression
featherdb-mvcc MVCC transactions and snapshots
featherdb-catalog Schema management, indexes, constraints
featherdb-crypto AES-256-GCM encryption
featherdb-derive #[derive(Table)] proc macro
featherdb-mcp MCP server for AI agents
featherdb-python Python bindings (PyO3)

πŸ“š Documentation

Getting Started Installation, first database, transactions, Python
SQL Reference Complete SQL syntax and data types
Function Reference All 30+ built-in SQL functions
API Reference All public types and methods
Configuration Buffer pool, encryption, compression, limits
Migrating from SQLite Feature comparison, API mapping, migration checklist
TPC-H Benchmarks Performance vs SQLite on all 22 TPC-H queries
Architecture Diagrams of internals
Feature Guides
Authentication API keys, Argon2id, key rotation
Permissions GRANT / REVOKE, table-level access control
Sessions Per-conversation isolation for MCP servers
Encryption AES-256-GCM encryption at rest
Foreign Keys Referential integrity, cascading actions
Observability Metrics API, query timing, diagnostics
Storage Limits Per-database quotas

🀝 Contributing

See CONTRIBUTING.md for build instructions, test commands, and code style.

MSRV: Rust 1.70 Β· Platform: Linux (x86_64, ARM64) Β· macOS (Intel, Apple Silicon)

πŸ“„ License

Dual-licensed under MIT or Apache 2.0, at your option.


v1.0.0 "Louise" β€” Each release is named after a Bob's Burgers or Futurama character.

About

The embedded SQL database built for AI agents. True MVCC, built-in encryption, MCP server. A SQLite alternative in pure Rust.

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages