A Redis-like KV store where Git commit history is the database.
GitKV is a Redis-like Key-Value store that uses Git commits as the storage engine. Instead of a traditional database file, every SET, GET, DELETE, LIST, or MAP operation creates a new immutable event commit in Git.
State is reconstructed by replaying the commit history, enabling:
- 🔄 Full rollback to any point in time.
- 📡 Real-time event streaming via WebSockets.
- 📣 Pub/Sub channels.
- 🌎 Syncing DB through GitHub remote.
- 💥 No files, no DB—Git is the entire database.
Perfect for distributed, versioned, time-traveling state management or learning event-sourcing concepts.
graph TD;
CLI[CLI / REPL] --> REST[REST API];
REST --> Backend[Express Backend];
Backend -->|State = Replay Event Log| Log[Git Commit Log];
Log -->|git push/pull| Remote[GitHub Remote Repo];
WS[WebSocket Clients] -->|Monitor/Subscribe| Backend;
Backend -->|Updates| WS;
- CLI / REPL sends commands via HTTP REST
- Express backend converts commands to JSON event commits
- Each operation = a new immutable Git commit
- State is reconstructed by replaying Git history
- WebSockets notify clients with real-time updates
- Remote Git sync enables replication across machines✨ Features
| Feature | Status |
|---|---|
| Key-Value strings | ✔ |
| Lists (LPUSH / RPUSH / POP) | ✔ |
| Maps / Hashes | ✔ |
| History viewer | ✔ |
| Rollback to commit | ✔ |
| Live monitor via WebSockets | ✔ |
| Pub/Sub channels | ✔ |
| GitHub remote sync | ✔ |
| REPL with autocomplete | ✔ |
npm install
npm startcd cli
npm install
npm install ws chalk@4
npm linkkv-shellkv set <key> <value>
kv update <key> <value>
kv get <key>
kv delete <key>
kv exists <key>
kv keys
kv flushkv list lpush <key> <value>
kv list rpush <key> <value>
kv list lpop <key>
kv list rpop <key>
kv list get <key>kv map hset <key> <field> <value>
kv map hget <key> <field>
kv map hkeys <key>
kv map hdel <key> <field>kv history
kv rollback <commitId>kv monitor
kv subscribe <channel>
kv publish <channel> <message>kv remote add <repo-url>
kv sync
kv pullkv-shell
> set name Shreyash
OK
> get name
"Shreyash"
> monitor
Entering monitoring mode...Terminal 1
kv-shell
kv monitorTerminal 2
kv set name Shreyash
kv publish chat "Hello from KV"Real-time message instantly appears in monitoring terminal.
| Component | Tech |
|---|---|
| Backend | Node.js + Express |
| Storage | Git Commit Log |
| Messaging | EventEmitter + WebSockets |
| CLI | Node (commander, chalk, ws) |
| Sync | Git / GitHub remote |
| Architecture | Event-Sourced + Immutable Log |
- Git-powered database = persistence + replication + audit trail.
- Time travel debugging & rollback.
- Real-time pub/sub.
- Single source of truth.
- Awesome practical Event-Sourcing example.
Contributions welcome! Submit a PR.
MIT License
Shreyash Ghanekar