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

@stackpress/inquire

v0.6.5

Published

Super lightweight generic typed SQL query builder, SQL dialects and composite engine.

Readme

💬 Inquire

NPM Package Tests Status Coverage Status Commits License

Super lightweight generic typed SQL query builder, SQL dialects and composite engine. Schema builder, but no ORM. Bring your own database library.

What is Inquire?

Inquire is a powerful yet lightweight SQL query builder that provides a unified interface for working with multiple database engines. Unlike traditional ORMs, Inquire focuses on query building and execution while letting you bring your own database connection library. This approach gives you the flexibility to use your preferred database driver while benefiting from a consistent, type-safe query building experience.

Key Features

  • 🪶 Lightweight: No ORM overhead - just pure query building
  • 🔧 Generic Typed: Full TypeScript support with generic types for enhanced type safety
  • 🗄️ Multi-Database: Same expressive query builder pattern for all SQL engines
  • 🔄 Unified Interface: Consistent API across different database engines
  • 📝 Schema Builder: Create and modify database schemas programmatically
  • 🔗 Template Strings: Support for type-safe template string query building
  • ⚡ Transaction Support: Common transaction pattern across all engines
  • 🎯 Dialect Agnostic: Query builders work with any supported SQL dialect

Supported Databases

Inquire supports a wide range of database engines through dedicated connection packages:

  • MySQL - via @stackpress/inquire-mysql2 (Node MySQL2)
  • PostgreSQL - via @stackpress/inquire-pg (Node PostGres pg)
  • SQLite - via @stackpress/inquire-sqlite3 (Better SQLite3)
  • PGLite - via @stackpress/inquire-pglite (PGLite)
  • CockroachDB - Compatible with PostgreSQL adapter
  • NeonDB - Compatible with PostgreSQL adapter
  • Vercel Postgres - Compatible with PostgreSQL adapter
  • Supabase - Compatible with PostgreSQL adapter

Installation

Install the core library:

npm install @stackpress/inquire

Then install the appropriate database adapter:

# For MySQL
npm install @stackpress/inquire-mysql2 mysql2

# For PostgreSQL
npm install @stackpress/inquire-pg pg

# For SQLite
npm install @stackpress/inquire-sqlite3 better-sqlite3

# For PGLite
npm install @stackpress/inquire-pglite @electric-sql/pglite

Quick Start

MySQL Connection

import mysql from 'mysql2/promise';
import connect from '@stackpress/inquire-mysql2';

// Create the raw database connection
const resource = await mysql.createConnection({
  host: 'localhost',
  user: 'root',
  database: 'inquire',
});

// Map the resource to the Inquire engine
const engine = connect(resource);

PostgreSQL Connection

import { Client, Pool } from 'pg';
import connect from '@stackpress/inquire-pg';

// Using a Pool
const pool = new Pool({
  database: 'inquire',
  user: 'postgres'
});
const connection = await pool.connect();

// Or using a Client
const client = new Client({
  database: 'inquire',
  user: 'postgres'
});
await client.connect();

// Map the resource to the Inquire engine
const engine = connect(connection); // or connect(client)

SQLite Connection

import sqlite from 'better-sqlite3';
import connect from '@stackpress/inquire-sqlite3';

// Create the raw database connection
const resource = sqlite(':memory:');

// Map the resource to the Inquire engine
const engine = connect(resource);

Basic Usage

Once you have an engine instance, you can start building and executing queries:

// Create a table
await engine.create('users')
  .addField('id', { type: 'INTEGER', autoIncrement: true })
  .addField('name', { type: 'VARCHAR', length: 255 })
  .addField('email', { type: 'VARCHAR', length: 255 })
  .addPrimaryKey('id');

// Insert data
await engine
  .insert('users')
  .values({ name: 'John Doe', email: '[email protected]' });

// Select data
const users = await engine
  .select('*')
  .from('users')
  .where('name = ?', ['John Doe']);

console.log(users);

// Update data
await engine
  .update('users')
  .set({ email: '[email protected]' })
  .where('id = ?', [1]);

// Delete data
await engine
  .delete('users')
  .where('id = ?', [1]);

Query Builders

Inquire provides comprehensive query builders for all common SQL operations:

  • Create - Create tables and schemas
  • Alter - Modify existing tables
  • Select - Query data with joins, conditions, and aggregations
  • Insert - Insert single or multiple records
  • Update - Update existing records
  • Delete - Delete records with conditions

Template String Queries

For complex queries, you can use type-safe template strings:

type User = {
  id: number;
  name: string;
  email: string;
};

const userId = 123;
const results = await engine.sql<User>`
  SELECT u.*, p.title 
  FROM users u 
  LEFT JOIN posts p ON u.id = p.user_id 
  WHERE u.id = ${userId}
`;
// results is typed as User[]

Transactions

Execute multiple queries in a transaction:

const result = await engine.transaction(async (trx) => {
  await trx.insert('users').values({ name: 'Alice' });
  await trx.insert('posts').values({ title: 'Hello World', user_id: 1 });
  return 'success';
});

Type Safety

Inquire is designed with TypeScript in mind, providing full type safety:

type User = {
  id: number;
  name: string;
  email: string;
};

// Type-safe queries
const users = await engine.select<User>('*').from('users');
// users is now typed as User[]

const user = await engine.select<User>('*')
  .from('users')
  .where('id = ?', [1])
  .limit(1);
// user is typed as User[]

API Documentation

For detailed API documentation, see:

Examples

Check out the examples directory for complete working examples with different database engines: