CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/structured-logging

Every backend service MUST use structured logging — pino/structlog/slog, JSON format, request IDs, proper log levels. console.log is never acceptable.

88

3.03x
Quality

85%

Does it follow best practices?

Impact

97%

3.03x

Average score across 4 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-4/

Payment Processing API

Problem/Feature Description

A fintech startup needs a Node.js/Express API (TypeScript) for their payment processing service. The service handles creating charges, refunding payments, and retrieving payment history for customers. It will run in a Kubernetes cluster behind a load balancer.

The service needs these endpoints:

  • POST /api/payments — Create a new payment (accepts: customer_id, amount_cents, currency, description). Validates that amount is positive and currency is supported (USD, EUR, GBP). Returns the created payment with a generated payment_id and status "pending".
  • POST /api/payments/:id/refund — Refund a payment. Only payments with status "completed" can be refunded. Changes status to "refunded".
  • GET /api/payments/:id — Get a single payment by ID. Returns 404 if not found.
  • GET /api/payments?customer_id=xxx — List all payments for a customer, sorted by created_at descending.

Use an in-memory store (no database needed). The service should be production-ready in terms of code quality and operational concerns.

Output Specification

Produce:

  • output/package.json with all dependencies
  • output/src/app.ts — Express application setup with middleware
  • output/src/routes/payments.ts — Payment route handlers
  • Any additional files needed to run the service

The code should be complete TypeScript, ready to compile and run. No placeholders or TODO comments.

evals

tile.json