Global Key-Value Store.beta

Get Started

gokv syncs your data at edge. It's built on top of Cloudflare edge network, durable, low-latency, and easy to use. Features including:

Installation

import gokv from "https://deno.land/x/gokv@0.0.23/mod.ts";

For Node.js runtime, you will require Node.js 14+:

npm install gokv

or import the web module via esm.sh in browsers:

import gokv from "https://esm.sh/gokv/web";

Setup

gokv can work in Deno, Node.js and browsers. You need to setup the environment before using it.

Set Access Token

Please log in https://gokv.io to get the access token.

import gokv from "https://deno.land/x/gokv@0.0.23/mod.ts";

gokv.config({ token: "xxxxxx" });

or set the token in environment variable with name GOKV_TOKEN without calling the config method.

Configuration in Browsers

You need to implement the /sign-access-token API by yourself, check out the Access Token.

import gokv from "https://esm.sh/gokv/web";

gokv.config({ signUrl: "/sign-access-token" });

Importing Web-Polyfill

gokv uses the standard web fetch, crypto and WebSocket API, you need to import the Web-Polyfill in Node.js environment.

import "gokv/web-ployfill";

Usage

import gokv from "https://deno.land/x/gokv@0.0.23/mod.ts";

// init storage
const kv = gokv.Storage({ namespace: "gokv-example" });

// listing keys
await kv.list();

// writing key-value pairs
await kv.put("message", "Hello world!");

// reading key-value pairs
await kv.get("message"); // Hello world!

// deleting ke-/value pairs
await kv.delete("message");