Key-Value Store
Instant scoped storage for your site. Hit counters, leaderboards, saved state. No database setup.
Add the library
<script src="https://www.reocities.xyz/static/js/reokv.js"></script>
<script>
const kv = ReoKV("YOUR_READ_TOKEN");
</script>
Hit counter (read token)
const hits = await kv.incr("page_views");
document.getElementById("counter").textContent = hits;
Saving data (needs the write token)
Writes with set require the write token, so do them from a trusted place, not from public page JS.
const kvw = ReoKV("YOUR_WRITE_TOKEN");
await kvw.setJSON("scores", [{name:"Ada", score:9001}]);
const board = await kv.getJSON("scores"); // read token is fine for reading
All methods
| Method | What it does | Token |
kv.get(key) | Read a value (string or null) | read |
kv.list(prefix, limit) | List keys (optionally by prefix) | read |
kv.incr(key, by=1) | Atomically increment a counter, returns the new number | read |
kv.set(key, value) / kv.setJSON(key, obj) | Write a value | write |
kv.getJSON(key) | Read and parse JSON | read |
kv.del(key) | Delete a key | write |
REST API
Prefer raw HTTP? Hit /api/kv with your token in the X-Reo-KV header or ?token=.
curl "https://www.reocities.xyz/api/kv?action=incr&key=hits&token=READ_TOKEN"
Limits: values up to 64KB, up to 2000 keys, 120 ops per minute. The read token is public by design; never put the write token in page source. Do not store secrets in KV.