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
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
| Measure | Value | Source |
|---|---|---|
| Cost | ~4× cheaper scraping at scale | hot/cold sweeper |
| Isolation | row-level security on every table | supabase/migrations |
| Data integrity | corrupt runs quarantined pre-persistence | scrape-monitor |
| History | ~2,000 posts backfilled per new account | backfill 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