Skip to main content

Full-stack playground

One shop's production stack: Next.js, NestJS, a worker, PostgreSQL and Redis behind Nginx on a cloud VM. Trace a request, ship a deploy or open any part.

Select any part to see what it does and the code behind it.

POST /api/orders

response 212 ms, trace 1,866 ms

  1. Nginx POST /api/orders212 ms
  2. NestJS POST /orders206 ms
  3. NestJS AuthGuard and DTO validation6 ms
  4. PostgreSQL transaction: prices, stock, order84 ms
  5. Redis queue.add orders/confirmation3 ms
  6. Worker job orders/confirmation1620 ms
  7. Worker render invoice PDF610 ms
  8. Object storage PUT invoices/ord_8f3k.pdf290 ms
  9. Email API send confirmation690 ms
  10. OpenTelemetry export spans8 ms
Customer is waitingBackground, after the response

The customer gets a 201 at 212 ms. The invoice and email finish about 1.6 s later in the background, so a slow email provider never slows checkout.

How I build it

One repo, three apps
Web, API and worker live in one monorepo and share the database schema and types. A change to an order is one pull request, not three.
Slow work never blocks a customer
Anything that can fail or take seconds, like PDFs and email, goes through the queue. The request answers fast and the worker retries quietly.
Observable from day one
Nginx stamps every request with an id, and OpenTelemetry carries it through every service. When something is slow, the trace shows exactly where.
Boring, reversible deploys
Every commit is tested and built into images. Releasing is pulling a tag, and rolling back is pulling the previous one.