Project

Dispatch

Multi-tenant SaaS automating logistics/returns with real-time sync, carrier APIs, and rule-based workflows

NestJSPostgreSQLRLSAWSEvent-driven

Dispatch is a multi‑tenant platform that automates logistics and returns: label generation, rate shopping, tracking, and rule‑based workflows—all while keeping data securely partitioned across tenants.

Backstory

I built Dispatch after repeatedly seeing operations teams stitch together spreadsheets, carrier portals, and emails. The goal was to unify those flows with strong guardrails (permissions, SLAs, audits) and a clean API.

Architecture

  • Core services in NestJS with clear domain modules (orders, shipments, returns, rules).
  • PostgreSQL with Row Level Security (RLS) to enforce tenant isolation at the database layer.
  • Event‑driven processing for long‑running tasks (label creation, webhooks, notifications) so UI/API stay responsive.
  • Cloud primitives: message queues for retries/backpressure, object storage for labels/documents, and background workers for throughput.

Technical Highlights

  • API adapters for carriers (rates, labels, tracking) behind a stable interface to swap vendors without touching business logic.
  • Rules engine to declaratively encode routing, validation, and notifications—no ad‑hoc conditionals scattered across services.
  • Idempotent handlers and audit logs for every state transition; DLQs for poison messages and predictable recovery.
  • Observability baked‑in: structured logs and metrics to trace multi‑step workflows across services.

Challenges → Solutions

  • Rate‑limit spikes from carrier APIs → exponential backoff with jitter and queue‑level concurrency caps.
  • Cross‑tenant leakage risks → strict RLS policies, scoped JWT claims, and per‑tenant encryption keys for sensitive blobs.
  • Flaky webhooks → signature verification, persistence, and replay to guarantee downstream delivery.

Results

  • Faster turnarounds on labels and returns by decoupling heavy work from API calls.
  • Reduced operational toil via rules‑based automation and standardized audit trails.

Project Log

No log entries yet. I’ll share stories, insights, and progress notes here.