Production config management for any backend — centralized config module, env vars, no hardcoded secrets, fail-fast validation
86
77%
Does it follow best practices?
Impact
100%
1.88xAverage score across 5 eval scenarios
Passed
No known issues
An e-commerce company needs a REST API to process payments through Stripe and store order records in PostgreSQL. Build it using Express and TypeScript.
Endpoints:
POST /api/payments -- create a payment intent (amount, currency, customer email)GET /api/payments/:id -- retrieve payment statusGET /api/payments -- list payments with optional ?status= filterPOST /api/webhooks/stripe -- receive Stripe webhook events to update payment statusBusiness rules:
Use pg for PostgreSQL and stripe for Stripe integration.
Produce:
src/server.ts -- server entry pointsrc/app.ts -- Express application setupsrc/routes/payments.ts -- payment route handlerssrc/routes/webhooks.ts -- Stripe webhook handlersrc/db.ts -- database connection and queriespackage.json -- with dependencies listed (no need to run npm install).gitignore -- standard Node.js gitignoreYou may create additional files as needed for a well-structured codebase.