kvdb is an in-memory key-value store written in the Go programming language.
It uses a simple client-server model and is designed to be easy to use. It can be used as a database, session storage, or cache. It may not be suitable for complex needs.
Data is stored at keys of different types. You can store data ranging from basic string values to large objects.
Instances are easily configurable with environment variables and a simple YAML file.
Components:
kvdbserver
- The server processkvdb-cli
- CLI tool to manage the server
Note! This project is in early development.
Currently supported data types:
String
HashMap
Release notes are available here.
Binaries are available for download. Multiple platforms supported. You can download them here.
However, it is recommended to build the binaries from source. Instructions on how to build from source below.
Releases are managed with GoReleaser.
To build the binaries, you first need to install Go. Minimum version required is go1.22.
Instructions for installing Go can be found here.
You may also need tools to work with gRPC and Protocol Buffers in Go. This is needed if you want to compile .proto
files and generate Go code.
If you just want to compile the binaries then installing only Go is enough.
After you have successfully installed go, clone this repository.
Cloning with git:
git clone https://github.com/hollowdll/kvdb.git
Note: You can also download the source code for a specific release here.
Change directory to the project root:
cd kvdb
Get the dependencies:
go mod tidy
Build the server:
go build -o ./bin/kvdbserver/ ./cmd/kvdbserver/
Build the CLI:
go build -o ./bin/kvdb-cli/ ./cmd/kvdb-cli/
These will build the binaries to bin/
directory in the project root. You can change the output directory and binary names to whatever you like by modifying the path with -o
flag.
For more advanced build, use go help build
to see more build options.
Images are available in Docker Hub with multiple tags. Links below.
docker pull hakj/kvdb
Make sure to be in the project root
cd kvdb
Latest tag
docker build -f "./Dockerfile.bookworm" -t kvdb:latest .
Debian based image
docker build -f "./Dockerfile.bookworm" -t kvdb:bookworm .
Alpine Linux based image
docker build -f "./Dockerfile.alpine" -t kvdb:alpine .
These commands build the image only for a single architecture. If you want to build multi-arch images for other platforms, read this.
Example of starting a container
docker run -p 12345:12345 --rm -it kvdb
This binds the host's port 12345
to the container's port 12345
so you can access the server outside the container.
Change directory to the project root:
cd kvdb
Run all tests:
go test ./...
Run only integration tests:
go test ./tests/integration
Integration test environment is configurable. Below is a list of environment variables that can be used when running integration tests.
KVDB_PORT
: Test server TCP/IP port. Default port is 12345.KVDB_HOST
: Test server address. The test client will try to connect to this. Default address is localhost.
This project is licensed under MIT license. It is free and open source software.