dinoDB Simple embedded database in Go π
A lightweight, fun, and educational embedded database with HTTP API, beautiful REPL, WAL durability, and B-Tree indexing.
- What is dinoDB?
- Features
- Quick Start
- Interactive REPL
- HTTP REST API
- Project Structure
- Architecture Highlights
- Available Commands
- Environment & Docker
- Current Limitations
- Roadmap
- Troubleshooting
dinoDB is a simple embedded database written in Golang. It is designed for learning, prototyping, and small applications. You can use it via a beautiful terminal REPL or a REST HTTP API.
It supports basic SQL-like operations, persistence with WAL, and B-Tree indexing.
- SQL-like query support (CREATE, SELECT, INSERT, UPDATE, DELETE, DROP)
- Beautiful colored REPL with Unicode tables
- Full HTTP REST API
- Write-Ahead Logging (WAL) for durability & crash recovery
- B-Tree indexing for fast lookups
- Basic transaction support (
BEGIN,COMMIT,ROLLBACK) - Docker support
- ASCII Dino art on startup
git clone https://github.com/arijiiiitttt/dinoDB.git
cd dinoDB
go run .docker-compose up --buildThe server will be available at http://localhost:8080
After starting you will see the dino and enter the REPL:
dinoDB> CREATE TABLE users (name, age, email)
dinoDB> INSERT INTO users (id, name, age) VALUES ('u1', 'Alice', '30')
dinoDB> SELECT * FROM users
dinoDB> .tables| Type | Example | Description |
|---|---|---|
| Table | CREATE TABLE users (...) |
Create table |
DROP TABLE users |
Drop table | |
| CRUD | SELECT * FROM users |
Select records |
INSERT INTO users ... VALUES ... |
Insert record | |
UPDATE users SET age='31' WHERE id = 'u1' |
Update record | |
DELETE FROM users WHERE id = 'u1' |
Delete record | |
| Transactions | BEGIN / COMMIT / ROLLBACK |
Manage transactions |
| Shell | .tables / .help / .exit |
Utility commands |
Base URL: http://localhost:8080
| Method | Endpoint | Description |
|---|---|---|
| GET | /records/{table} |
Get all records |
| GET | /records/{table}/{id} |
Get one record |
| POST | /records/{table} |
Create record |
| PUT | /records/{table}/{id} |
Update record |
| DELETE | /records/{table}/{id} |
Delete record |
| GET | /tables |
List tables |
| POST | /query |
Run SQL query |
Example:
curl -X POST http://localhost:8080/records/users \
-H "Content-Type: application/json" \
-d '{"id":"u1","data":{"name":"Bob","age":25}}'dinoDB/
βββ main.go
βββ api/server.go
βββ engine/ # Core DB logic + transactions
βββ query/ # SQL parser
βββ index/btree.go
βββ storage/ # WAL + Disk manager
βββ repl/repl.go
βββ public/dinoDB.png
βββ Dockerfile
βββ docker-compose.yml
βββ go.mod
- WAL for durability
- B-Tree for indexing
- RWMutex for concurrency safety
- Automatic recovery on startup
- Simple document-style records
No special environment variables needed.
Docker volume /data is used for persistence.
- Basic query parser (no complex WHERE, no JOINs)
- Only exact match filtering supported
- Transactions are basic
- Disk storage is still being improved
| Problem | Solution |
|---|---|
| REPL not showing properly | Use modern terminal (supports Unicode) |
| Data not saving | Check permissions in ./dinoDB folder |
| Docker issues | docker-compose up --build --force-recreate |
| API not responding | Make sure server is running on port 8080 |
Contributions and feedback are welcome!
