Below is a **concise README** that covers **both files together** as a single small project. --- # SQLite Query Builder and Database Manager This project provides a **lightweight SQLite database manager and SQL query builder** for Node.js, built on top of `better-sqlite3`. It offers a programmatic way to construct, execute, and synchronize SQL queries without writing raw SQL strings manually. ## Features * SQLite database management using `better-sqlite3` * Programmatic construction of `SELECT`, `INSERT`, `UPDATE`, `DELETE`, and `COUNT` queries * Support for joins, unions, filters, grouping, ordering, limits, and offsets * Automatic ID generation using time-based unique identifiers * Basic schema management (table creation, column addition, column tracking) * Optional synchronization hook for distributed or client-server setups * No external ORM dependency ## Architecture Overview * **databaseManager** Central entry point responsible for: * Database connection and execution * Schema creation and migration helpers * Query parsing and execution routing * **querySQL / joinSQL** Declarative query objects that describe: * Tables, columns, values * Filters and search expressions * Joins, unions, grouping, and ordering * **Query parsing layer** Converts query objects into valid SQLite SQL statements with parameter binding. ## Basic Usage ### Create a table and column ```js import database from "./source/database.js"; database.createTable( "user" ); database.addColumn( "name", "VARCHAR", "user" ); ``` ### Insert data ```js import querySQL from "./source/querySQL.js"; var query = new querySQL(); query.type = "insert"; query.table = "user"; query.setValue( "name", "john" ); database.query( query ); ``` ### Select data ```js var query = new querySQL(); query.type = "select"; query.table = "user"; query.find( "name", "john" ); var result = database.query( query ); console.log( result ); ``` ## Intended Use * Small to medium Node.js applications * Embedded or local SQLite-backed tools * Projects needing structured SQL generation without a full ORM * Environments where raw SQL strings are undesirable ## Notes * This is **not a full ORM**; it focuses on query construction and execution. * Schema changes are tracked via an internal `tableColumns` table. * Designed for synchronous SQLite access via `better-sqlite3`.