sqlstack (v1.0.25, monthly releases) is a SQL-first data access library for Node.js and TypeScript. It lets developers write real SQL in separate .sql files next to their repository classes, using decorators like @Query and @QueryBinder to bind parameters, execute queries, and shape results—without ORM complexity. Unlike Knex or Prisma, sqlstack keeps full control over SQL and supports Postgres (pg), MySQL (mysql2), and SQLite (better-sqlite3, sqlite3) via adapters. It is ESM-only, requires Node 18+, and ships TypeScript types.
npm install sqlstackNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows registration of a Postgres database, creation of a repository class with @QueryBinder/@Query decorators, and usage of a SQL file to query by email.
Use import syntax instead of require().
Always throw new SqlStackError('replaced by @Query') in the stub body.Place .sql files next to your repository class, or specify a custom directory.
Install better-sqlite3 and use createBetterSqliteDb instead of createSqliteDb.
Add "type": "module" to your package.json or use .mjs extension for your files.
Ensure you call SqlStackDB.register('primary', ...) before using the repository, and that the name matches.Instantiate with new UsersRepository().