// the find
vincent-herlemont/native_db
Drop-in embedded database in Rust
native_db is an embedded key-value store built on top of redb that adds typed indexes, automatic model migration, and real-time change subscriptions. It targets Rust apps that need a local database without SQLite — particularly desktop and mobile apps built with something like Tauri. Think of it as serde + redb with a query layer bolted on.
1. The derive-macro approach (#[native_db], #[primary_key], #[secondary_key]) keeps schema definition right on the struct with zero boilerplate — no separate schema files or ORM mapping tables. 2. Automatic model migration across versions is genuinely useful for shipped apps where you can't run ALTER TABLE; the versioned model system via native_model handles this without manual migration code. 3. Real-time subscriptions (watch API) for insert/update/delete with filters is a feature most embedded databases don't offer at all — useful for reactive UIs. 4. CI matrix covers Linux, macOS, Windows, iOS, and Android, so the cross-platform claim is actually verified, not just aspirational.
1. Unstable API by the author's own admission — you're accepting churn risk on a library that sits under your entire data layer. At 701 stars and 39 forks, the user base is small, meaning breaking changes will land with little community pressure to stabilize. 2. No SQL or query language — you're limited to primary/secondary key lookups and range scans. Any filtering logic beyond that lives in your application code, which gets ugly fast for anything beyond simple CRUD. 3. The static MODELS pattern (Lazy<Models>) is a leaky abstraction that forces global state into your app; this makes testing harder and feels like an unresolved design problem rather than a deliberate choice. 4. Optional secondary keys can't use range syntax — a documented footgun that will surprise anyone who reaches for it naturally.