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
- Nginx POST /api/orders212 ms
- NestJS POST /orders206 ms
- NestJS AuthGuard and DTO validation6 ms
- PostgreSQL transaction: prices, stock, order84 ms
- Redis queue.add orders/confirmation3 ms
- Worker job orders/confirmation1620 ms
- Worker render invoice PDF610 ms
- Object storage PUT invoices/ord_8f3k.pdf290 ms
- Email API send confirmation690 ms
- 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.