Skip to content
Back to all work
True rolling-window rate limits, zero account bans, full agency dashboard Built for B2B agencies and sales teams

LeadGen Pro, Multi-Tenant LinkedIn Automation SaaS Platform

Production multi-tenant SaaS platform that lets agencies run LinkedIn outreach across many client accounts safely. True rolling-window rate limits, distributed locking, circuit breaker on LinkedIn 422 errors, working-hours scheduling, JWT auth, Fernet-encrypted credentials, full agency dashboard.

Next.js 15 (App Router) FastAPI (Python 3.11) Celery + Celery Beat Redis (Distributed Locking) PostgreSQL (Supabase) Unipile (LinkedIn API) Apify (Prospect Discovery) JWT + Fernet (Auth + Encryption)
Published May 2026 Private repository, walkthrough available on call

TL;DR

A production multi-tenant SaaS platform that lets B2B agencies run LinkedIn outreach across many client accounts safely. True rolling-window rate limits (not calendar-based), distributed locking prevents duplicate task execution, circuit breaker on LinkedIn 422 errors, working-hours scheduling, JWT auth, Fernet-encrypted credentials, and a full agency dashboard with campaign wizard, prospect grid, and template library.

The Problem

Agencies running LinkedIn outreach across many client accounts hit the same wall:

  1. Calendar-based rate limits silently overspend at midnight. Most automation tools reset counters at 00:00 UTC, which means a tool sending 25 invites at 23:59 sends another 25 at 00:01. LinkedIn’s anti-abuse looks at rolling windows.
  2. Single accounts get restricted when working-hours, cooldowns, and per-action limits are not enforced together.
  3. No consolidated dashboard. Agency owners cannot see invites accepted, messages sent, and acceptance-rate trends across their entire book of clients.
  4. Apify scraping does not integrate cleanly with outreach automation, leaving the operator pasting CSVs between tools.

LeadGen Pro fixes all four at production grade.

Outcome

Multi-tenant
Agencies manage unlimited LinkedIn accounts under one login
Rolling window
True 24-hour rolling rate limits, not calendar resets
30+
REST API endpoints across auth, campaigns, prospects, webhooks
4-step
Campaign wizard taking ICP to scheduled outreach in minutes

Specific production wins:

  • Per-client rate enforcement. Each LinkedIn account inside an agency holds its own daily and weekly ceilings (25 invites/day, 100/week, 50 messages/day, 5 InMails/day). All independent.
  • True rolling-window rate limits. Every action timestamp is logged. Eligibility check runs a 24-hour-back SQL query, so the system never overspends at calendar boundaries.
  • Circuit breaker on LinkedIn rate-limit errors. On any LinkedIn 422, the system enters an 8-hour client-wide cooldown. All pending tasks pause. Tasks resume automatically.
  • Apify webhook auto-import. Apify run completion fires a webhook into LeadGen Pro that bulk-imports the prospects into the right campaign with provider-IDs resolved.
  • Fernet-encrypted LinkedIn credentials at rest. JWT for user auth, bcrypt for password hashing, Fernet for stored LinkedIn session credentials.
  • Working-hours and timezone-aware scheduling. Each client has its own timezone and configured business hours. The worker only acts during those hours.

Tech Stack

ComponentTechnologyPurpose
FrontendNext.js 15 App Router + TypeScript (Vercel)Agency dashboard, campaign wizard, prospect grid
Backend APIFastAPI + SQLAlchemy (Vercel)Auth, CRUD, webhook receivers
WorkerCelery + Python (Render)Background task processing
SchedulerCelery Beat (Render)Periodic task scheduling (campaign processing every minute)
DatabasePostgreSQL (Supabase)Primary data store with multi-tenant isolation
Cache and QueueRedis (Render)Message broker, result backend, distributed locking
LinkedIn APIUnipileProfessional-grade LinkedIn automation provider
Prospect DiscoveryApifySearch-result scraping with webhook completion

Key Functionality

  • Multi-account client management with Unipile hosted authentication and per-client rate limits, working hours, and timezone configuration.
  • 4-step campaign wizard: basic info, target criteria (keywords, title, company, location), template selection, scheduling. Campaigns auto-complete when all prospects reach terminal state.
  • Prospect management with bulk Apify import, CSV import, status tracking, 30-day timeout on unaccepted invites, provider-ID resolution.
  • Message templates with dynamic personalisation variables ({{firstName}}, {{company}}, {{title}}), 300-character connection-note enforcement, live preview.
  • Automation engine with human-like random delays (30 to 120 seconds), ETA-based scheduling, working-hours enforcement, graceful recovery after circuit-breaker cooldowns.
  • Webhook integration for connection acceptances (triggers auto-message workflow), account-status changes, Apify completion, with full activity log.
  • Agency dashboard with total clients, active campaigns, connections, messages, real-time activity feed, campaign cards with progress bars.

Agency dashboard, campaign wizard, prospect grid, rolling-window rate limiter logs

Demo Video, Coming Soon

Walkthrough, agency dashboard plus campaign wizard plus rolling-window rate limiter

Estimated length: ~3 minutes

Building something similar?

If a multi-agent pipeline, voice AI deployment, or production automation system is on your roadmap, let's talk through how this applies to your context.