One-click deploy a KV server to Cloudflare Workers. It is similar to Cloudflare API for KV but you just need a self-generate JWT token instead of using Cloudflare auth key and email. You can also customize each JWT token with expiry date, action permissions or whitelist key patterns.
- Clone this repo
- Config
wrangler.toml
and setname
,kv_namespaces
- Run
wrangler login
andwrangler publish
Its optional but recommend to set a Secret to protect your endpoint. You can either set AUTH_SECRET
in wrangler.toml
or set a secret binding in Cloudflare Workers dashboard to increase security.
After setting a Secret, you can use Online Token Generator to generate token or build it yourself (./packages/auth-token-gen
).
Please make sure you use the same Secret to match the token generator.
If you setup an auth secret and generated a token please include it in Authorization
HTTP header field with Bearer <JWT auth token>
value. For example:
Authorization: Bearer xxxxxx.xxxxxxxxxxx.xxxxxxxxxxxxxx
List keys
Permission: List
GET :namespace_identifier/keys
URL Query Params:
limit, cursor, prefix
Get value
Permission: Get
GET :namespace_identifier/values/:key_name
URL Query Params:
cache_ttl
Get value metadata
Permission: GetWithMetaData
GET :namespace_identifier/values_metadata/:key_name
URL Query Params:
cache_ttl
Put value to key
Permission: Put
PUT :namespace_identifier/values/:key_name
URL Query Params:
expiration, expiration_ttl, metadata
Delete key
Permission: Delete
DELETE :namespace_identifier/values/:key_name