CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/postgresql-node-best-practices

PostgreSQL patterns for Node.js with pg — connection pooling, parameterized

99

1.75x
Quality

99%

Does it follow best practices?

Impact

100%

1.75x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

Evaluation results

100%

72%

Analytics Dashboard Backend

Criteria
Without context
With context

BIGINT type parser configured

0%

100%

NUMERIC type parser configured

0%

100%

Type parsers before pool creation

0%

100%

SSL configured for production

0%

100%

Pool with production settings

0%

100%

keepAlive enabled

0%

100%

Parameterized queries throughout

100%

100%

ANY for multi-status filter

100%

100%

pool.query for single queries

100%

100%

Pool error handler

0%

100%

Graceful shutdown

0%

100%

100%

22%

Content Publishing Platform

Criteria
Without context
With context

Pool with production settings

0%

100%

Parameterized queries throughout

100%

100%

Bulk import uses unnest or multi-row VALUES

100%

100%

ANY or overlap for tag search

100%

100%

ANY for multi-status filter

100%

100%

Foreign key violation handling

50%

100%

RETURNING clause on INSERT/UPDATE

100%

100%

pool.query for single queries

100%

100%

Pool error handler and shutdown

0%

100%

TIMESTAMPTZ in migration

100%

100%

CHECK constraint on status

100%

100%

Index on foreign key

0%

100%

Unique constraint on author email

100%

100%

No individual Client instances

100%

100%

100%

37%

Order Processing System

Criteria
Without context
With context

Transaction with BEGIN/COMMIT

100%

100%

ROLLBACK on error

100%

100%

client.release() in finally

100%

100%

pool.connect() for transactions

100%

100%

Pool with production settings

0%

100%

keepAlive enabled

0%

100%

Parameterized queries throughout

100%

100%

RETURNING clause on INSERT

80%

100%

Foreign key constraint handling

0%

100%

Pool error handler

0%

100%

Graceful shutdown

0%

100%

TIMESTAMPTZ in migration

100%

100%

FK index in migration

0%

100%

100%

29%

Product Catalog Service

Criteria
Without context
With context

Pool with production settings

0%

100%

Parameterized queries throughout

100%

100%

Bulk import uses unnest or multi-row VALUES

100%

100%

No loop of individual INSERTs for batch

100%

100%

Typed array casts on unnest or parameters

0%

100%

ANY for tag filtering

70%

100%

ANY for multi-category filter

80%

100%

RETURNING clause on INSERT

100%

100%

pool.query for single queries

100%

100%

Pool error handler

0%

100%

Graceful shutdown

0%

100%

100%

55%

User Management API

Criteria
Without context
With context

Pool with max connections

0%

100%

Pool timeout settings

0%

100%

keepAlive enabled

0%

100%

Pool error handler

0%

100%

Graceful shutdown

0%

100%

Parameterized queries throughout

100%

100%

pool.query for single queries

100%

100%

RETURNING clause on INSERT/UPDATE

100%

100%

Unique violation handling for email

0%

100%

BIGINT type parser configured

0%

100%

TIMESTAMPTZ in migration

100%

100%

CHECK constraint on role

100%

100%

Index on email column

100%

100%

Evaluated
Agent
Claude Code
Model
Claude Sonnet 4.6

Table of Contents