← All work

SocialCrab (socialcrab.id) · 1 Nov 2025

SocialCrab - Social Media Analytics and Real-Time Crawl UI

Frontend UI, real-time Socket.IO crawl handling, and 16-slide Playwright PDF decks for socialcrab.id.

Role Freelance Frontend Engineer
Stack
Next.jsTypeScriptTailwind CSSTanStack QueryChart.jsSocket.IOFramer MotionPlaywright

The problem

Marketers, social media managers, and agency teams spend hours turning raw Instagram numbers into decks they can send to clients. Generic dashboard exports usually break down in practice: cramped Chart.js labels, uneven card spacing, and static templates that fail when a profile has sparse posting days.

Crawling Instagram data also takes longer than a normal HTTP request. Every profile or keyword refresh runs asynchronously through a backend orchestrator and queue, so the frontend has to show each stage of the crawl without locking navigation or firing duplicate crawl jobs.

What I built

As a freelance frontend engineer at socialcrab.id (opens in new tab), I built the analytics UI and handled the Socket.IO connection between the Next.js frontend and the backend orchestrator.

On the UI side, I built and refined the Instagram profile reports, keyword reports, and post monitoring pages. I also updated the Instagram keyword and profile slide decks so all 16 slides pull live report data instead of static placeholders, with scaled typography, taller charts, and clean print layout.

Main work shipped:

  • Instagram profile and keyword analytics with Chart.js visualizations, section navigation, datepicker range filtering (including empty-range modals), and Framer Motion transitions.
  • Dedicated Instagram post monitoring pages and a Check for Updates flow where users pick a post count before refreshing a report.
  • Automated 16-slide PDF deck exports rendered by Playwright Chromium inside a multi-stage standalone Docker container.
  • Real-time Socket.IO listeners for requested, queued, processing, finish-igp, finish-igp-datepicker, and error events, plus status badges for private and not-found accounts.

The hard part

Coordinating Socket.IO crawl events with page navigation and session state caused the most subtle bugs. If a page emitted a crawl request before the user session and socket connection were ready, or re-emitted while a crawl was already running, the screen could lock onto an empty report frame or queue duplicate jobs on the backend.

I fixed this by gating emits until both the socket and session were ready, skipping re-emits during an active crawl, hiding empty report frames while loading, and keeping navigation clickable while a crawl ran in the background.

if (!socket?.connected || !session?.user?.email || isCrawlLoading) {
  return;
}

socket.emit('instagram', {
  mode: 'instagram-profile',
  email: session.user.email,
  query: username,
  postCount,
  refresh,
});

PDF deck export inside Docker had its own failure modes. Post cards picked up gray shadow artifacts in print mode, sparse daily metrics broke charts, and Next.js standalone builds sometimes missed the Playwright Chromium binary. I resolved these by installing the exact Chromium revision through the app’s Playwright CLI in the Docker build, normalizing space encoding on multi-word keyword URLs, and guarding sparse metric arrays before rendering charts.

Results

The web app runs in production at socialcrab.id (opens in new tab), letting users look up an Instagram handle or keyword, track crawl progress live, and export a 16-slide PDF deck. I also removed leaked client JWT secrets, added security headers and IP forwarding, and switched the Dockerfile to a multi-stage standalone build.

What I learned

Socket.IO UI breaks fast when loading is a single boolean. Tracking each backend event (requested, queued, processing, finish, error) separately stopped phantom spinners and duplicate crawl requests.

Headless Chromium prints CSS differently from a desktop screen. Box shadows and responsive wrappers that looked fine in Chrome turned into gray blocks on PDF slides until I wrote print-specific rules and tested exports against the exact Chromium revision installed in Docker.