HARSH KAWATRA

INDUSTRY REPORT

The unglamorous half, done properly

A multi-tenant social-analytics SaaS that pulls private engagement metrics public scrapers cannot reach — built on queues, partitioned time-series storage, row-level tenant isolation, and a guard that quarantines corrupt data before it lies to anyone.

Next.js 15 · Node.js · PostgreSQL · Redis · BullMQ · Razorpay


The setup

Agencies tracking short-form creators need metrics the public scrapers cannot see — watch time, completion rate, CTR, reach. Those only exist behind each platform’s OAuth wall.

The differentiator is plumbing: the OAuth integrations are the moat, and the architecture exists to serve them cheaply, safely, and tenant-isolated from day one.

Multi-tenancy is enforced in the database, or it is not enforced.

The machine

enqueueRLS-scoped readsconsumeupsert + RPCNext.js appdashboards · OAuth flows · billingRedis · BullMQ4 queues, priority-separatedPostgreSQLRLS · month-partitioned metricsWorker servicescrapers · sweeper · token refresh · quality guard
PLATE 04 — Two services, decoupled by queues. The web app enqueues; a standalone worker consumes, scrapes, guards and persists. Dashboard latency is independent of background job load.

The hard parts

On the record

The time-series table is the system’s center of gravity: per-post metric snapshots, range-partitioned by month with a scheduled job creating next month’s partition ahead of time 1. A denormalised viral score is recomputed per sync by a single RPC so dashboard reads never aggregate raw history. Tenancy is row-level security in PostgreSQL — enforced in the database, not in application code that can forget.

OAuth tokens are stored AES-256-GCM encrypted with a fresh IV per operation and refreshed proactively on a six-hour loop, honouring each platform’s own protocol 2. Plan limits are enforced at the worker — the layer that actually spends money — rather than only in the UI.

The numbers

MeasureValueSource
Cost~4× cheaper scraping at scalehot/cold sweeper
Isolationrow-level security on every tablesupabase/migrations
Data integritycorrupt runs quarantined pre-persistencescrape-monitor
History~2,000 posts backfilled per new accountbackfill worker

Errata & Failures

Two names, one system

The project shipped internally as metrICON v2 before becoming VIRALytics. The record is hereby corrected: they are the same system, and VIRALytics is the name.

■ References

Repository ↗