Every backend service MUST use structured logging — pino/structlog/slog, JSON format, request IDs, proper log levels. console.log is never acceptable.
88
85%
Does it follow best practices?
Impact
97%
3.03xAverage score across 4 eval scenarios
Passed
No known issues
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.
Produce:
output/package.json with all dependenciesoutput/src/app.ts — Express application setup with middlewareoutput/src/routes/payments.ts — Payment route handlersThe code should be complete TypeScript, ready to compile and run. No placeholders or TODO comments.