A modern, type-safe Node.js database query builder with a fluent API supporting MySQL, PostgreSQL, and SQLite. Current stable version is 1.0.2. It provides a unified interface across databases, automatic parameterized queries for SQL injection protection, and advanced features like subqueries, transactions, atomic operations, and batch operations. Compared to alternatives like Knex.js, it emphasizes a PHP-inspired API (based on wilkques/database) with conditional expressions (CASE WHEN, IF-ELSE) and compatibility with Node.js 18+. The package ships TypeScript types and requires separate installation of database drivers (mysql2, pg, better-sqlite3). Release cadence appears infrequent; no recent commits as of metadata.
npm install wilkques-databaseNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage of Database.connect with SQLite, schema creation, insert, fluent query with where clause, and connection cleanup.
Install required driver: npm install mysql2 (for MySQL), pg (for PostgreSQL), or better-sqlite3 (for SQLite).
Install better-sqlite3: npm install better-sqlite3
Use: const db = await Database.connect({...})Use the correct package name: '@wilkques/database'.
Upgrade Node.js to v18+.
Install mysql2: npm install mysql2
Install better-sqlite3: npm install better-sqlite3
Use import instead, or: const Database = require('@wilkques/database').default;Use default import: import Database from '@wilkques/database';