GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com โ€” GitHub - Tiny-Essentials/PuddySQL: ๐Ÿฎ Powerful SQL toolkit for Node.js, built with flexibility and structure in mind. Easily manage SQLite3/PostgreSQL, advanced queries, smart tag systems, and full JSON-friendly filters.

BranchesTags
Open more actions menu

Latest commit

 

History

146 Commits
146 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
docs
docs
 
 
md-assets
md-assets
 
 
src
src
 
 
test
test
 
 
.babelrc
.babelrc
 
 
.gitignore
.gitignore
 
 
.npmignore
.npmignore
 
 
.prettierignore
.prettierignore
 
 
.prettierrc.json
.prettierrc.json
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
babel.config.json
babel.config.json
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
rollup.config.mjs
rollup.config.mjs
 
 
tsconfig.json
tsconfig.json
 
 
webpack.config.mjs
webpack.config.mjs
 
 

Repository files navigation

banner

Discord server NPM version NPM downloads

Patreon Ko-Fi Bitcoin Litecoin

npm installnfo

๐Ÿฎ PuddySQL

PuddySQL is a modular and extensible SQL toolkit for Node.js โ€” designed to make dynamic queries, filters, pagination, and tag-based searches easy, safe, and powerful.

Built with composability in mind, each part of PuddySQL focuses on one job while integrating smoothly with the others. Whether you're working with SQLite or PostgreSQL, this package helps you build robust, readable, and scalable query logic.


๐Ÿ“ฆ Installation

npm install puddysql

๐Ÿงฑ Main Features

  • โœ… Safe, composable SQL queries with named methods
  • ๐Ÿ” Powerful nested filters using JSON logic (AND/OR, operators, etc.)
  • ๐Ÿท๏ธ Built-in tag filtering engine for JSON/array-based fields
  • ๐Ÿ”— Dynamic JOIN builder with alias support
  • ๐Ÿ“ƒ Smart pagination with automatic counters
  • ๐Ÿงช Strong input validation and type safety

Build ๐Ÿ“ฆ

To get started, please install the project dependencies. It is mandatory to run the build command afterward to ensure the module works correctly:

npm install
npm run build:essentials

๐Ÿ“š Documentation

For API reference, check each moduleโ€™s own documentation:

๐Ÿ‘‰ See: docs/README.md


๐Ÿ”ง Module Overview

Module Description
PuddySqlEngine Low-level query runner with DB abstraction
PuddySqlInstance Manages databases and table bindings
PuddySqlQuery High-level querying with filters and joins
PuddySqlTags Parses tag filters into safe SQL conditions
PuddySqlMigrator Version-based schema migration runner
PuddySqlEvents Event name constants (Connection-Error, etc.)

๐Ÿงช Requirements

  • Node.js 18+ recommended

  • Works with:

    • โœ… SQLite3
    • โœ… PostgreSQL (via pg adapter)

๐Ÿงญ Modules Menu

The PuddySql class is the main access point to all core features of the library. You should not instantiate it directly โ€” instead, use PuddySql.Instance.

Here's a quick overview of what's available:

๐Ÿ“ฆ Static Property ๐Ÿ” Description
PuddySql.Instance ๐ŸŽฎ Main SQL client class for managing databases (PostgreSQL or SQLite3)
PuddySql.Query ๐Ÿง  Query builder and smart search engine with advanced filtering
PuddySql.Tags ๐Ÿท๏ธ Flexible tag system parser (with support for JSON arrays, boosts, etc.)
PuddySql.Events ๐ŸŽฏ Event name constants (Connection-Error, Migration-*)
PuddySql.Migrator ๐Ÿšš Version-based schema migration runner
PuddySql.Utils ๐Ÿ› ๏ธ Useful utilities (object flattening, merge helpers, SQL formatters)
PuddySql.pg ๐Ÿ˜ PostgreSQL database engine (pg wrapper)
PuddySql.sqlite3 ๐Ÿ“€ SQLite3 engine for local/in-memory usage (sqlite3 wrapper)

๐Ÿš€ Quick Example

Hereโ€™s how to get started using PuddySQL:

import path from 'path';
import { fileURLToPath } from 'url';
import PuddySql from 'puddysql';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

// ๐ŸŽฎ Create a new SQL instance
const db = new PuddySql.Instance();

// ๐Ÿ“ก Run queries
(async () => {
  await db.initSqlite3();

  // Insert a new user
  const table = await db.initTable({ name: 'tinytest', id: 'id' }, [
      ['id', 'TEXT', 'PRIMARY KEY'],
      ['prompt', 'TEXT'],
      ['yay', 'BOOLEAN']
  ]);

  console.log('Set');
  console.log(await table.set('1', { prompt: 'pudding', yay: true }));
  console.log(await table.set('2', { prompt: 'cookie', yay: true }));
  console.log(await table.set('3', { prompt: 'brigadeiro', yay: true }));
  console.log(await table.set('4', { prompt: 'banana', yay: false }));
  console.log(await table.set('5', { prompt: 'chocolate', yay: true }));

  console.log('Get All');
  console.log(await table.getAll());

  // Find a user by ID
  console.log('Get');
  const user = await table.get(1);
  console.log(user); // โ†’ { id: 1, prompt: 'pudding', yay: true }

  // Get a paginated list
  console.log('Search');
  const data1 = await db.getTable('tinytest').search({
      q: {
        group: 'AND',
        conditions: [{ column: 'prompt', value: 'pudding' }],
      },
    });

  const data2 = await table.search({
      q: {
          group: 'OR',
          conditions: [
            { column: 'prompt', value: 'pudding' },
            { column: 'yay', value: false },
          ],
      },
    });

  console.log(data1);
  console.log(data2);
})();

๐Ÿšš Migrations

PuddySQL ships with a small version-based migration runner:

const db = new PuddySql.Instance();
await db.initSqlite3();

const users = await db.initTable({ name: 'users', id: 'id' }, [
  ['id', 'INTEGER', 'PRIMARY KEY'],
  ['name', 'TEXT'],
]);

// Register migrations by version
db.migrator.addMigration(1, async () => {
  await users.updateTable([['ADD', 'email', 'TEXT']]);
});

// Run everything up to version 1
await db.startMigration(1);

See docs/PuddySqlMigrator.md for the full reference.


๐Ÿค Contributions

Feel free to fork, contribute, and create pull requests for improvements! Whether it's a bug fix or an additional feature, contributions are always welcome.

๐Ÿ“ License

This project is licensed under the LGPL-3.0 License - see the LICENSE file for details.

๐Ÿง  Note: This documentation was written by ChatGPT, an AI assistant developed by OpenAI, based on the project structure and descriptions provided by the repository author.
If you find any inaccuracies or need improvements, feel free to contribute or open an issue!


๐Ÿ”™ Back to Tiny Essentials

Did you like this module? Itโ€™s part of the Tiny Essentials collection โ€” a set of minimal yet powerful tools to make development easier. ๐Ÿ‘‰ Click here to explore more Tiny Essentials modules



Made with tiny love!

About

๐Ÿฎ Powerful SQL toolkit for Node.js, built with flexibility and structure in mind. Easily manage SQLite3/PostgreSQL, advanced queries, smart tag systems, and full JSON-friendly filters.

www.npmjs.com/package/puddysql

Topics

advanced-searchdatabasenodejspostgrespostgresqlquery-buildersqlsql-buildersql-querysqlitesqlite3tag-systemtiny-essentials

Resources

Readme
LGPL-3.0 license
Activity
Custom properties

Stars

2 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Sponsor this project

Contributors

Languages

You are visitor 01402503 โ€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800ร—600. No cookies required.