Skip to content
TS
Résumé

Custom database engine with B+ Tree indexing

Hybrid-DB

Systems2025

A database engine written from scratch — B+ Tree index, file persistence and a REST layer on top.

50
Tree order
5
Operations

Problem

Most developers only ever see a database through an ORM. I wanted to understand what actually happens underneath — indexing, node splits and merges, persistence — by building one.

Solution

A Java engine whose tables are indexed by a B+ Tree supporting lookups, inserts, updates, deletes and range queries, with typed schemas, file-based persistence, caching and block storage. A Spring Boot REST API executes CRUD directly through the tree, and a lightweight web UI creates tables and runs queries.

Key engineering decisions

  • No ORM, no external database: every REST call goes straight through the custom B+ Tree.
  • A high-fan-out tree (order 50) keeps the tree shallow, so a lookup touches very few nodes.
  • Engine, schema, storage and server live in separate packages, so the storage layer can change without touching the API.

Features

  • Fully functional B+ Tree: lookups, inserts, deletes and range queries
  • Node split and merge with rebalancing
  • Schema manager with typed columns
  • File-based persistence, caching and block storage
  • REST API and a browser UI for table management and CRUD

Hardest problem

  • Getting deletes right: merging and redistributing underfull nodes while keeping keys and child pointers consistent all the way up to the root.

Tech stack