How lobo017/metacrawler works
1. Overall shape
MetaCrawler is a polyglot, service-oriented scraping platform. The repo is split into a browser UI, a central GraphQL gateway, and three execution backends specialized for different workload types: Go for fast static crawling, Node.js for browser automation, and Python for NLP / RAG / async orchestration.
2. User-facing layer: frontend/
The frontend is a Next.js dashboard used for workspace management, job control, analytics, and chat-style interaction. Components like Dashboard, JobController, AnalyticsChart, and the chat modals suggest the UI is mainly an operations console rather than a content site. Its only architectural dependency is the API layer.
3. API boundary: api-gateway/
The gateway is the system’s single entry point. It exposes a GraphQL schema (schema.graphql) and resolver layer (resolvers.js) on Node.js/Apollo, with tests for the resolver contract. This layer is where frontend requests are unified and where job submission, status lookup, and orchestration logic are concentrated.
4. Gateway role in the data flow
The gateway acts as the control plane: it accepts a job request, assigns/returns an identifier, forwards work to the right backend, and provides a stable API for the frontend. The README also describes a webhook callback path for long-running work, so the gateway is not just a proxy—it also receives asynchronous completion updates.
5. Python intelligence service: backend-python/
This service is the semantic enrichment and knowledge layer. It includes:
- app/nlp/processor.py and site_qa.py for NLP and site-aware question answering
- app/unified_rag.py for local retrieval-augmented generation over crawled content
- app/scrapers/ for crawl-oriented helpers
- celery_worker.py for asynchronous task execution
This backend is the natural place for long-running jobs and post-processing of scraped data.
6. Python execution model
The presence of Celery indicates the Python backend is designed for background jobs, not just synchronous HTTP responses. The README’s lifecycle model (queued -> running -> done/failed) and webhook updates fit this service well: it can process work, then notify the gateway when complete.
7. Go extraction engine: backend-go/
The Go service is the high-throughput crawler/extractor optimized for static pages. Its internal/scraper/ package contains crawler.go and engine.go, and internal/queue/consumer.go suggests it can consume jobs from a queue. This is the lowest-overhead data extraction path in the system.
8. Node automation service: backend-node/
This backend is the dynamic browsing layer. Its src/scrapers/browser.js and Playwright-oriented setup indicate it handles pages that require JavaScript execution, browser state, or interactive flows. This service fills the gap where Go-style HTTP scraping is insufficient.
9. Primary data flow across services
The typical flow is:
Frontend → GraphQL gateway → chosen backend (Go/Python/Node) → results/status back to gateway → frontend refreshes/visualizes.
Static scraping prefers Go, dynamic rendering prefers Node, and enrichment/knowledge-building flows through Python. The gateway keeps these execution paths unified for the UI.
10. Operational state and caching
The README describes Redis as the message broker and MongoDB as persistent storage, with deterministic deduplication based on request parameters. Architecturally, that means jobs are addressed by identity, queued asynchronously, and reused when possible rather than recomputed.
11. Deployment boundary
Each service has its own Dockerfile, and the root docker-compose.yml ties them together. This is a container-first, locally composable deployment with separate runtime images for frontend, gateway, and each backend. The .github/workflows/ci.yml file shows the repo also has multi-service CI.
12. Testing and service isolation
Tests are intentionally split by service boundary: GraphQL resolver tests in the gateway, crawler tests in Go, and resilience/knowledge tests in Python. That separation reinforces the architecture: each backend owns its own domain logic and can be validated independently.
13. Notable architectural constraint
The repo is not a monolith with a single scraping pipeline. It is a router plus specialized workers system. The important diagram should show the gateway as the center, with the frontend on one side and three independent execution backends on the other, plus shared infrastructure for queueing, caching, and persistence.
Main entry points: resolvers.js Resolvers · celery_worker.py Celery Worker · docker-compose.yml Compose Stack · index.js Gateway Server
Components 18
Frontend
Next.js operations console for workspaces, jobs, analytics, and chat
- Dashboard UI · User-facing workspace, job, analytics, and chat interface
frontend/components/Dashboard.jsx - Job Control · Submits and monitors scraping jobs
frontend/components/JobController.jsx - Chat Modals · Chat-style interaction surfaces for workspace assistance
frontend/components/ChatModal.jsx
API Gateway
GraphQL control plane and request router
- GraphQL Schema · Single API contract exposed to the frontend
api-gateway/schema.graphql - Resolvers · Routes requests and coordinates job lifecycle logic
api-gateway/resolvers.js - Gateway Server · API entrypoint that hosts the GraphQL gateway
api-gateway/index.js
Go Backend
High-throughput static crawling and extraction
- Crawler Engine · Core static crawling and extraction pipeline
backend-go/internal/scraper/engine.go - Crawler Core · Fetches and normalizes static pages
backend-go/internal/scraper/crawler.go - Queue Consumer · Consumes crawl jobs from the queue
backend-go/internal/queue/consumer.go
Node Backend
Browser automation for dynamic pages
- Browser Scraper · Handles dynamic, JavaScript-heavy browsing flows
backend-node/src/scrapers/browser.js - Node Worker · Browser-automation backend process
backend-node/index.js
Python Backend
NLP, RAG, and asynchronous enrichment
- NLP Processor · Semantic enrichment and text processing
backend-python/app/nlp/processor.py - Unified RAG · Local retrieval-augmented generation over crawled content
backend-python/app/unified_rag.py - Celery Worker · Background task execution for long-running jobs
backend-python/celery_worker.py - Site Crawler · Async scraping and site-aware crawl helpers
backend-python/app/scrapers/site_crawler.py
Shared Infra
Queueing, persistence, and composition boundary
- Redis · Message broker for asynchronous job dispatch
docker-compose.yml - MongoDB · Persistent job and content storage
docker-compose.yml - Compose Stack · Container orchestration for the multi-service local stack
docker-compose.yml
Connections 25
- Dashboard UI → Gateway Server: API calls · Frontend talks only to the gateway
- Job Control → Resolvers: submit/status · Job creation and polling flow
- Chat Modals → Resolvers: chat requests · Interactive workspace requests are routed through the gateway
- Gateway Server → GraphQL Schema: serves · Gateway exposes the GraphQL contract
- Gateway Server → Resolvers: executes · Resolves requests and control-plane actions
- Resolvers → Queue Consumer: static jobs · Routes fast crawl jobs to the Go backend
- Resolvers → Browser Scraper: dynamic jobs · Routes browser-heavy work to the Node backend
- Resolvers → Celery Worker: enrichment jobs · Routes NLP and RAG-oriented work to Python
- Resolvers → Redis: enqueue · Uses the broker for asynchronous execution
- Resolvers → MongoDB: persist · Stores job state and results
- Queue Consumer → Crawler Engine: consume · Worker hands off to the crawler engine
- Crawler Engine → Crawler Core: crawl · Engine coordinates page fetching and extraction
- Node Worker → Browser Scraper: run · Node process hosts browser automation logic
- Celery Worker → NLP Processor: process · Background work flows into NLP processing
- Celery Worker → Unified RAG: retrieve · Worker can build answers from crawled content
- Celery Worker → Site Crawler: scrape · Worker can run async site crawling tasks
- Queue Consumer → Redis: broker · Consumes jobs from the shared queue
- Celery Worker → Redis: broker · Celery uses Redis for task dispatch
- Crawler Engine → MongoDB: results · Extraction output is stored for reuse
- Unified RAG → MongoDB: knowledge · RAG reads persisted crawl content
- Compose Stack → Gateway Server: runs · Compose includes the gateway container
- Compose Stack → Queue Consumer: runs · Compose includes the Go backend
- Compose Stack → Node Worker: runs · Compose includes the Node backend
- Compose Stack → Celery Worker: runs · Compose includes the Python backend
- Compose Stack → Dashboard UI: runs · Compose includes the frontend container