Skip to content

Commit e52c427

Browse files
committed
Add readme and GH workflow
1 parent fbe8db1 commit e52c427

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed

.github/workflows/docker-image.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Build the Docker image
17+
run: |
18+
docker build . --file Dockerfile \
19+
--tag ghcr.io/${{ github.repository }}:$(date +%s) \
20+
--tag ghcr.io/${{ github.repository }}:latest

README.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# KV Store
2+
3+
A lightweight, high-performance key-value store with HTTP API. Built with ReactPHP and SQLite.
4+
5+
## Overview
6+
7+
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.
8+
9+
## Features
10+
11+
* RESTful HTTP API
12+
* Persistent storage via SQLite
13+
* Low resource usage (typical memory usage ~35MB, negligible CPU usage)
14+
* Simple GET/PUT/DELETE operations
15+
16+
## Getting Started
17+
18+
### Running with Docker
19+
20+
Run the container with default settings:
21+
22+
```
23+
docker run -p 8080:8080 ghcr.io/binaryfire/kv:latest
24+
```
25+
26+
For data persistence, map the database directory to a volume:
27+
28+
```
29+
docker run -p 8080:8080 -v kv-database:/var/www/database ghcr.io/binaryfire/kv:latest
30+
```
31+
32+
## API Routes
33+
34+
| Method | Route | Description |
35+
| --- | --- | --- |
36+
| GET | / | List all keys |
37+
| GET | /{key} | Get value for key |
38+
| PUT | /{key} | Set value for key |
39+
| DELETE | /{key} | Delete key |
40+
41+
## Usage Examples
42+
43+
List all keys:
44+
45+
```
46+
curl http://localhost:8080/
47+
```
48+
49+
Get a specific value:
50+
51+
```
52+
curl http://localhost:8080/my_key
53+
```
54+
55+
Set a value (or overwrite existing value):
56+
57+
```
58+
curl -X PUT -d "my value" http://localhost:8080/my_key
59+
```
60+
61+
Delete a key:
62+
63+
```
64+
curl -X DELETE http://localhost:8080/my_key
65+
```
66+
67+
## Key Format Requirements
68+
69+
All keys must be in lowercase \`snake\_case\` format:
70+
71+
* Must contain only lowercase letters and numbers
72+
* Words separated by underscores
73+
* Example: `user_settings`, `api_key_1`
74+
75+
## Building from Source
76+
77+
```
78+
./build.sh
79+
```
80+
81+
This will create Docker images tagged with the current timestamp and 'latest'.

0 commit comments

Comments
 (0)