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/query-builder

v5.2.10

Published

The Dbcube Query Builder is a lightweight, flexible, and fluent library for building queries across multiple database engines, including MySQL, PostgreSQL, SQLite, and MongoDB, using JavaScript/Node.js. Its agnostic design allows you to generate data man

Readme

@dbcube/query-builder

Fluent, engine-agnostic query builder for MySQL, PostgreSQL, SQLite and MongoDB, powered by the DBCube Rust query engine (persistent daemon mode, sub-millisecond dispatch).

Most applications should install dbcube (the ORM), which re-exports this builder together with schema tooling.

Installation

npm install @dbcube/query-builder

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 { Database } = require('@dbcube/query-builder');
const db = new Database('myapp');

Reads

const users = await db.table('users')
    .select(['id', 'name'])
    .where('age', '>', 25)
    .whereIn('status', ['active', 'trial'])
    .orderBy('created_at', 'DESC')
    .limit(10)
    .offset(20)
    .get();

const user  = await db.table('users').find(5);          // by id
const one   = await db.table('users').where('email', '=', '[email protected]').first();
const any   = await db.table('users').where('age', '>', 100).exists(); // boolean
const page  = await db.table('posts').paginate(2, 20);  // {items, total, totalPages, hasNext, hasPrev}

Aggregations

Aggregations execute immediately and return a number — they are not chainable:

const total   = await db.table('users').count();
const maxAge  = await db.table('users').max('age');
const avgAge  = await db.table('users').where('status', '=', 'active').avg('age');

Writes

insert() takes an array. update() and delete() require a WHERE:

await db.table('users').insert([{ name: 'Ada', email: '[email protected]' }]);
await db.table('users').where('id', '=', 1).update({ status: 'inactive' });
await db.table('users').where('status', '=', 'banned').delete();
await db.table('temp_imports').truncate(); // the only write allowed without WHERE

await db.table('settings').upsert([{ key: 'theme', value: 'dark' }], ['key']);
await db.table('products').where('id', '=', 7).increment('stock', 5);

Transactions

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 });
    // any throw → automatic ROLLBACK
});

Raw SQL

const rows = await db.raw('SELECT * FROM users WHERE age > ?', [25]);

Eager loading

Relations resolve from the foreign definitions in your .cube files — one batched query per relation, no N+1:

const users = await db.table('users').with('orders').get();
const posts = await db.table('posts')
    .with('author', { table: 'users', foreignKey: 'author_id', type: 'one' })
    .get();

More

whereGroup, orWhere, whereBetween, whereNotIn, join/leftJoin/rightJoin, groupBy, having, selectRaw, distinct, chunk(size, cb) for large datasets, computed fields (useComputes()) and runtime triggers (useTriggers()).

Documentation

Full docs: https://dbcube.org

License

MIT