3 min readBy Shivraj Soni

xedis

A minimal Redis-style key-value store in Rust—persistent, crash-safe, and fun to hack on.

Xedis: A Redis-Style Key-Value Store in Rust

I wanted to understand how something like Redis could be simple and still durable—so I built Xedis. It’s a small key-value database in Rust: you get SET, GET, DEL, keys with optional expiry, and data that survives restarts (and crashes) thanks to a write-ahead log. No fancy clustering—just a single process, a lock file so two instances don’t step on each other, and a CLI or a TCP server if you want to talk to it from another app.

You can use it as an interactive CLI or run it as a server and hit it from the included Python client (or anything that speaks plain text over TCP).

Running it

Clone, build, then run:

git clone https://github.com/Shivrajsoni/xedis.git
cd xedis
cargo build --release
./target/release/xedis

At the prompt you can pick: interactive CLI, persistence demo, crash-recovery demo, or start the server. For the server, choose option 4; it listens on 127.0.0.1:7878.

Interactive CLI — you get a REPL. Type HELP for commands, QUIT to exit. Example:

$ ./target/release/xedis
Choose mode:
1. Interactive CLI (like real database)
2. Persistence demo
3. Crash recovery demo
4. Start server
Enter choice (1-4): 1
🚀 Welcome to Xedis DB - Your Simple Database!
✨ Features: Crash Safety, Concurrency Control, Write-Ahead Logging
💡 Type HELP for commands, QUIT to exit

Xedis db > SET name Alice
ok stored 'name'
Xedis db > GET name
value:  Alice
Xedis db > SET age 30 EX 10
ok stored 'age' with expiration at 1728026410
Xedis db > KEYS
Keys: name, age
Xedis db > SAVE
Manual checkpoint completed - database saved atomically
Xedis db > QUIT
👋 Goodbye! Your data is safely saved.

Python client — start the Xedis server, then in another terminal run python client.py. You can send the same kinds of commands (SET, GET, etc.) and see responses in the terminal.

$ python client.py
Connected to Xedis server at 127.0.0.1:7878
Enter commands to send to the server. Type 'exit' to close.
> SET city "New York"
Server response: ok stored 'city'
> GET city
Server response: value:  "New York"
> exit

Commands (quick reference)

| Command | What it does | | ------------- | -------------------------- | | SET <k> <v> | Set a key-value pair | | GET <k> | Get the value for a key | | DEL <k> | Delete a key | | KEYS | List all keys | | SIZE | Number of keys | | SAVE | Manual checkpoint to disk | | STATS | Database stats | | CRASH | Simulate a crash (testing) | | HELP | Show help | | QUIT | Exit CLI |

Tech

Rust, and Serde for serialization. Data lives on disk via a WAL; the lock file keeps multiple processes from opening the same DB at once.

What’s next (maybe)

I’d like to add more types (lists, sets), transactions, and perhaps replication or a simple GUI client—but for now it’s a solid little store to learn from or use locally.