A Redis clone built from scratch in Go. Implements a TCP server that speaks the Redis RESP protocol, with a built-in terminal UI client.
- TCP server listening on port
5001 - RESP (REdis Serialization Protocol) parsing
- In-memory key-value store with persistence
- Key expiry with TTL support (lazy + active cleanup)
- Concurrent client handling via goroutines
- Data saved to
.godis/godis.jsonon shutdown and every minute - Built-in TUI client with Catppuccin Mocha theme:
Ctrl+Pcommand palette with live search- Context sidebar (server, session stats, shortcuts, working dir)
- Scrollable history (mouse wheel / PageUp-Down) with a scrollbar
| Command | Description |
|---|---|
SET key value [ttl] |
Store a value, optional TTL in seconds |
GET key |
Retrieve a value |
DEL key |
Delete a key |
EXISTS key |
Check if a key exists |
TTL key |
Get remaining time on a key |
EXPIRE key seconds |
Set or update expiry on a key |
KEYS * |
List all keys |
Run the server:
make runRun the TUI client (in a separate terminal):
make cli| Key | Action |
|---|---|
Ctrl+P |
Open command palette (searchable) |
↑ / ↓ |
Navigate command history |
Tab |
Autocomplete command |
Mouse wheel |
Scroll the history panel |
PageUp / PageDown |
Scroll history a page |
Ctrl+U / Ctrl+D |
Scroll history half a page |
Ctrl+L or CLEAR |
Clear screen |
Ctrl+Backspace |
Delete last word |
ESC |
Quit |
godis/
├── main.go # Server, connection handling, message routing
├── peer.go # Per-client connection and RESP reading
├── protocol.go # RESP command parsing
├── keyval.go # In-memory key-value store
├── client/
│ └── client.go # Go client library
├── tui/
│ └── tui.go # Terminal UI (Bubble Tea + Lipgloss)
└── cmd/cli/
└── main.go # TUI client entry point
- tidwall/resp — RESP protocol parsing
- charmbracelet/bubbletea — TUI framework
- charmbracelet/lipgloss — TUI styling
- superstarryeyes/bit — ANSI font rendering for the logo
by TWAHaaa
