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

task.mdevals/scenario-5/

User Management API

Problem/Feature Description

A SaaS startup is building a user management service for their platform. The service is built with Node.js, TypeScript, and Express, using PostgreSQL as the database (accessed via the pg package). The database is already running and accessible via a DATABASE_URL environment variable.

The service needs to support:

  • Creating a new user account with name, email, and role (admin, editor, viewer)
  • Looking up a user by ID
  • Searching for users by email address
  • Listing all users that have a specific role
  • Updating a user's role

Each user has: id (bigint primary key), name, email (unique), role, created_at, and updated_at.

Output Specification

Produce:

  • db.ts -- Database connection module
  • users.ts -- Functions for all five user operations listed above
  • package.json -- With required dependencies
  • migrations/001_create_users.sql -- SQL migration to create the users table

The code should be complete TypeScript with no placeholders or TODO comments.

evals

tile.json