barddoo/zedis
Redis in Zig
A Redis-compatible in-memory data store written in Zig, designed for learning and experimentation. Zedis implements the core Redis protocol and data structures with a focus on simplicity, performance, and thread safety.
Made for learning purposes. Not intended for production use for now.
See the open issues for upcoming features and improvements.
Download the binary from the releases page or build from source to get started with Zedis.
# Clone the repository
git clone https://github.com/barddoo/zedis.git
cd zedis
# Build the project
zig build
# Run the server
zig build run
The server will start on 127.0.0.1:6379 by default.
You can test Zedis using the standard redis-cli or any Redis client:
# Connect to Zedis
redis-cli -h 127.0.0.1 -p 6379
# Try some commands
127.0.0.1:6379> SET mykey "Hello, Zedis!"
OK
127.0.0.1:6379> GET mykey
"Hello, Zedis!"
127.0.0.1:6379> INCR counter
(integer) 1
127.0.0.1:6379> TYPE mykey
string
The codebase follows Zig conventions with clear separation of concerns:
All memory allocations are handled during the initialization phase. No dynamic memory allocation occurs during command execution, ensuring high performance and predictability. Hugely inspired by this article.
# Build in debug mode (default)
zig build -Doptimize=Debug
# Build optimized release
zig build -Doptimize=ReleaseFast
# Run tests (when available)
zig build test