lib/db.js
const { Pool } = require('pg');
const pool = new Pool({
// libpq env vars are picked up automatically (PGHOST/PGPORT/PGUSER/PGPASSWORD/PGDATABASE).
max: parseInt(process.env.PG_POOL_MAX || '10', 10),
idleTimeoutMillis: 30_000,
});
module.exports = { pool };