zedis README

The project's README from github.com/barddoo/zedis. As one markdown file: README.md.

Zedis

Release

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.

Not intended for production use yet.

Features

Caveats

Quick Start

Download the binary from the releases page or build from source to get started with Zedis.

Prerequisites

Building and Running

# Clone the repository
git clone https://github.com/barddoo/zedis.git
cd zedis

# Build the project (optimized, ReleaseFast)
zig build --release=fast

# Run the server
zig build run --release=fast

The server will start on 127.0.0.1:6379 by default.

Testing with Redis CLI

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

Docker

Pre-built images are available on Docker Hub:

docker run -p 6379:6379 barddoo/zedis

Variants

Tag Base Notes Use case
latest, x.x.x, x.x.x-debian, x.x.x-slim Debian Trixie slim Larger, glibc base Default; broader ecosystem
x.x.x-alpine, alpine Alpine 3.20 Smallest with shell Size-sensitive deployments
x.x.x-distroless Distroless static No shell Security-sensitive

Persistent data

Mount a volume to persist data across restarts:

docker run -p 6379:6379 -v zedis-data:/var/lib/zedis/data barddoo/zedis

Custom config

docker run -p 6379:6379 -v ./zedis.conf:/etc/zedis/zedis.conf barddoo/zedis

Development

Project Structure

The codebase is split by responsibility:

See docs/server-architecture.md for the current server thread model and request flow.

Memory Management

See docs/memory-architecture.md for the current allocator layout, memory budgets, and runtime allocation behavior. See docs/store-cache-layout.md for the store's hash-table layout and cache behavior.

Building for Development

# Build in debug mode (default)
zig build

# Build optimized release (ReleaseFast; use this for benchmarks and performance testing)
zig build --release=fast

# `--release` with no mode also picks ReleaseFast (the preferred mode in build.zig)
zig build --release

# Run the full test suite
zig build test

# Run a focused subset
zig build test -Dtest-filter="Store"

# Format the source
zig fmt .

AI Disclaimer

This project was developed with some AI help. Most of the code was written by hand.

Contributing

Contributors are welcome! Whether you're fixing bugs, adding features, improving documentation, or suggesting enhancements, your contributions are appreciated.

Feel free to:

Check out the open issues to see where you can help.

Stay Connected

Thanks

zedis (barddoo/zedis)

in-memory-database
Searching Database…

296 ·GitHub
What is this?Zedis is a Redis-protocol-compatible in-memory data store written in Zig, built for learning and experimentation rather than production use.
Is it a library I embed, or a standalone server I run?It is a standalone server process that speaks the Redis Serialization Protocol (RESP), so you connect to it with any normal redis-cli or Redis client, not with a code library.
How do I get it running?Download a prebuilt binary from the releases page, build from source, or pull one of the Docker Hub images; by default the server listens on 127.0.0.1:6379.
Is Zedis ready to use in production?No — the README explicitly warns it is not production-ready yet and is meant for learning and experimentation.
Does my data survive a restart?Yes, it supports point-in-time RDB snapshots plus an append-only file (AOF) with group commit for durable write-ahead logging.
What data types does Zedis support beyond plain keys?Strings and integers, lists, a time series type with Gorilla compression, and Bloom filters.
How does it behave when memory runs out?It enforces a Redis-compatible maxmemory limit with eviction and rejects allocating commands with an OOM error; inside containers it can auto-size its memory budget based on cgroup limits.
What Docker image variants are available?Debian Trixie slim (default), Alpine (smaller, has a shell), and a distroless static image for security-sensitive deployments.
Was AI used to build this project?The author notes the project was developed with some AI assistance, but most of the code was written by hand.
What are similar projects?redis, dragonfly, kividb, phpredis, dicedb, valkey, redis, node-redis
Creator
barddoo
Size
3.5 MB
Stars
296
Age
1y
Commits · 90 Days