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

dexie-cloud-sdk

v0.1.2

Published

Official JavaScript SDK for Dexie Cloud - Local-first database with sync

Readme

Dexie Cloud SDK

Official server-side JavaScript/TypeScript SDK for Dexie Cloud — local-first database with sync.

Features

  • Transparent auth — configure credentials once, tokens are managed automatically
  • Impersonation — act as any user with db.asUser()
  • Blob handling — automatic offloading of large strings and binaries
  • TSON supportDate, Map, Set, BigInt serialized out of the box
  • Multi-environment — Node.js, Deno, Cloudflare Workers

Installation

npm install dexie-cloud-sdk

Quick Start

import { DexieCloudClient } from 'dexie-cloud-sdk';
import { readFileSync } from 'fs';

// 1. Read credentials from dexie-cloud.key (generated by `npx dexie-cloud connect`)
const keys = JSON.parse(readFileSync('dexie-cloud.key', 'utf-8'));
const dbUrl = Object.keys(keys)[0];
const { clientId, clientSecret } = keys[dbUrl];

// 2. Create client and database session
const client = new DexieCloudClient('https://dexie.cloud');
const db = client.db(dbUrl, { clientId, clientSecret });

// 3. Use it — no tokens to manage!
const items = await db.data.list('todoItems');
console.log(items);

await db.data.create('todoItems', {
  title: 'Buy milk',
  done: false,
});

Impersonation

Act as a specific user (requires IMPERSONATE scope on the client):

const userDb = db.asUser({
  sub: '[email protected]',
  email: '[email protected]',
});

// All operations run as that user
const items = await userDb.data.list('todoItems');
await userDb.data.create('todoItems', { title: 'User task', done: false });

API

client.db(dbUrl, credentials)

Creates a DatabaseSession with automatic token management.

const db = client.db('https://xxxxxxxx.dexie.cloud', {
  clientId: '...',
  clientSecret: '...',
});

Tokens are cached in-memory and refreshed automatically when within 5 minutes of expiry.

db.data

CRUD operations on database tables:

await db.data.list('table');                          // List all
await db.data.list('table', { realm: 'realmId' });   // Filter by realm
await db.data.get('table', 'id');                     // Get one
await db.data.create('table', { ... });               // Create
await db.data.replace('table', 'id', { ... });        // Full replace (PUT)
await db.data.delete('table', 'id');                   // Delete
await db.data.bulkCreate('table', [{ ... }, ...]);    // Bulk create

db.blobs

Binary blob operations:

const ref = await db.blobs.upload(uint8Array, 'image/png');
const { data, contentType } = await db.blobs.download(ref);

db.asUser(claims)

Returns a new DatabaseSession impersonating a user:

const userDb = db.asUser({ sub: '[email protected]', email: '[email protected]' });

Client Initialization

// Simple
const client = new DexieCloudClient('https://dexie.cloud');

// Full config
const client = new DexieCloudClient({
  serviceUrl: 'https://dexie.cloud',
  dbUrl: 'https://xxxxxxxx.dexie.cloud',
  blobHandling: 'auto',      // 'auto' | 'lazy'
  maxStringLength: 32768,     // Strings longer than this are offloaded to blobs
  timeout: 30000,
  debug: true,
});

Health Monitoring

await client.waitForReady(60000);
const status = await client.getStatus();
const isReady = await client.isReady();

Error Handling

import {
  DexieCloudError,
  DexieCloudAuthError,
  DexieCloudNetworkError,
} from 'dexie-cloud-sdk';

try {
  await db.data.list('todoItems');
} catch (error) {
  if (error instanceof DexieCloudAuthError) {
    console.log('Auth failed:', error.message);
  } else if (error instanceof DexieCloudError) {
    console.log('API error:', error.status, error.message);
  }
}

E2E Testing

The repo includes a Docker-based test stack:

# Start stack
docker compose -f docker-compose.test.yml up -d

# Run E2E tests
pnpm run test:e2e

# Stop
docker compose -f docker-compose.test.yml down -v

License

MIT — see LICENSE for details.

Links