Instagram Automation and Analytics Platform
A distributed platform that operates a large fleet of Instagram accounts from one place, generates their content with AI, and tracks engagement across the whole network.
This is a distributed system for running a large fleet of Instagram accounts and their content from one place. Each account runs in its own isolated browser session with its own network identity, work is dispatched through a durable job queue across a fleet of worker processes, and post content is produced by an AI generation pipeline. It became the most complex thing I have built.
I open sourced the task-neutral infrastructure layer, and the links below point straight at the code. Parts of the original system only made sense for operating accounts at a scale Instagram’s terms do not allow, so those are left out and the repository documents exactly what is and is not published.
Durable job queue
The backbone is a distributed job runner that leases work to a fleet of workers instead of running it inline. A worker takes a lease on a job, does it, and marks it done. If the worker crashes, the lease expires and another worker picks the job up, so nothing is lost on a restart. It is built from filesystem primitives rather than a message broker, which keeps the interesting parts, the leases and reclamation and backpressure, visible in a few hundred lines.
Concurrency and isolation at scale
Each browser session holds hundreds of megabytes of memory, so the number that can run at once on one host is bounded. Two tiers of control keep a box from tipping over. A per-session mutex makes sure two processes never touch the same account profile at once, and a box-wide concurrency cap with a resource-admission gate refuses to start another session when free memory drops below a watermark. Every account is pinned to its own proxy so sessions never share a network identity.
AI content pipeline
Post content is generated, not hand written. The content pipeline writes captions with a language model steered by few-shot examples and generates images from scene descriptions, with prompt-version hashing so any output traces back to the exact prompt that made it. It runs across more than one model provider with retry and fallback so a single provider outage does not stop a run.
Statistics across the network
The platform collected engagement and audience statistics for every account and stored them over time, so performance could be tracked and compared account by account across the whole network.
Reliability
A monitor process watches queue depth and worker health, and the worker fleet runs under PM2 with bounded auto-restart so a crashed worker comes back without a persistent fault spinning forever. The full system, including the parts that are described but not published, is written up in ARCHITECTURE.md.