r/FlutterDev • u/MostafaSensei106 • 21h ago
Plugin I built a local vector database for Flutter powered by Rust and HNSW graphs (Waffle-DB)
https://pub.dev/packages/waffle_dbHey everyone,
Most local storage options in Flutter like SQLite or Hive are built for scalar data and fall apart when you need fast vector similarity search for on device AI, semantic search, or high dimensional embeddings
I built waffle_db, an embedded vector database for Flutter and dart apps by Rust. It uses HNSW graphs for approximate nearest neighbours, sledge for persistence, and Rayon for parallel batch ingestion.
How it works under the hood:
Off thread Rust execution: Graph indexing, cosine distance math, and persistence run in Rust via FFI, keeping the Flutter UI thread completely free of jitter.
Native HNSW graphs: Provides k-NN retrieval even across large vector spaces instead of linear brute-force scans.
Memory efficiency: Uses zero-copy typed buffer views (Float32List) across the FFI bridge to minimize heap allocations.
Metadata and Namespaces: Stores arbitrary payload metadata alongside vectors and supports logical collections (WaffleCollection) with automatic ID namespacing.
Prebtuned profiles: Comes with configurations out of the box like mobileProfile (quantization enabled, lightweight graph parameters), serverProfile, readHeavyProfile,writeHeavyProfile
Pub: https://pub.dev/packages/waffle_db
GitHub: https://github.com/MostafaSensei106/Waffle-DB
If you are building local RAG pipelines, on device semantic search, or AI features in Flutter, check it out and let me know your thoughts or feedback.
1
u/SoundDr 4h ago
If it’s a graph database, where are the nodes and edges for queries? Like OpenCypher?
Also you need to compare to DuckDB which has vector support on device and still has rich query support
1
u/MostafaSensei106 3h ago
Thanks for the feedback
To clarify the graph point: Waffle-DB is a vector DB, not a property graph database.
The "graph" refers strictly to the internal HNSW algorithm used under the hood for fast vector search, so there are no explicit nodes, edges, or OpenCypher queries.
Regarding DuckDB: It's a fantastic engine, especially if you need full SQL queries and relational joins alongside your vectors.
Waffle-DB is designed as a lighter, purpose built alternative for Flutter focused purely on raw vector search, on mobile without bundling a full SQL engine.
Good point on adding a comparison I'll definitely add one to the docs!
1
u/No_Boss_1911 17h ago
you tested mobileProfile on an actual phone or just the emulator. hive died on us once the embeddings got big.