A lightweight, high-performance key-value store with HTTP API. Built with ReactPHP and SQLite.
This project provides a simple, performant and resource-efficient key-value store that can be easily deployed alongside microservices and Docker containers. It offers a straightforward HTTP API for storing and retrieving data with minimal overhead.
- RESTful HTTP API
- Persistent (optional) storage via SQLite
- Low resource usage (typical memory usage ~35MB, negligible CPU usage)
- Simple GET/PUT/DELETE operations
Run the container:
docker run --name kv -p 8080:8080 binaryfire/kv:latest
For data persistence, map the database directory to a volume:
docker run --name kv -p 8080:8080 -v kv-database:/var/www/database binaryfire/kv:latest
Method | Route | Description |
---|---|---|
GET | / | List all keys |
GET | /{key} | Get value for key |
PUT | /{key} | Set value for key |
DELETE | /{key} | Delete key |
The API uses plain text instead of JSON for both requests and responses, making it easier to use in scripts and with command-line tools.
When retrieving a value, the raw value is returned without any formatting. When listing all keys, each key is returned on a new line.
List all keys:
curl http://localhost:8080/
Get a specific value:
curl http://localhost:8080/my_key
Set a value (or overwrite existing value):
curl -X PUT -d "my value" http://localhost:8080/my_key
Delete a key:
curl -X DELETE http://localhost:8080/my_key
All keys must be in lowercase snake_case
format:
- Must contain only lowercase letters and numbers
- Words separated by underscores
- Example:
user_settings
,api_key_1
./build.sh
This will create Docker images tagged with the current timestamp and 'latest'.