Hi everyone! ๐ Iโd like to share a backend engineering project that Iโve been working on:
YaraDB โ a lightweight, document-oriented in-memory database built entirely with Python and FastAPI, designed to work natively with Pydantic models.
๐ Repo: Repo
Key Technical Features:
- โก Hybrid Storage Engine: Organize data into Tables that support both Strict Mode (rigid schema enforcement) for critical data and Free Mode (schema-less) for rapid prototyping.
- ๐ Advanced Indexing: Don't just scanโsearch. Includes built-in Hash Indexes for O(1) lookups and B-Tree Indexes for fast range queries and sorting (O(log n)).
- ๐ก๏ธ Optimistic Concurrency Control (OCC): Built-in protection against race conditions using document versioning (returns 409 Conflict on mismatches).
- ๐พ Persistence: Implements WAL (Write-Ahead Logging) and Snapshots, so you don't lose data if the server restarts or crashes.
- ๐ HTTP-Native: No drivers needed โ it runs on FastAPI, so you can interact with it via standard REST calls or the built-in Swagger UI.
๐ฑ Why I Built It
I love Redis, but for many Python microservices, I found myself writing the same validation logic over and over again to ensure the JSON I got back wasn't broken.
My goals were:
- To create a storage solution where Data Integrity is a first-class citizen (Schema-first approach).
- To dive deep into database internalsโimplementing my own WAL, Indexing engine, and Concurrency Control logic in Python was a huge learning experience.
- To make a tool perfect for AI Agents and LLMs that need structured short-term memory without the complexity of setting up a heavy SQL server.
- It's currently in the Alpha/MVP stage. Itโs not a "Redis killer" (C is faster, obviously), but itโs a robust, developer-friendly alternative for Python-heavy stacks.
๐ค Contributing
I am actively looking for feedback on the architecture, especially regarding the WAL implementation and performance optimizations.
If you are interested in backend engineering, database internals, or just want a lightweight DB for your next pet project, check it out!
Feedback and โญ stars are highly appreciated!
Top comments (0)