0
Maruthan G
maruthan.dev
LiveFull-stack engineer2024 – present

Enterprise Sales & Commerce Analytics

Multi-channel analytics platform aggregating 8+ e-commerce and quick-commerce channels — real-time dashboards, dynamic report builder, cohort analysis, 2FA, RBAC, and 192+ API endpoints.

NestJS 10Next.js 15React 18PostgreSQLRedisBull/BullMQSocket.ioD3.jsChart.js

Problem

A consumer-brand operations team needed a single pane of glass across Amazon, Flipkart, Blinkit, Zepto, and several other marketplaces — each with its own credentials, schema, refresh cadence, and product taxonomy. The team also needed a self-serve report builder so analysts could compose new metrics without engineering involvement.

Solution

NestJS backend with 192+ REST endpoints powering a Next.js 15 + React 18 dashboard. Long-running channel sync jobs run on BullMQ workers. Real-time dashboard updates push via Socket.io. A dynamic report builder renders D3.js-driven cohort analyses and Chart.js summaries. Auth uses TOTP-based 2FA/MFA and CASL for fine-grained RBAC. IMAP-based email polling handles platform-verification emails (some marketplaces still send OTPs to email instead of API).

Architecture

  • NestJS monolith with feature modules per channel + a shared analytics module.
  • BullMQ + Redis for async sync jobs (one queue per channel, separate concurrency knobs).
  • PostgreSQL as primary store; per-channel staging tables → consolidated analytics tables.
  • Next.js dashboard with React Server Components for the static shell + client components for the interactive D3/Chart.js widgets.
  • Socket.io for real-time refresh of "currently syncing" widgets.
  • CASL for permission checks; TOTP via the otplib ecosystem.

Key technical decisions

  • NestJS over a microservices mesh — sync jobs are heavy but the analytics module benefits from in-process JOINs across channel data; a monolith with BullMQ for parallelism was the simpler win.
  • CASL over a custom RBAC — declarative ability definitions made the 192+ endpoints' authz manageable.
  • IMAP polling for OTP emails — not pretty, but Amazon Seller Central's verification flow forces it.

Outcomes

  • 192+ documented API endpoints; >95% covered by integration tests.
  • Real-time dashboards refresh under 2s on the channel-sync hot path.

What's next

  • Move long-running sync workers to a dedicated worker pool isolated from the API process.
  • Migrate dashboards to streaming server components for instant first paint of large tables.