npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

kvdb-client

v0.1.1

Published

Simple Node.js client for kvdb.io

Readme

kvdb-client

A simple Node.js client for KVdb.io. This is a third-party, unofficial SDK.

Install

npm install kvdb-client

Quick Start

1) Create a bucket

import { KVdbClient } from "kvdb-client";

const email = process.env.KVDB_EMAIL; // your email

if (!email) {
  throw new Error("KVDB_EMAIL is required");
}

const bucket = await KVdbClient.createBucket(email);
console.log("bucket:", bucket);

You can create a bucket just by providing an email address.

2) Read & write data

import { KVdbClient } from "kvdb-client";

const bucket = process.env.KVDB_BUCKET; // your bucket id
const token = process.env.KVDB_TOKEN; // optional

if (!bucket) {
  throw new Error("KVDB_BUCKET is required");
}

const kv = new KVdbClient({ bucket, token });

await kv.set("myName", "n0bisuke");
const name = await kv.get("myName");
console.log("myName:", name);

await kv.set("myData", { name: "test", value: 123 }, { json: true });
const data = await kv.get("myData", { parseJson: true });
console.log("myData:", data);

const keys = await kv.list();
console.log("keys:", keys);

3) Transaction (batch operations)

import { KVdbClient } from "kvdb-client";

const bucket = process.env.KVDB_BUCKET;
const token = process.env.KVDB_TOKEN; // optional

if (!bucket) {
  throw new Error("KVDB_BUCKET is required");
}

const kv = new KVdbClient({ bucket, token });

await kv.transaction([
  { set: "users:email:[email protected]", value: "user 1" },
  { delete: "users:email:[email protected]" }
]);

console.log("transaction done");

Authentication

// Basic auth (default)
const basic = new KVdbClient({ bucket: "YOUR_BUCKET", token: "supersecret" });

// Bearer token
const bearer = new KVdbClient({
  bucket: "YOUR_BUCKET",
  token: "ACCESS_TOKEN",
  authType: "bearer"
});

// Query string token
const query = new KVdbClient({
  bucket: "YOUR_BUCKET",
  token: "ACCESS_TOKEN",
  authType: "query"
});

Examples

See the examples/ folder on GitHub for runnable scripts.

Usage

Create a bucket

const bucket = await KVdbClient.createBucket("[email protected]");

Set / Get values

await kv.set("myName", "n0bisuke");
const name = await kv.get("myName");

JSON values

await kv.set("myData", { name: "test", value: 123 }, { json: true });
const data = await kv.get("myData", { parseJson: true });

List keys

const keys = await kv.list();
const items = await kv.list({ values: true, format: "json" });

Update (PATCH)

await kv.update("myName", "Sugawara");

Counters

await kv.increment("visits");
await kv.decrement("visits", 2);

Transactions

await kv.transaction([
  { set: "users:email:[email protected]", value: "user 1" },
  { delete: "users:email:[email protected]" }
]);

Create access token

const token = await kv.createAccessToken({
  prefix: "user:123:",
  permissions: "read,write",
  ttl: 3600
});

Delete a key

await kv.delete("myName");

Delete a bucket

await kv.deleteBucket();

API

  • new KVdbClient({ bucket, token?, authType?, baseUrl? })
  • KVdbClient.createBucket(email, { baseUrl?, secretKey?, writeKey?, readKey?, signingKey?, defaultTtl? })
  • get(key, { parseJson? })
  • set(key, value, { json?, contentType?, ttl? })
  • update(key, value, { json?, contentType?, ttl? })
  • increment(key, amount?, { ttl? })
  • decrement(key, amount?, { ttl? })
  • delete(key)
  • list({ values?, format?, limit?, skip?, prefix?, reverse? })
  • transaction(operations)
  • createAccessToken({ prefix?, permissions?, ttl? })
  • updateBucketPolicy({ secretKey?, writeKey?, readKey?, signingKey?, defaultTtl? })
  • deleteBucket()

Notes

  • KVdb buckets can be public; avoid storing sensitive data.
  • token for Basic auth is sent as curl -u 'token:'.
  • The SDK author (n0bisuke) has no knowledge of how data stored in KVdb is handled; use at your own risk. The author is not responsible for any issues or damages.

Related Article

  • https://qiita.com/n0bisuke/items/540478c314a09ee14ba9

Language

  • English (this file)
  • Japanese: README.ja.md
  • Japanese (GitHub): https://github.com/n0bisuke/kvdb-client/blob/main/README.ja.md