Dev.to WebDev 🛠 Dev 👁 0 📖 1 min read

How I Built Viral Hunter: An AI-Powered Content Intelligence SaaS with Next.js 16, Supabase, and Gemini Flash

How I Built Viral Hunter: An AI Content Intelligence Platform As short-form video dominates the internet, creators face a common problem: spending hours doom-scrolling to find content ideas that actually perform. To s

How I Built Viral Hunter: An AI Content Intelligence Platform

As short-form video dominates the internet, creators face a common problem: spending hours doom-scrolling to find content ideas that actually perform.

To solve this, I designed and built Viral Hunter — a web app that tracks Instagram Reels breakout velocity, calculates a quantitative Viral Score, and generates production-ready scripts using AI.

Here is a technical walkthrough of how the architecture was built for speed, resilience, and scale.

🏗️ Architecture Overview

  1. Frontend & SSR: Next.js 16 (App Router, Server Components, Streaming SSR)
  2. Design System: Tailwind CSS v4 with custom OLED dark-mode palette
  3. Database & Authentication: Supabase (PostgreSQL with Row Level Security)
  4. Resilient Data Pipeline: Apify Multi-Actor Fallback Chain
  5. AI Analysis: Google Gemini Flash with automatic provider fallback
  6. Payment Infrastructure: Razorpay Subscriptions (INR & USD support)

⚡ Key Engineering Challenges & Solutions

1. Resilient Instagram Data Ingestion

Instagram frequently rotates its DOM structure and rate-limits scrapers. A single scraping provider will inevitably fail.

We implemented a Resilient Fallback Chain:

  • Primary actor: Fast dedicated reel extractor
  • Secondary fallback: High-resilience proxy scraper
  • Third fallback: Cached snapshot layer

This ensures our cron jobs (/api/cron/scrape) maintain 99.9% uptime without breaking the feed.

2. The Viral Score Algorithm

Instead of raw view counts, we calculate virality based on growth acceleration:
$$\text{Viral Score} = w_1 \cdot \text{Views} + w_2 \cdot \text{Engagement Rate} + w_3 \cdot \text{Save Ratio} + w_4 \cdot \text{Growth Velocity}$$

This highlights small creators whose reels are experiencing exponential organic growth.

3. Sub-Second Mobile Performance

Short-form creators live on mobile devices. To ensure instant navigation:

  • Added route-level loading.tsx skeletons to eliminate screen freezes
  • Configured prefetch={true} on primary bottom navigation tabs
  • Added touch-manipulation and tactile active states to eliminate the 300ms mobile touch delay

Feedback

Feel free to check it out, run a query in your niche, and let me know your thoughts in the comments!

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.