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

@yydb/yydb

v0.2.0

Published

YYDB Node embedded engine and CLI

Readme

@yydb/yydb

Node embedded engine and CLI. Database.open starts a private loopback yydb serve process and talks over the YY wire protocol; platform .node bindings install through optional dependencies.

Browsers are served by the pure TypeScript @yydb/light-db package. This package no longer ships a WebAssembly entry.

For a wire client only (renderer or an app that already runs yydb serve), use @yydb/yydb-client.

npm Node.js

Exports

| Import | Runtime | Role | |--------|---------|------| | @yydb/yydb | Node | Database.open, micro helpers, VOS re-exports | | @yydb/yydb/cli | Node | CLI (version, init, info, verify, restore, serve) |

Node.js 18+.

npm install @yydb/yydb
npx yydb version

Schema truth lives in the .yydb file via ensureSchema and VOS documents.

Example

import { Database } from '@yydb/yydb';

const db = await Database.open('./data/app.yydb');

await db.ensureSchema(
    1,
    `table Setting {
        @@id: uuid,
        key: utf8,
        value: utf8,
    }`,
);

await db.put('theme', 'dark');
console.log(await db.get('theme'));
await db.close();

The file is created when missing. Schema version and VOS document persist with the data.

API

const db = await Database.open(path, options?);

await db.ensureSchema(version, vosDocument);
await db.getSchema();
await db.put(key, stringOrBytes);
await db.get(key);
await db.info();
await db.serverVersion();
await db.registerMicro(microDefinition);
await db.callScalar('double', 1, [21]);
await db.close();

OpenOptions: cli (explicit CLI script path), port (preferred loopback port), serveArgs (extra yydb serve arguments). binary is a deprecated alias for cli.

Prepared statements

db.prepare parses and lowers a VOS query once; the plan stays in a native thread-local registry and re-executes with different bindings.

const stmt = await db.prepare('User.all().take($limit).collect()');
const rows = await stmt.execute({ limit: 100 });
const more = await stmt.execute({ limit: 50 });
stmt.close();

stmt.parameters lists the expected bindings, and stmt.info exposes the read/write sets and source fingerprint. Missing, extra, or mistyped parameters raise YydbError with code yydb.query.bind.

The native binding exposes additive operations (schemaVersion, schemaDocument, recordCount, journalMode, checkpoint, walFrameCount, get, put); the CLI composes commands from them.

Restore

Database.restore(backupPath) opens a backup copy after verification: .yydb page CRCs are checked, .yydx object closure is checked. A failed check refuses to open instead of returning a damaged handle. yydb restore <backup> --target <path> verifies first and then copies the file to the target.

Limits

  • walPath() reports the sidecar path and may return null. It does not guarantee the file exists: the WAL may not be created yet, may already be folded, or may be unused. Do not treat its presence as a commit signal — use journalMode() / walFrameCount(), or checkpoint() first.
  • doctor() is read-only. It never repairs a damaged page, rewrites the WAL or reclaims orphans. Damaged pages must be restored from a verified backup or the file rebuilt. Orphan reclamation is compact() on .yydx only.
  • The full code catalog is the guide page guide/10-errors.md. Engine codes are minted only by the Rust yydb-types crate; the TypeScript host adds yydb.client.* and yydb.statement.closed.

Related packages

| Need | Package | |------|---------| | Node embedded engine and CLI (this package) | @yydb/yydb | | Browser engine (pure TS and WASM sessions) | @yydb/light-db | | Wire client only | @yydb/yydb-client | | In-process Rust embed | yydb | | Agent skills (wire protocol) | @yydb/yydb-skills |

Electron: main process can use @yydb/yydb; renderer code can use @yydb/yydb-client against the main-process endpoint.

The managed engine listens on 127.0.0.1 with no authentication �keep the endpoint private.

YYDB overview Ā· User guides