************************************************

Docs

Fredb is meant to be the easiest option if you just want a persistent KV store for your project. As you can hopefully see by now, there is no sign up or anything needed from you. I want you to create a database as quickly as possible so I can have experience working on high-load systems!

Authentication

Every request needs an X-Api-Key header. Grab one above.

Endpoints


GET db.fredyang.com/key/KEY

Get a value from a key.

FieldValue
headerX-Api-Key: your key
path paramkey
body
response200, raw value as text
curl https://db.fredyang.com/key/hello \
  -H "X-Api-Key: $API_KEY"
await fetch("https://db.fredyang.com/key/hello", {
  headers: { "X-Api-Key": API_KEY },
}).then(r => r.text());
req, _ := http.NewRequest("GET", "https://db.fredyang.com/key/hello", nil)
req.Header.Set("X-Api-Key", apiKey)
resp, _ := http.DefaultClient.Do(req)
requests.get("https://db.fredyang.com/key/hello", headers={"X-Api-Key": API_KEY})
PUT db.fredyang.com/key/KEY

Add or update a value from a key.

FieldValue
headerX-Api-Key: your key
path paramkey
bodyvalue
response204, empty
curl -X PUT https://db.fredyang.com/key/hello \
  -H "X-Api-Key: $API_KEY" \
  -d "world"
await fetch("https://db.fredyang.com/key/hello", {
  method: "PUT",
  headers: { "X-Api-Key": API_KEY },
  body: "world",
});
req, _ := http.NewRequest("PUT", "https://db.fredyang.com/key/hello", strings.NewReader("world"))
req.Header.Set("X-Api-Key", apiKey)
http.DefaultClient.Do(req)
requests.put("https://db.fredyang.com/key/hello", headers={"X-Api-Key": API_KEY}, data="world")
DELETE db.fredyang.com/key/KEY

Delete a key/value pair.

FieldValue
headerX-Api-Key: your key
path paramkey
body
response204, empty
curl -X DELETE https://db.fredyang.com/key/hello \
  -H "X-Api-Key: $API_KEY"
await fetch("https://db.fredyang.com/key/hello", {
  method: "DELETE",
  headers: { "X-Api-Key": API_KEY },
});
req, _ := http.NewRequest("DELETE", "https://db.fredyang.com/key/hello", nil)
req.Header.Set("X-Api-Key", apiKey)
http.DefaultClient.Do(req)
requests.delete("https://db.fredyang.com/key/hello", headers={"X-Api-Key": API_KEY})
GET db.fredyang.com/range?start=START&end=END

Get a list of key/value pairs between two keys, determined alphabetically.

FieldValue
headerX-Api-Key: your key
query paramsstart, end: key range bounds
body
response200, JSON array of key/value pairs
curl "https://db.fredyang.com/range?start=a&end=z" \
  -H "X-Api-Key: $API_KEY"
await fetch("https://db.fredyang.com/range?start=a&end=z", {
  headers: { "X-Api-Key": API_KEY },
}).then(r => r.json());
req, _ := http.NewRequest("GET", "https://db.fredyang.com/range?start=a&end=z", nil)
req.Header.Set("X-Api-Key", apiKey)
resp, _ := http.DefaultClient.Do(req)
requests.get("https://db.fredyang.com/range", headers={"X-Api-Key": API_KEY}, params={"start": "a", "end": "z"})

Learn more about storage engines