Production-ready API for running Google Lighthouse audits at scale
Features β’ Quick Start β’ API Docs β’ Architecture β’ Contributing
Lighthouse Parallel is a high-performance API that enables running Google Lighthouse audits concurrently at massive scale. Built with NestJS, BullMQ, and modern DevOps practices, it's designed for:
- π’ Enterprises monitoring hundreds of web properties
- π Performance teams running continuous audits in CI/CD
- π SEO agencies analyzing client websites at scale
- π οΈ Developers integrating performance testing into workflows
| Problem | Solution |
|---|---|
| Running audits sequentially is slow β±οΈ | Parallel execution with configurable workers |
| Chrome instances are resource-heavy πΎ | Isolated child processes with smart lifecycle management |
| Managing job queues is complex π€― | BullMQ integration with retry logic & monitoring |
| No built-in reporting dashboard π | Modern React dashboard with real-time updates |
| Difficult to integrate webhooks π | Built-in webhook support for CI/CD pipelines |
- β‘ Massive Parallelism: Run 8-32 concurrent audits (configurable based on server resources)
- π Internationalization: Generate reports in 20+ languages (
en,fr,de,es,ja, etc.) - π¦ Batch Processing: Audit hundreds of URLs with a single API call
- π Smart Retries: Automatic retry with exponential backoff on failures
- πͺ Webhooks: Real-time notifications when audits complete
- π Prometheus Metrics: Production-grade monitoring and observability
- π¨ Modern Dashboard: React-based UI for managing audits and viewing results
- π Security: API key authentication, JWT tokens, Helmet protection
- π³ Docker Ready: Production-optimized multi-stage builds
- π Auto-scaling: Handles traffic spikes with BullMQ's smart concurrency
- Zero Race Conditions: Parent-controlled child process lifecycle (no arbitrary timeouts)
- Resource Efficient: Automatic cleanup of completed jobs and reports
- Health Checks:
/healthendpoints for Kubernetes/Docker orchestration - Structured Logging: Winston with daily rotation for production debugging
- Type Safety: Full TypeScript across backend and frontend
- Developer Experience: Hot reload, comprehensive error handling, Swagger docs
- Node.js 20+ and npm 9+
- Docker & Docker Compose (recommended)
- Redis 6+ (included in docker-compose)
# Clone the repository
git clone https://github.com/SamuelChojnacki/lighthouse-parallele.git
cd lighthouse-parallele
# Generate secure credentials
node -e "console.log(require('crypto').randomBytes(32).toString('base64'))" > .api-key
node -e "console.log(require('crypto').randomBytes(64).toString('base64'))" > .jwt-secret
# Create .env file
cat > .env << EOF
PORT=3002
REDIS_HOST=redis
REDIS_PORT=6379
API_KEY=$(cat .api-key)
JWT_SECRET=$(cat .jwt-secret)
WORKER_CONCURRENCY=8
NODE_ENV=production
EOF
# Start all services
docker-compose up --build
# API available at http://localhost:3002
# Dashboard at http://localhost:3002/ (login with configured password)# Install dependencies
npm install
cd frontend && npm install && cd ..
# Start Redis
docker-compose up redis -d
# Configure environment
cp .env.example .env
# Edit .env with your credentials
# Run in development mode
npm run start:dev
# Build for production
npm run build
npm run start:prodAll API requests require authentication via API key:
curl -H "X-API-Key: YOUR_API_KEY" http://localhost:3002/lighthouse/statsPOST /lighthouse/audit{
"url": "https://example.com",
"categories": ["performance", "accessibility", "seo"],
"locale": "fr",
"webhookUrl": "https://your-app.com/webhook",
"webhookToken": "secret"
}Response:
{
"jobId": "550e8400-e29b-41d4-a716-446655440000",
"url": "https://example.com",
"status": "queued",
"reportUrl": "/reports/550e8400-e29b-41d4-a716-446655440000.json"
}POST /lighthouse/batch{
"urls": [
"https://example.com",
"https://google.com",
"https://github.com"
],
"categories": ["performance"],
"locale": "de",
"webhookUrl": "https://your-app.com/batch-webhook"
}Response:
{
"batchId": "batch-550e8400-e29b-41d4-a716-446655440000",
"total": 3,
"jobIds": ["job1", "job2", "job3"],
"status": "processing"
}GET /lighthouse/job/:jobId
GET /lighthouse/batch/:batchId
GET /lighthouse/statsPOST /lighthouse/cleanupWhen a job completes, a POST request is sent to your webhookUrl:
{
"jobId": "550e8400-e29b-41d4-a716-446655440000",
"url": "https://example.com",
"status": "completed",
"performance": 95,
"accessibility": 100,
"reportUrl": "https://your-api.com/reports/550e8400.json"
}βββββββββββββββββββ
β React SPA β β Modern Dashboard (Vite + React 19 + Tailwind)
ββββββββββ¬βββββββββ
β HTTP/REST
ββββββββββΌβββββββββββββββββββββββββββββββββββββββββ
β NestJS API (Port 3002) β
β ββββββββββββββββββββββββββββββββββββββββββββ β
β β Controllers (Auth, Audit, Admin, Logs) β β
β ββββββββββββββββββ¬ββββββββββββββββββββββββββ β
β β β
β ββββββββββββββββββΌββββββββββββββββββββββββββ β
β β Lighthouse Service (Job Manager) β β
β ββββββββββββββββββ¬ββββββββββββββββββββββββββ β
βββββββββββββββββββββΌβββββββββββββββββββββββββββββββ
β
ββββββββββββΌβββββββββββ
β BullMQ Queue β β Redis-backed job queue
β (8-32 concurrent) β
ββββββββββββ¬βββββββββββ
β
βββββββββββββββ΄ββββββββββββββ
β Lighthouse Processor β
β (Worker with concurrency β
β controlled by parent) β
βββββββββββββββ¬ββββββββββββββ
β
βββββββββββββΌβββββββββββββ
β Child Process Pool β
β ββββ ββββ ββββ ββββ β
β βC1β βC2β β..β βCNβ β β Isolated Chrome instances
β ββββ ββββ ββββ ββββ β
ββββββββββββββββββββββββββ
β
βββββββββββββΌβββββββββββββ
β Lighthouse Core β β Google's audit engine
β (Performance, SEO, β
β Accessibility, etc.) β
ββββββββββββββββββββββββββ
- Parent-Controlled Lifecycle: No arbitrary timeouts - parent process fully controls child termination with SIGKILL
- Process Isolation: Each audit runs in a forked child process with dedicated Chrome instance
- Smart Concurrency: Worker count configurable based on server CPU/RAM (1-2x vCPU cores)
- Graceful Shutdown: BullMQ handles in-flight jobs during deployment
- Stateless Workers: Horizontal scaling ready (add more workers/servers)
| Scenario | Sequential | Parallel (8 workers) | Speedup |
|---|---|---|---|
| 10 audits | ~450s | ~60s | 7.5x |
| 50 audits | ~2250s | ~300s | 7.5x |
| 100 audits | ~4500s | ~600s | 7.5x |
Test environment: 16 vCPU, 64GB RAM, Hetzner Cloud
- Memory: ~400MB per Chrome instance
- CPU: ~0.5-1 vCPU per active audit
- Recommended: 16 workers on 16 vCPU machine
| Server Specs | Recommended Workers |
|---|---|
| 4 vCPU, 8GB RAM | 4-6 workers |
| 8 vCPU, 16GB RAM | 8-12 workers |
| 16 vCPU, 64GB RAM | 16-24 workers β |
| 32 vCPU, 128GB RAM | 32-48 workers |
# Server
PORT=3002
NODE_ENV=production
# Redis
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_DB=0
# Security
API_KEY=your-secure-api-key
JWT_SECRET=your-jwt-secret
DASHBOARD_PASSWORD_HASH=bcrypt-hash
# Performance
WORKER_CONCURRENCY=8 # Adjust based on server resources
# CORS
CORS_ORIGINS=http://localhost:5173,https://your-domain.comCustomize audit settings in src/lighthouse/workers/lighthouse-runner.js:
const lighthouseOptions = {
logLevel: 'error',
output: 'json',
onlyCategories: ['performance', 'accessibility', 'seo', 'best-practices'],
locale: 'en',
formFactor: 'mobile',
throttling: {
rttMs: 150,
throughputKbps: 1638.4,
cpuSlowdownMultiplier: 4
}
};version: '3.8'
services:
redis:
image: redis:7-alpine
volumes:
- redis-data:/data
api:
build: .
ports:
- "3002:3002"
environment:
REDIS_HOST: redis
WORKER_CONCURRENCY: 16
depends_on:
- redis
deploy:
resources:
limits:
cpus: '8'
memory: 16GapiVersion: apps/v1
kind: Deployment
metadata:
name: lighthouse-api
spec:
replicas: 3
template:
spec:
containers:
- name: api
image: lighthouse-parallel:latest
resources:
requests:
cpu: "4"
memory: "8Gi"
limits:
cpu: "8"
memory: "16Gi"
env:
- name: WORKER_CONCURRENCY
value: "8"# Unit tests
npm test
# E2E tests
npm run test:e2e
# Coverage
npm run test:covWe welcome contributions! Please see CONTRIBUTING.md for details.
- Fork the repo
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Run tests:
npm test - Commit:
git commit -m 'Add amazing feature' - Push:
git push origin feature/amazing-feature - Open a Pull Request
- π Add support for custom Lighthouse configs
- π Enhance dashboard with charts and analytics
- π Add integrations (Slack, Discord, Teams)
- π§ͺ Improve test coverage
- π Translate documentation to other languages
- π Performance optimizations
- π Bug fixes and improvements
- Parallel audit execution
- Batch processing
- Webhook notifications
- React dashboard
- Multi-language reports
- Prometheus metrics
- GraphQL API
- WebSocket real-time updates
- Historical trend analysis
- Custom Lighthouse plugins
- Slack/Discord integrations
- Scheduled recurring audits
- PDF report generation
This project is licensed under the MIT License - see the LICENSE file for details.
- Google Lighthouse - The audit engine
- NestJS - Progressive Node.js framework
- BullMQ - Premium queue package for handling distributed jobs
- Chrome Launcher - Chrome instance management
- π§ Email: [email protected]
- π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
- π Documentation: Wiki
β Star this repo if you find it useful!
Made with β€οΈ by SabaΓ― team