I recently built MiniDB Studio, a lightweight database engine in pure C (C11)
as a learning project. Here's what I ended up building and what surprised me along the way.
What it does
- B+ Tree indexing on id and age fields
- Hash indexes for fast exact lookups
- WAL-style crash recovery with CSV snapshot replay
- A native desktop UI built with raylib
- A lightweight query optimizer for range scans and ordered traversal
The hardest part
Getting WAL replay to behave correctly after a crash mid-write was the
most painful part. The tricky case is when a write is partially flushed
before the crash — you need to detect the incomplete entry and roll back
to the last clean checkpoint without corrupting the rest of the log.
The architecture
The project is split into two layers:
- A reusable pure C storage engine library
- A separate UI binary that links against it
Keeping them decoupled meant I could test the engine independently
without the UI getting in the way.
What I'd do differently
If I built this again I'd add a proper buffer pool manager earlier.
Right now reads go straight to disk more often than they should.
Links
- GitHub: https://github.com/hyeonjo00/c-mini-db-engine
- Whitepaper: https://github.com/hyeonjo00/c-mini-db-engine/blob/main/docs/minidb-studio-algorithm-whitepaper-en.pdf
Feedback welcome — especially on the storage engine design.
This article was originally published by DEV Community and written by kimhjo.
Read original article on DEV Community