A type-safe PostgreSQL ORM for Node.js written in TypeScript, featuring a fluent query builder, decorator-based models, and immutable query state. Version 15.11.9, released under MIT license. Exclusively for PostgreSQL, optimizing queries for JSONB, DISTINCT ON, subquery joins, and ON CONFLICT upserts. Requires Node.js >=20.11.0 and a PostgreSQL driver (postgres-pool, pg, or @neondatabase/serverless). Ships TypeScript types and provides machine-readable documentation for AI tools.
npm install bigalNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Defines a Product model with decorators, initializes the ORM with a Pool, and performs a fluent query with filters and sorting.
Use 'import' syntax or dynamic import() instead of require(). Ensure package.json contains "type": "module" or use .mjs extension.
Extend Model instead of Entity, or use @model decorator on a class without extending Entity.
Ensure every model class has @table decorator (or @model in v15+) and extends Entity/Model.
Verify that columns in 'targets' array have a unique index or are primary keys.
Use .withCount() to explicitly request total count; default now returns only rows.
Replace 'postgres' with 'postgres-pool' in your dependencies and import.
Add "experimentalDecorators": true and "emitDecoratorMetadata": true to tsconfig.json compilerOptions.
Run 'npm install bigal' and ensure node >=20.11.0 (use nvm or upgrade).
Add 'import { Entity } from 'bigal'' before using the decorator.Call initialize({ models: [YourClass], pool }) before using any model.Ensure the database table has all columns defined in the model; check the 'name' property in @column decorator if different.
Cast as Repository<Product>: const productRepository = repos.Product as Repository<Product>;