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

dbcube

v5.2.10

Published

DBCube ORM: the fastest way to work with MySQL, PostgreSQL, SQLite and MongoDB in Node.js — daemon-powered query engine (sub-millisecond queries), fluent query builder, transactions, eager loading and .cube schema files.

Downloads

2,491

Readme

dbcube

The fastest way to work with MySQL, PostgreSQL, SQLite and MongoDB in Node.js.

DBCube runs your queries through a persistent Rust engine (daemon mode) with warm connection pools — sub-millisecond query dispatch instead of paying process-spawn overhead, plus a fluent query builder, real transactions and schema-as-code with .cube files.

Installation

npm install dbcube
npx dbcube init   # scaffolds dbcube.config.js + dbcube/ + example schema

Configuration

dbcube.config.js in your project root:

module.exports = function (config) {
    config.set({
        databases: {
            myapp: {
                type: "mysql", // mysql | postgres | sqlite | mongodb
                config: {
                    HOST: process.env.DB_HOST,
                    USER: process.env.DB_USER,
                    PASSWORD: process.env.DB_PASSWORD,
                    DATABASE: process.env.DB_NAME,
                    PORT: 3306
                }
            }
        }
    });
};

Usage

const dbcube = require('dbcube');
const db = dbcube.database('myapp');

// Queries
const users = await db.table('users')
    .where('status', '=', 'active')
    .orderBy('created_at', 'DESC')
    .limit(10)
    .get();

// Writes (update/delete always require a WHERE)
await db.table('users').insert([{ name: 'Ada', email: '[email protected]' }]);
await db.table('users').where('id', '=', 1).update({ status: 'inactive' });

// Transactions — everything commits or everything rolls back
await db.transaction(async (trx) => {
    await trx.table('accounts').where('id', '=', 1).update({ balance: 50 });
    await trx.table('accounts').where('id', '=', 2).update({ balance: 150 });
});

// Raw SQL escape hatch (bound parameters)
const rows = await db.raw('SELECT * FROM users WHERE age > ?', [25]);

// Eager loading from your .cube foreign keys — one batched query, no N+1
const usersWithOrders = await db.table('users').with('orders').get();

// Pagination, upsert, atomic counters…
const page = await db.table('posts').paginate(2, 20);
await db.table('settings').upsert([{ key: 'theme', value: 'dark' }], ['key']);
await db.table('products').where('id', '=', 7).increment('stock', 5);

Advanced configuration

Tune the connection pool and daemon per database:

myapp: {
    type: "mysql",
    config: { /* ... */ },
    pool: {
        maxConnections: 20,      // default 5 (sqlite: 10)
        minConnections: 4,       // default 2
        acquireTimeoutMs: 5000,  // default 3000
        idleTimeoutMs: 600000    // default 3600000
    },
    daemon: {
        enabled: true,           // false → one-shot mode (transactions need the daemon)
        requestTimeoutMs: 60000  // default 30000
    }
}

TypeScript

Generate interfaces from your schema and get fully typed queries:

// npx dbcube generate → dbcube/types.ts
import type { User } from './dbcube/types';

const users = await db.table<User>('users').where('age', '>', 25).get(); // User[]
const one   = await db.table<User>('users').first();                     // User | null

Highlights

  • Daemon mode: persistent TCP engine, ~0.3 ms per query (disable with DBCUBE_DAEMON=0)
  • Transactions with automatic rollback on error — MySQL, PostgreSQL, SQLite and MongoDB (replica set)
  • Schema as code: define tables in .table.cube files, apply with npx dbcube run table:refresh
  • Migrations with history and rollback (.alter.cube + migrate:status / migrate:rollback)
  • TypeScript types generated from your schema: npx dbcube generate
  • Aggregations (count/sum/avg/max/min), exists(), chunk(), whereIn/whereNotIn, having, selectRaw, computed fields and runtime triggers
  • Runtime triggers scale horizontally: they run in JS in the process that performs the write, so with N service replicas each operation fires its trigger exactly once — no distributed coordination needed

Documentation

Full docs: https://dbcube.org — CLI reference: npx dbcube help

License

MIT