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

@cossackframework/romedb

v0.9.6

Published

RomeDB request bindings for Cossack on Workers and Node.js, on RomeDB's own client

Readme

@cossackframework/romedb

RomeDB for Cossack applications on Cloudflare Workers and Node.js: request bindings with exact write recovery and a JSON transport codec, on RomeDB's own libraries: @romedb/client everywhere, and @romedb/node to open database files on Node. Its client and value types use Web APIs only, so the same client runs on Workers. On Node a file path opens the file in this process (openEmbedded), and a URL reaches romedb serve or RomeDB Cloud.

import { createRomeDB } from '@cossackframework/romedb';
import { connectNode, FilePendingWriteStore } from '@cossackframework/romedb/node';

const url = process.env.ROMEDB_URL || 'storage/romedb/app.romedb';   // a file, or a service URL
const token = process.env.ROMEDB_TOKEN;                              // server-only; files need none
const db = createRomeDB({
  url,
  connect: () => connectNode({ url, token }),
  pending: new FilePendingWriteStore('.cossack/romedb-pending'),
});

const result = await db.write([{ rql: 'UPDATE posts SET title = $t WHERE id = posts:p1', params: { $t: 'Edited' } }]);

On Workers, pass url and token instead of connect.

| Entry | Use | | --- | --- | | @cossackframework/romedb | createRomeDB, RomeDB's connect and typed values, row helpers, rqlDatabase (server) | | @cossackframework/romedb/values | Float64, RecordId, Vector, toTransport, fromTransport (client-safe) | | @cossackframework/romedb/node | connectNode (files through @romedb/node, romedb serve and Cloud by URL), FilePendingWriteStore | | @cossackframework/romedb/cloudflare | RomeDBPendingWrites Durable Object and DurableObjectPendingWriteStore | | @cossackframework/romedb/orm | romedb(db), the adapter that runs the Cossack ORM (@cossackframework/database) on a RomeDB instance, with relational and document entities, and romedbClient(), the instance behind an ORM (see the database package's docs/romedb.md) | | @cossackframework/romedb/dev | romedbDev() Vite plugin: starts romedb serve for a loopback ROMEDB_URL and passes its token, and, unless ROMEDB_SITES_URL is set, romedb serve --directory storage/romedb/sites on the next port for a CMS network's added sites (ROMEDB_SITES_URL, ROMEDB_SITES_TOKEN); romedbDevVars hands them to the Cloudflare plugin | | @cossackframework/romedb/testing | startRomeDBService and startRomeDBDirectory for live tests against romedb serve |

Rules:

  • Statements are { rql, params }. The binding hands them to RomeDB's client, which calls the text sql; values, results and ClientError are RomeDB's own. RecordId is RomeDB's Record, renamed so it does not hide TypeScript's Record type. Print one as `${id.table}:${id.key}`.
  • maxRequestBytes() and maxResultBytes() are the database's own limits, as it reports them: 8 MiB of each on a local RomeDB 0.2.23 or later, 1 MiB requests on Cloud, and 64 KiB requests with 256 KiB of results from an engine that reports none. Cut batches by them.
  • The engine must be RomeDB 0.2.21 or later; preflight() refuses older or missing releases, and exportFile() runs it first, so a copy is never asked of an engine that cannot leave tables out.
  • One process owns a file. Share a live database between processes (the app and Studio) through romedb serve. A file gets a new identity each time it opens, so a write saved before a restart is settled by its reconciler, not by receipt.
  • @romedb/node is an optional peer: only Node applications that open files need it, at the same version as @romedb/client, or a second copy of RomeDB's value classes is installed and a client refuses the other's values. It loads its native addon only when a file is opened. Mark both external in Vite's SSR config so Node loads them natively.
  • Every write is saved before dispatch. A lost response leaves an UncertainWriteError; recoverPending() replays the exact request. It never sends a replacement write.
  • Reads send explicit workLimits and retry 503/429 backpressure a bounded number of times.
  • The client allows 32 calls in flight. A call it refuses for lack of places (RDB_LIMIT, outcome not-sent, limit client-requests or client-bytes) waits and tries again like a 503, so a burst of requests queues instead of failing. isClientFull(error) tells such a refusal from one about the call's size.
  • Request paths never warm a Cloud database. Call warm() from a schedule.

Requests that end early

One binding serves every request of an isolate, and a call gives its place back when it settles. On Workers a call whose request ends first never settles: the visitor left, or the request failed while other calls of the same Promise.all were in flight, and the runtime cancelled their I/O with the request. Two things keep a binding serving:

  • requestSignal: a function that gives the signal of the current request. A call that passes no signal of its own takes it, so its calls end, and give their places back, when it aborts. The CMS passes one that aborts when the visitor leaves or the request fails. In your own application, abort a controller from your first middleware the same way:

    import { getRequestContext } from '@cossackframework/core';
    
    const db = createRomeDB({ url, token, pending, requestSignal: () => getRequestContext()?.get('requestCalls')?.signal });

    Work that runs after the answer under waitUntil should not take a signal that the end of the answer aborts.

  • The client gives back the place of a call past its deadline (timeoutMs, 20 seconds by default) when it is full, since @romedb/client 0.2.26. A call that never settles holds its place until then; requestSignal gives it back at once.

Live tests run when COSSACK_TEST_ROMEDB_BIN points at a romedb executable (or romedb is on PATH); COSSACK_TEST_ROMEDB_URL and COSSACK_TEST_ROMEDB_TOKEN select an existing database instead.