PostgreSQL patterns for Node.js with pg — connection pooling, parameterized
99
99%
Does it follow best practices?
Impact
100%
1.75xAverage score across 5 eval scenarios
Passed
No known issues
A food delivery startup needs an order processing backend built with Node.js, TypeScript, and Express. The service uses PostgreSQL via the pg package. The database is accessible via a DATABASE_URL environment variable.
The system needs to support:
The orders table has: id (serial), customer_name, delivery_address, status (default 'received'), total_cents, created_at, updated_at.
The order_items table has: id (serial), order_id (FK), menu_item_id, quantity, price_cents.
Produce:
db.ts -- Database connection moduleorders.ts -- Functions for all four operations listed abovepackage.json -- With required dependenciesmigrations/001_create_orders.sql -- SQL migration for both tablesThe code should be complete TypeScript with no placeholders or TODO comments.
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
skills
postgresql-node-best-practices
verifiers