A lightweight, container-ready key-value store with a simple REST interface. Perfect for microservice architectures where you need zero-configuration data storage with minimal overhead.
- Zero Configuration - Run it out of the box, no database setup required
- RESTful API - Simple, intuitive HTTP endpoints for data operations
- Lightweight - Minimal footprint ideal for containerized deployments
- Docker Ready - Pre-built Docker image available on GitHub Container Registry
- Fast - In-memory storage for near-instant access times
# Pull and run the image
docker run -d -p 3000:3000 ghcr.io/jtabet/kvr:latest
# Or build locally
git clone https://github.com/jtabet/kvr.git
cd kvr
docker build -t kvr .
docker run -d -p 3000:3000 kvr# Clone the repository
git clone https://github.com/jtabet/kvr.git
cd kvr
# Install dependencies
npm install
# Start the server
npm startThe server will start on port 3000 (configurable via PORT environment variable).
PUT /:key
Stores or updates a value for the specified key.
Request:
curl -X PUT http://localhost:3000/session-123 \
-H "Content-Type: text/plain" \
-d "active"Response:
active
GET /:key
Retrieves the value associated with the specified key.
Request:
curl http://localhost:3000/session-123Response:
active
If the key doesn't exist:
{
"error": "Key not found"
}HTTP Status: 404 Not Found
DELETE /:key
Deletes the specified key and its value.
Request:
curl -X DELETE http://localhost:3000/session-123Response:
{
"deleted": "session-123"
}DELETE /
Removes all keys from the store.
Request:
curl -X DELETE http://localhost:3000/Response:
{
"deleted": "all"
}Store temporary session data between service calls:
# Store session state
curl -X PUT http://localhost:3000/session-abc123 \
-d '{"userId": 456, "authToken": "xyz789"}'
# Retrieve session state
curl http://localhost:3000/session-abc123Quickly toggle features without redeploying services:
# Enable a feature
curl -X PUT http://localhost:3000/feature/new-ui -d "enabled"
# Check feature status in your service
curl http://localhost:3000/feature/new-uiCache computed results or API responses:
# Cache expensive computation result
curl -X PUT http://localhost:3000/cache/report-daily \
-d '{"data": [...], "timestamp": 1234567890}'
# Retrieve cached result
curl http://localhost:3000/cache/report-dailyCoordinate between microservices with shared state:
# Service A sets a lock
curl -X PUT http://localhost:3000/locks/process-456 -d "locked"
# Service B checks lock status
curl http://localhost:3000/locks/process-456
# Service A releases lock
curl -X DELETE http://localhost:3000/locks/process-456PORT- Server port (default:3000)
version: '3.8'
services:
kvr:
image: ghcr.io/jtabet/kvr:latest
ports:
- "3000:3000"
environment:
- PORT=3000
restart: unless-stoppedapiVersion: apps/v1
kind: Deployment
metadata:
name: kvr
spec:
replicas: 1
selector:
matchLabels:
app: kvr
template:
metadata:
labels:
app: kvr
spec:
containers:
- name: kvr
image: ghcr.io/jtabet/kvr:latest
ports:
- containerPort: 3000
env:
- name: PORT
value: "3000"
---
apiVersion: v1
kind: Service
metadata:
name: kvr
spec:
selector:
app: kvr
ports:
- protocol: TCP
port: 3000
targetPort: 3000Since KVR is a simple key-value store, ensure the service is running by making a test request:
# Store a health check key
curl -X PUT http://localhost:3000/health -d "ok"
# Verify it's accessible
curl http://localhost:3000/health# Clone the repository
git clone https://github.com/jtabet/kvr.git
cd kvr
# Install dependencies
npm install
# Start in development mode
npm startdocker build -t kvr:latest .# Currently, manual testing is recommended using curl:
curl -X PUT http://localhost:3000/test-key -d "test-value"
curl http://localhost:3000/test-key
curl -X DELETE http://localhost:3000/test-keyconst axios = require('axios');
const baseURL = 'http://localhost:3000';
// Store a value
await axios.put(`${baseURL}/config/api-key`, 'secret-key-123');
// Get a value
const response = await axios.get(`${baseURL}/config/api-key`);
console.log(response.data); // 'secret-key-123'
// Delete a key
await axios.delete(`${baseURL}/config/api-key`);import requests
base_url = 'http://localhost:3000'
# Store a value
requests.put(f'{base_url}/config/api-key', data='secret-key-123')
# Get a value
response = requests.get(f'{base_url}/config/api-key')
print(response.text) # 'secret-key-123'
# Delete a key
requests.delete(f'{base_url}/config/api-key')package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
baseURL := "http://localhost:3000"
// Store a value
req, _ := http.NewRequest("PUT", baseURL+"/config/api-key", strings.NewReader("secret-key-123"))
client := &http.Client{}
client.Do(req)
// Get a value
resp, _ := http.Get(baseURL + "/config/api-key")
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body)) // 'secret-key-123'
// Delete a key
req, _ = http.NewRequest("DELETE", baseURL+"/config/api-key", nil)
client.Do(req)
}Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
KVR - Keep it Simple, Keep it Fast, Keep it Running.