rusqlite
An ergonomic, safe Rust wrapper around SQLite with typed rows and prepared statement caching.
Repository Health
Technical Analysis
rusqlite is the de facto standard Rust binding for SQLite, wrapping the C API in a safe, idiomatic interface built on top of the companion libsqlite3-sys crate. It exposes connections, prepared statements, transactions, and typed row/parameter conversion via FromSql/ToSql traits, letting applications read and write SQLite databases without hand-rolling FFI calls.
The crate is feature-gated so consumers only pay for what they use: optional support for blobs, backups, user-defined functions, collations, virtual tables, tracing hooks, and a bundled feature that compiles and statically links an up-to-date SQLite from source, sidestepping mismatched system library versions. This design has made it the go-to embedded-database driver across CLI tools, desktop apps, and services built in Rust.
What You Get
- A safe
Connectiontype wrapping SQLite’s C API with automatic resource cleanup - Typed row and parameter conversion via
FromSql/ToSql, including support for chrono, time, jiff, uuid, and serde_json types behind feature flags - Prepared statement execution and caching for repeated queries
- Transactions and savepoints with RAII-style commit/rollback semantics
- A
bundledfeature that compiles SQLite (or SQLCipher) from source, avoiding system library version mismatches - Optional support for blobs, online backup, user-defined functions, collations, virtual tables, and tracing/profiling hooks
Common Use Cases
- Embedding a zero-configuration relational database in CLI tools and desktop applications
- Local caching or offline-first data storage for services that sync to a remote database
- Prototyping data models with a real SQL engine before migrating to Postgres/MySQL
- Building custom SQLite extensions or virtual tables directly in Rust
Under The Hood
Architecture — rusqlite is a thin, safe façade over libsqlite3-sys, a sibling crate in the same Cargo workspace that generates raw FFI bindings to SQLite’s C API. Connection wraps a raw sqlite3* handle (inner_connection.rs), Statement/raw_statement.rs wrap prepared statements, and row.rs/column.rs provide zero-copy row access with lazy column decoding. Unsafe FFI calls are isolated to a small surface (errmsg_to_string, unsafe impl Send for Connection, blob/backup/session modules) so application code never touches raw pointers directly. Tech Stack — pure Rust (99.5% of the codebase) targeting the 2024 edition, with the bundled feature invoking the cc crate to compile SQLite/SQLCipher from vendored C source at build time; optional integrations add chrono, time, jiff, uuid, and serde_json conversions behind Cargo features so unused dependencies aren’t compiled in. Code Quality — the tests/ directory and inline #[test] modules throughout src/ cover connection lifecycle, transactions, virtual tables, and extension loading; CI badges (GitHub Actions, AppVeyor, Codecov, deps.rs) indicate active cross-platform testing and dependency monitoring. Errors are modeled via a dedicated error.rs with a rich Error enum rather than panics, and the crate has maintained API stability across 40+ releases since 2014. API Design — the API mirrors rust-postgres idioms (query_map, execute, positional/named parameters via tuples or &[&dyn ToSql]), keeping the learning curve low for Rust developers already familiar with that ecosystem; the README’s quickstart example demonstrates a working CREATE/INSERT/SELECT round-trip in under 20 lines, and cargo feature flags let users opt into exactly the surface area (blobs, hooks, vtab, bundled builds) their project needs.
Used by 22 apps in this directory
Jan
AI Assistants
Run LLMs 100% locally with full privacy, or connect to cloud AI — your machine, your data, your control.
Kuku
Note Taking
A local-first, open-source Markdown knowledge workspace for macOS — plain files, personal wiki and Second Brain workflows, AI-assisted diffs, and encrypted sync, built as an Obsidian alternative.
Lokus
Knowledge Management · Note Taking
Local-first note-taking with graph view, canvas & AI plugins—your Markdown files, zero telemetry, blazing-fast Rust performance.
mesh-llm
AI Agents · AI Development
Mesh LLM pools GPUs and memory across every machine you own into one OpenAI-compatible API, so agents tap distributed compute instead of a single GPU box or a metered cloud bill.
MicroBin
File Storage
A self-contained, encrypted paste bin and file-sharing app in Rust with animal-name URLs, burn-after-read, and one-command Docker deployment.
openfootmanager
Game Development
A free and open source football management simulation game built with Rust and Tauri, inspired by Football Manager.
OpenViking
AI Development · AI Memory · Databases
An open-source context database that gives AI agents a unified filesystem for memory, resources, and skills with hierarchical tiered retrieval.
Rivet
AI Agents · Developer Tools
Stateful actors as a primitive for AI agents, real-time collaboration, and durable execution — with in-memory state, WebSockets, queues, and scheduling built in.
Spacedrive
Collaboration · File Storage
One file manager for all your devices and clouds — powered by a Virtual Distributed File System built in Rust.