DmBroo

completed

DmBroo

Developed at DmBroo. Began as a freelance contract that evolved into a full time engineering role.

Overview

DmBroo is a creator-first Instagram automation SaaS that automates message replies and engagement based on user interactions. Built with Next.js, Node.js, and Redis, the platform listens to Meta webhook events to trigger automated comment replies, direct messages, and custom lead generation forms when users comment on a post, reply to a story, or send a DM. The application prioritizes account safety with custom queue rate-limiting, proactive long-lived token refreshing, and automatic user deauthorization syncing while It's frontend features a rich dashboard with widgets displaying key performance metrics like new followers gained, total outreach, and best time to post.

Features

  • Automated responses triggered by Instagram comments on posts, story replies, or direct messages matching specific text, or phrases.

  • Ask-to-Follow Gate: Gated delivery that checks if the interacting user follows the account, sending a customizable follow-request link before delivering the main payload.

  • Opening Messages: Sends interactive, button-enabled ice-breaker messages to users before launching the full automation sequence.

  • In-App Lead Gen Forms: Drag-and-drop custom forms supporting text, numbers, dropdowns, ratings, file uploads, and checkboxes to capture customer contact data.

  • Analytics Dashboard: Rich widgets displaying key performance indicators, total automation executions, new followers gained, and best time to post.

  • Meta OAuth & Token Lifecycle: Multi-account secure connection with cron-based 60-day token auto-refreshing and a deauthorization webhook listener to automatically disconnect revoked accounts.

  • Redis/BullMQ Queue Worker: Dedicated background worker package with per-user concurrency limiting and rate-limiting controls to prevent Meta API blocks.

  • Tiered Subscription System: Razorpay-integrated subscription plans (Free, Basic, Premium, Black) mapped to dynamic credit limits, usage ledgers, and automated email alerts.

Tech Stack

Frontend

BunReactNext.JsTailwindTypescript

Backend

BunNode.jsRedisBullMq

Database

MongoDBPrisma

Tools & Services

METAVercelUpstashRazorpayResendClerkUploadThing

Challenges & Solutions

Challenge: Duplicate Webhook Deliveries from Meta

Implemented a two-stage deduplication mechanism using Redis.
First checks a permanent 'already handled' event log in Redis to filter out duplicate webhook retries.
Second, acquires a temporary 30-second atomic processing lock (NX) in Redis to block concurrent worker threads from processing the same event.

Challenge: Stateless State Management for Multi-Step Flows ('Ask-to-Follow')

Created a Redis-backed state machine to track user opt-ins, follow gates, and opening messages across discrete webhooks.
Halts execution, registers a pending confirmation in Redis, and leverages Instagram Quick Replies as stateful callbacks to trigger the final payload delivery.

Challenge: API Rate Limiting & Platform Safeguards

Extracted Graph API rate limit usage headers in real-time on every outgoing request to keep a Redis tracking cache updated.
Enforced a 2-second account-level spam guard cooldown and built global panic thresholds that automatically throttle non-premium accounts when the app's overall API limits are threatened.

Challenge: Database Write Bottlenecks during Peak Load

Implemented a Write-Behind pattern using Redis lists (rpush) to buffer execution outcomes asynchronously.
w Built a background flusher interval that drains the buffer in batches of 500, bulk-deduplicates them, and performs a single transactional DB write every 5 seconds.