Skip to content

02

TL;DRSlow synchronous notifications and timing-out PDF reports → queued, streaming background jobs and Postgres tuned from query plans → the API stopped waiting on side effects.

Role
Back-End Developer
Client
SimplyDepo · United States
Year
2025—26
Stack
Node.js, TypeScript, Express, PostgreSQL
FIG. 01QUEUE · RETRIES · DEAD LETTERSADMIN APIenqueue, 202JOB QUEUE · FIFOWORKER 1notifyWORKER 2render pdfWORKER 3syncDLQreplayableRETRY · BACKOFFP95 ↓ · REQUESTS RETURN BEFORE SIDE EFFECTS RUN
Architecture
ADMIN APIenqueue01JOB QUEUEretries · DLQ02WORKERSnotify · render03PDF STREAMchunked04POSTGRESQLindexed05BUILT / OWNED BY MEINTEGRATED

In one paragraph

Turned slow synchronous work into predictable background jobs. Reports that used to time out now run as jobs with progress; notification spikes no longer slow the API; the slowest list endpoints are back within budget.

Context

SimplyDepo is a US order-management platform used by wholesale distributors and their retail customers. I owned backend services on Node.js and PostgreSQL for six months.

Problem

Notification dispatch ran inside request handlers, large PDF reports timed out on the admin side, and a few order-list endpoints got slower every week as data grew.

What I did

  1. 01

    Queue the side effects

    Notification dispatch moved behind a job queue with retries, exponential backoff and a dead-letter queue. Endpoints return as soon as the order is saved.

  2. 02

    Stream the documents

    Report generation became a streaming background job with progress signals instead of one giant in-memory render that blocked the event loop.

  3. 03

    Tune from the plan, not vibes

    Ranked queries by total time in pg_stat_statements, read EXPLAIN (ANALYZE, BUFFERS), added targeted indexes and rewrote N+1 loaders.

  4. 04

    Stable contracts

    Versioned REST endpoints for admin tools and integrations, with request validation and one consistent error shape.

Stack

  • Node.js
  • TypeScript
  • Express
  • PostgreSQL
  • Job queues
  • Docker
Similar project?Book a call about a similar project →30 minutes, video. You'll leave with a rough plan and a price range.Hiring?Read the CV →Questions about this case?Contact me →
Next · 03Multi-PSP payment layer →