Db3 is a Node.js MySQL client (v4.2.1, stable) that replaces raw SQL queries with clean, readable method calls for common database operations like CRUD, schema management, and aggregate functions. It wraps the node-mysql library and targets developers who prefer an ORM-like API without full SQL knowledge. Key differentiators include shorthand methods for table operations and auto-inference of field types (e.g., 'id' becomes bigint primary key auto_increment). It uses callbacks (not Promises) and supports streaming. Node >= 4.0 required. Php alternative: Medoo.
npm install db3No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Connects to MySQL, creates a table, inserts a row, selects all rows, and disconnects (all callbacks).
Use explicit SQL queries via db.query() if you need different types for such fields.
Use util.promisify or wrap calls in Promises for async/await usage.
Use db.query() to create tables with custom column definitions.
Upgrade Node to version 4.0 or later.
Configure pool size via connection options (e.g., connectionLimit) passed to mysql.createPool.
Run `npm install db3` and ensure node_modules contains db3.
Use `const db3 = require('db3')` and then `db3.connect(...)`.Check DB_HOST, DB_USER, DB_PASS environment variables or connection options.
Ensure you assigned the result of db3.connect() to a variable (e.g., const db = db3.connect(...)).
Create the database first: `CREATE DATABASE yourdb;` or specify an existing database.