A lightweight database engine built with Node.js that stores data in JSON files and implements core database concepts such as CRUD operations, indexing, query processing, and storage management.
This project is designed to help developers understand how databases work internally instead of simply using PostgreSQL, MySQL, or MongoDB.
Modern databases provide powerful APIs for storing and retrieving data. However, most developers never explore what happens behind the scenes when executing a query.
MiniDB is a simplified database engine that demonstrates:
- Data Storage
- Record Management
- CRUD Operations
- Query Processing
- Indexing
- File System Operations
- Database Architecture
By building MiniDB, you will learn the fundamental concepts used by real-world database systems.
- Understand database internals
- Learn how data is stored on disk
- Implement CRUD operations from scratch
- Build indexing mechanisms
- Apply Data Structures and Algorithms in real-world systems
- Simulate database query execution
Client Request
│
▼
Query Engine
│
▼
Storage Manager
│
▼
JSON Storage
Future architecture:
Client
│
▼
Query Parser
│
▼
Query Engine
│
▼
Index Manager
│
▼
Storage Engine
│
▼
Disk Storage
mini-db/
│
├── data/
│ └── users.json
│
├── indexes/
│ └── userIndex.json
│
├── db/
│ ├── database.js
│ ├── insert.js
│ ├── find.js
│ ├── update.js
│ ├── delete.js
│ └── query.js
│
├── app.js
│
└── README.mdinsert({
id: 1,
name: "Harsh",
age: 20
});findById(1);update(1, {
age: 21
});deleteUser(1);MiniDB stores records in JSON files.
Example:
[
{
"id": 1,
"name": "Harsh",
"age": 20
}
]This simulates how databases persist information on disk.
Example:
find({
age: 21
});Internal execution:
users.filter(
user => user.age === 21
);This demonstrates how databases process search conditions.
Without indexing:
findById(1000);Time Complexity:
O(n)
The database scans every record.
With indexing:
{
"1": 0,
"2": 1,
"3": 2
}Time Complexity:
O(1)
The database directly accesses the required record.
| Feature | Data Structure |
|---|---|
| Storage | Array |
| Records | Objects |
| Indexing | Hash Map |
| Search | Linear Search |
| Future Index | B+ Tree |
| Operation | Complexity |
|---|---|
| Insert | O(1) |
| Find | O(n) |
| Update | O(n) |
| Delete | O(n) |
| Indexed Search | O(1) |
- Node.js
- JavaScript (ES6+)
- File System (fs)
- JSON Storage
- Storage Engine
- Query Engine
- Indexing
- Data Persistence
- Record Management
- Arrays
- Objects
- Hash Maps
- Linear Search
- Time Complexity Analysis
- File Handling
- JSON Serialization
- CRUD Operations
- System Design Fundamentals
- Hash Indexing
- Secondary Indexes
- Fast Record Lookup
- SQL-like Query Language
Example:
db.query(
"SELECT * FROM users WHERE age = 20"
);- B+ Tree Indexes
Benefits:
- O(log n) Search
- O(log n) Insert
- O(log n) Delete
- REST API Layer
POST /users
GET /users/:id
PATCH /users/:id
DELETE /users/:id- Transactions
- Write-Ahead Logging (WAL)
- Caching
- Concurrency Control
After completing this project, you will understand:
- How databases store data
- How query engines work
- Why indexing improves performance
- Why Hash Maps are used in databases
- Why B+ Trees are the industry standard
- How backend systems manage persistent data
This project bridges the gap between:
- Data Structures & Algorithms
- DBMS
- Backend Development
- System Design
making it an excellent educational and portfolio project for aspiring software engineers.
Harsh Chauhan
BCA Student | Backend Developer | Future Software Engineer