Senior Backend Engineer · Data Engineering · CabbageApps

Tribz Data Aggregation Layer
A priority queue architecture for reliable multi-platform social media data

Tribz is a French social intelligence platform that needed a centralised data aggregation service to pull creator and campaign metrics from Instagram, YouTube, and TikTok - reliably, at scale, and in compliance with GDPR. At the time, there was no pipeline at all: data pulls were manual, inconsistent, and frequently hit API rate limits with no recovery mechanism. New users signed up and saw nothing for hours. I designed and built the aggregation service from scratch: a NestJS backend with Redis/Bull priority queues, login-triggered high-priority jobs for immediate post-signup data, background cron jobs for general refresh, GDPR-compliant data handling with full processing audit trails, and a BI-queryable schema powering the Tribz analytics dashboard. Delivered in 2 months in close collaboration with the Paris-based product team. 98% data accuracy and availability in production.

tribz.data.pipelineLive
98%
Accuracy
3
APIs
15%
Risk ↓
2mo
Delivered
ig · yt · tiktok · queue ↑
The Challenge

No data pipeline - three platforms, all manual, no rate limit handling

Tribz needed to aggregate creator and campaign data from Instagram, YouTube, and TikTok to power their social intelligence dashboard. There was no centralised pipeline - each data pull was ad-hoc, inconsistent, and prone to hitting API rate limits with no retry or backoff mechanism. When rate limits hit, the failure was silent: data simply stopped refreshing and no one was alerted. New users experienced multi-hour delays before seeing their first data after sign-up, which was a direct hit to onboarding conversion. The platform processed data for French and European clients, making GDPR compliance a hard requirement from day one.

  • No centralised pipeline - manual, inconsistent data pulls per platform
  • API rate limits hit frequently with no retry or queue management
  • New user onboarding delayed - data not available immediately after sign-up
  • No GDPR-compliant data handling or processing audit trail
  • Business intelligence insights delayed by hours due to lack of automation

tribz_pipeline.beforeDegraded
manual
Data pulls
3-4h
Onboarding delay
none
GDPR audit trail
Data freshness3–4 hours stale
Rate limit failuresFrequent
GDPR complianceNot addressed
The Solution

A priority queue aggregation layer built for reliability and compliance

1
Centralised NestJS aggregation service - Single source of truth for all social media data:
  • Unified NestJS service handles fetching, normalization, dedup
  • Replaced per-platform ad-hoc scripts with consistent logic
  • Unified error handling, retry logic, observability
  • Single service for all three APIs
2
Redis/Bull priority queue architecture - Asynchronous job queue with automatic retries:
  • Bull job queue backed by Redis
  • Configurable priority levels for jobs
  • Automatic exponential backoff on rate limits
  • Dead-letter handling for failed jobs
3
Login-triggered high-priority data fetching - Real-time metrics on user signup/login:
  • Login & signup events enqueue high-priority jobs
  • Immediate data fetch bypassing background queue
  • Users see Instagram, YouTube, TikTok metrics in seconds
  • General refresh runs on scheduled cron cadence
4
GDPR-compliant data pipeline architecture - Compliance built in from the start:
  • Consent checks before any data pull
  • Data minimisation at ingestion (store only needed)
  • Encrypted storage at rest with audit trail
  • Worked with legal/product teams on all milestones
5
BI-queryable schema for the analytics dashboard - Optimized PostgreSQL schemas for BI queries:
  • Creator performance metrics optimized for queries
  • Campaign comparisons & audience analytics queries
  • Redis cache layer for frequently accessed metrics
  • Configurable TTLs per data type
Social Media Aggregation Pipeline
INGESTION TRIGGERSHigh-Priority EventUser login / signup hookScheduled CronPeriodic refresh jobsenqueueREDIS / BULL - PRIORITY QUEUEHIGH queue (login) · NORMAL queue (cron) · Consumer groupsExponential backoff on rate-limits · Dead-letter on max retriesConcurrency limits per API · Configurable TTL per job typeInstagram WorkerGraph API v18Media · Insights200 req/hr limitAuto backoff ✓YouTube WorkerData API v3Channels · Analytics10K quota/dayDaily quota trackingTikTok WorkerDisplay APIVideos · MetricsOAuth2 refreshToken rotation ✓Instagram Graph APIGraph API v18External rate-limitedYouTube Data APIData API v3External rate-limitedTikTok Display APIDisplay APIExternal rate-limitedGDPR COMPLIANCE PIPELINE1. ConsentUser consentverified first2. MinimizeOnly collectdeclared fields3. EncryptPII encryptedat rest4. Audit TrailAccess loggedper GDPR Art.30PostgreSQLBI-queryable schemaLong-term analytics storageRedis CacheConfigurable TTL per profileAPI quota preservation98% data accuracy · GDPR compliant · 3 APIs · delivered in 2 monthsPriority queue prevents rate-limit overruns · dead-letter ensures no silent drops
Redis/Bull Priority Queue Architecture
EVENT SOURCES → PRIORITY ASSIGNMENTUser LoginHIGH priority → immediateScheduled SyncNORMAL priority · 15 minGDPR CleanupLOW priority · dailyREDIS / BULL PRIORITY QUEUE TIERSHIGHpriority: 10concurrency: 3NORMALpriority: 5concurrency: 3LOW / BGpriority: 1concurrency: 2NestJS Worker Pool8 concurrent workers · Bull queueRATE-LIMITED PLATFORM APIsInstagram APIrate: 200 req/hrTwitter APIrate: 300 / 15 minYouTube APIrate: 10k req/dayPostgreSQL · BI-queryable schemanormalised · analytics dashboard · GDPR-safeDLQ · Failed Jobsretry 3× · alert on exhaustionRedis/Bull · 3 priority tiers · GDPR-compliant · 3 platforms · real-time delivery
The Results

From fragile to enterprise-grade

98%
Accuracy & uptime

The aggregation server achieved 98% data accuracy and availability, providing reliable business intelligence insights for Tribz clients.

3
Platforms integrated

Instagram, YouTube, and TikTok APIs all connected within the same queue-based architecture, with shared retry and rate-limit handling.

15%
Compliance risk ↓

GDPR-compliant data workflows reduced compliance exposure by 15%, and all regulatory milestones were met on time with the French partner team.

2mo
Delivery time

Full solution designed, built, tested, and deployed to production in two months - including cross-timezone collaboration with the Paris-based product team.

Engineering Decisions

Architectural choices, tradeoffs, and what nearly broke production

Queue-based vs direct API calls

Why use a message queue instead of synchronous API calls?

Direct API calls would block user requests and fail hard on rate limits. A queue decouples user-facing requests from slow API operations, enabling retries, backoff, and graceful handling of rate limits without impacting the user experience.

Redis + Bull vs Kafka or RabbitMQ

Why not use Kafka or RabbitMQ for a production system?

Kafka and RabbitMQ are designed for high-throughput event streaming with strong durability guarantees. Our use case was simpler: prioritise new user data fetching and retry failed API calls. Bull (Redis-backed queue) gave us 95% of what we needed with 1/10th the operational complexity. We could scale it later if needed.

Why login-triggered prioritisation?

Why prioritise login events over other data fetches?

New users expect data to be available immediately after sign-up. If their Instagram followers, YouTube channel stats, and TikTok metrics aren't visible, they bounce. Login-triggered prioritisation ensures fresh data within seconds of first login while background cron jobs handle general refresh on a slower cadence.

What nearly failed: Data consistency under rate limits

What broke during peak load testing?

During staging load tests with 500 simultaneous sign-ups, the aggregation layer hit Instagram's 200 requests/hour rate limit almost immediately. Without careful queue backoff, we were creating thousands of orphaned jobs that would never complete.

Root cause: exponential backoff was too aggressive (retry after 30s, then 60s, then 120s). Fixed by implementing sliding-window rate limiting that tracks remaining quota per API, distributes requests over time, and retries only when quota resets.

Lesson: Social media APIs have strict, opaque rate limits. Test at 10x expected peak load with realistic concurrent requests.

GDPR compliance as architecture, not bolted on

How did you ensure GDPR compliance from day one?

We built compliance into the data pipeline: consent checks before any data pull, data minimisation at ingestion (store only what we need), encrypted storage at rest, and a complete audit trail of all access and processing. Worked with the legal team in Paris from day one; no surprises at launch.

THE TRADEOFFS

Cost · Risk · Tradeoffs

Estimated values based on production metrics and monitoring data

Cost Impact
~15% dev effort
GDPR compliance cost
Audit trails, consent tracking, and data minimisation add implementation overhead. Worth every hour for regulatory confidence and client trust.
Risk Reduction
low → medium
Operational overhead
Queue monitoring, dead-letter queues, and retry policies require active management. Mitigated with comprehensive alerting and job inspector dashboards.
reduced 40%
Multi-API integration risk
Centralised aggregation layer acts as a shock absorber. API outages on Instagram don't impact YouTube/TikTok data fetching. Graceful degradation instead of cascading failures.
Technical Tradeoff
1-2s → 5-10s
Queue latency
Asynchronous processing adds latency. Trade accepted for reliability and rate-limit handling. Users see data within 5-10 seconds instead of real-time, but guaranteed success vs frequent failures.
Before vs After

Transformative Results: Before vs After

✕Before
  • Single API dependencyFragile & limited
  • No real-time prioritizationDelayed insights
  • Basic loggingHard to debug
  • Non-compliant by designGDPR risk
→
✓After
  • Queue-based architectureReal-time sync
  • Multi-API integrationResilient & scalable
  • Login-prioritised fetchingFaster insights
  • Structured loggingEasy observability
  • GDPR-compliantSecure by design
⇪Business Impact
98% data accuracy maintained
3 platforms fully integrated
GDPR compliant from day one
Tech Stack

What was used

RuntimeNode.js · TypeScript
FrameworkNestJS
QueueRedis · Bull
DatabasePostgreSQL · Prisma
Secondary DBMongoDB
Real-timePusher
CI/CDGitHub Actions
TestingJest
CloudAWS
ComplianceGDPR

Need a scalable data aggregation pipeline or third-party API integration?

Whether it's multi-platform API pipelines, queue-based ETL architectures, or GDPR-compliant data systems - let's talk about what you're building.