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

@jsondb-cloud/client

v1.0.20

Published

Official JavaScript/TypeScript SDK for jsondb.cloud

Readme

@jsondb-cloud/client

The official JavaScript/TypeScript SDK for jsondb.cloud — a hosted JSON document database.

npm version npm downloads CI TypeScript Node.js Bundle size GitHub stars Last commit License: MIT

Install

npm install @jsondb-cloud/client

Quick Start

import { JsonDB } from "@jsondb-cloud/client";

const db = new JsonDB({ apiKey: "jdb_sk_live_xxxx" });
const users = db.collection<{ name: string; email: string }>("users");

// Create
const alice = await users.create({ name: "Alice", email: "[email protected]" });

// Read
const user = await users.get(alice._id);

// List with filter
const admins = await users.list({
  filter: { role: "admin" },
  sort: "-$createdAt",
  limit: 10,
});

// Update
await users.patch(alice._id, { email: "[email protected]" });

// Delete
await users.delete(alice._id);

Configuration

| Option | Type | Default | Description | |--------|------|---------|-------------| | apiKey | string | — | Required. API key (jdb_sk_live_... or jdb_sk_test_...) | | project | string | "v1" | Project identifier | | baseUrl | string | "https://api.jsondb.cloud" | API base URL | | timeout | number | 30000 | Request timeout in milliseconds | | retry | object | { enabled: true, maxRetries: 3 } | Retry with exponential backoff | | headers | Record<string, string> | {} | Extra headers for every request | | fetch | typeof fetch | globalThis.fetch | Custom fetch implementation |

API

Collection CRUD

  • create(doc, options?) — Create a document
  • get(id) — Get a document by ID
  • list(options?) — List documents with filtering, sorting, pagination
  • count(filter?) — Count documents matching an optional filter
  • update(id, doc) — Replace a document entirely
  • patch(id, partial) — Partial update (merge-patch)
  • jsonPatch(id, operations) — Apply JSON Patch operations (RFC 6902)
  • delete(id) — Delete a document

Query Builder

  • where(field, op, value) — Start a fluent query (==, !=, >, >=, <, <=, contains, in)
  • orderBy(field) — Sort results
  • limit(n) / offset(n) — Paginate
  • select(...fields) — Pick fields
  • exec() — Execute the query

Bulk Operations

  • bulk(operations) — Execute mixed bulk operations
  • bulkCreate(docs) — Create multiple documents

Schema Validation

  • setSchema(schema) — Set a JSON Schema for the collection
  • getSchema() — Get the current schema
  • removeSchema() — Remove the schema
  • validate(doc) — Validate a document without storing

Version History

  • listVersions(id) — List all versions of a document
  • getVersion(id, version) — Get a document at a specific version
  • restoreVersion(id, version) — Restore to a specific version
  • diffVersions(id, from, to) — Diff two versions

Webhooks

  • createWebhook(options) — Register a webhook
  • listWebhooks() — List all webhooks
  • getWebhook(id) — Get webhook details with recent deliveries
  • updateWebhook(id, options) — Update a webhook
  • deleteWebhook(id) — Delete a webhook
  • testWebhook(id) — Send a test event

Import / Export

  • importDocuments(docs, options?) — Import documents (fail/skip/overwrite on conflict)
  • exportDocuments(options?) — Export all documents

Real-time Streaming

  • stream(options?) — Subscribe to real-time changes via SSE
    • Events: created, updated, deleted, change

Error Handling

import { JsonDB, NotFoundError, ValidationError } from "@jsondb-cloud/client";

try {
  const user = await users.get("nonexistent");
} catch (err) {
  if (err instanceof NotFoundError) {
    console.log("Document not found:", err.documentId);
  }
}

All errors extend JsonDBError which has .code, .status, and .details properties.

| Error | Status | Code | |-------|--------|------| | NotFoundError | 404 | DOCUMENT_NOT_FOUND | | ValidationError | 400 | VALIDATION_FAILED | | ConflictError | 409 | CONFLICT | | UnauthorizedError | 401 | UNAUTHORIZED | | ForbiddenError | 403 | FORBIDDEN | | RateLimitError | 429 | RATE_LIMITED | | QuotaExceededError | 429 | QUOTA_EXCEEDED | | DocumentTooLargeError | 413 | DOCUMENT_TOO_LARGE | | ServerError | 500 | INTERNAL_ERROR |

Documentation

Full documentation at jsondb.cloud/docs.

Related Packages

| Package | Description | |---------|-------------| | @jsondb-cloud/client | JavaScript/TypeScript SDK | | @jsondb-cloud/mcp | MCP server for AI agents | | @jsondb-cloud/cli | CLI tool | | jsondb-cloud (PyPI) | Python SDK |

License

MIT