Sign inSign up

browserautos/chromium

By browserautos

โ€ขUpdated 11 months ago

Production-ready browser automation API powered by Playwright Chromium

Image
0

459

browserautos/chromium repository overview

โ browser.autos

Official Docker Image: browserautos/chromium

Production-ready browser automation API powered by Playwright Chromium. Provides REST APIs and WebSocket CDP proxy for screenshots, PDF generation, content extraction, and web scraping.

GitHub


โ Quick Start

docker run -d \
  --name chromium \
  -p 3001:3001 \
  -e JWT_SECRET=your-secret-key \
  --shm-size=2gb \
  --memory=4g \
  browserautos/chromium:latest

# Test it
curl http://localhost:3001/health

โ Features

  • ๐Ÿ“ธ Screenshot API - PNG, JPEG, WebP formats
  • ๐Ÿ“„ PDF Generation - Custom page sizes and styling
  • ๐Ÿ” Content Extraction - HTML, text, and metadata
  • ๐Ÿ•ท๏ธ Web Scraping - CSS selector-based
  • ๐Ÿ”Œ WebSocket CDP - Direct Puppeteer/Playwright integration
  • โšก Browser Pool - 85% faster with automatic reuse
  • ๐Ÿ”’ Authentication - JWT tokens and API keys
  • ๐Ÿ“Š Monitoring - Prometheus metrics built-in

โ REST API Examples

โ Screenshot
curl -X POST http://localhost:3001/screenshot \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "fullPage": true}' \
  -o screenshot.png
โ PDF Generation
curl -X POST http://localhost:3001/pdf \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "format": "A4"}' \
  -o document.pdf
โ Web Scraping
curl -X POST http://localhost:3001/scrape \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "elements": [
      {"selector": "h1", "property": "textContent"},
      {"selector": ".price", "property": "textContent"}
    ]
  }'
โ Content Extraction
curl -X POST http://localhost:3001/content \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "includeMetadata": true}'

โ Integration

โ Puppeteer
const puppeteer = require('puppeteer-core');

const browser = await puppeteer.connect({
  browserWSEndpoint: 'ws://localhost:3001/ws'
});

const page = await browser.newPage();
await page.goto('https://example.com');
await browser.close();
โ Playwright
const { chromium } = require('playwright');

const browser = await chromium.connect({
  wsEndpoint: 'ws://localhost:3001/ws'
});

const page = await browser.newPage();
await page.goto('https://example.com');
await browser.close();

โ Authentication

Default Users:

  • Admin: admin / admin123
  • API User: api-user / apiuser123

Get Access Token:

curl -X POST http://localhost:3001/auth/login \
  -H "Content-Type: application/json" \
  -d '{"username": "admin", "password": "admin123"}'

Use Token:

# With JWT
curl -H "Authorization: Bearer YOUR_TOKEN" http://localhost:3001/screenshot

# With API Key
curl -H "X-API-Key: YOUR_KEY" http://localhost:3001/screenshot

โ Docker Compose

version: '3.8'

services:
  chromium:
    image: browserautos/chromium:latest
    ports:
      - "3001:3001"
    environment:
      - JWT_SECRET=your-secret-key
      - ENABLE_QUEUE=false
    shm_size: '2gb'
    mem_limit: 4g
    restart: unless-stopped

  redis:
    image: redis:7-alpine
    volumes:
      - redis-data:/data

volumes:
  redis-data:

โ Configuration

Required Environment Variables:

JWT_SECRET=your-secret-key    # Required for authentication

Optional Settings:

# Queue System
ENABLE_QUEUE=false
REDIS_URL=redis://redis:6379

# Browser Pool
BROWSER_POOL_MIN=2
BROWSER_POOL_MAX=10

# Logging
LOG_LEVEL=info

Resource Requirements:

MinimumRecommended
Memory2GB4GB
CPU1 core2 cores
Shared Memory2GB (required)2GB

Important: Always set --shm-size=2gb for Chromium stability


โ Available Versions

browser.autos provides multiple tags for different use cases:

TagBase ImageSizeUse Case
latestDebian Bookworm~1.4GBRecommended for production
1.0.0Debian Bookworm~1.4GBVersion locked
debianDebian Bookworm~1.4GBStable baseline
alpineAlpine Linux~800MBLightweight (coming soon)

Multi-Architecture:

  • โœ… linux/amd64 - Intel/AMD
  • โœ… linux/arm64 - Apple Silicon, AWS Graviton, Azure ARM
# Pull specific version
docker pull browserautos/chromium:latest
docker pull browserautos/chromium:1.0.0
docker pull browserautos/chromium:debian

โ API Endpoints

EndpointMethodDescription
/healthGETHealth check and system info
/screenshotPOSTGenerate screenshot
/pdfPOSTGenerate PDF
/contentPOSTExtract page content
/scrapePOSTScrape data with selectors
/wsWebSocketCDP protocol proxy
/metricsGETPrometheus metrics
/docsGETInteractive API documentation

โ Performance

Tested on 4 vCPU, 8GB RAM

OperationCold StartWith PoolImprovement
Screenshot7.6s1.2s85% faster
PDF8.0s2.0s75% faster
Content4.5s1.5s67% faster

โ Use Cases

browser.autos powers diverse automation workflows:

  • ๐Ÿงช CI/CD Testing - Visual regression testing
  • ๐Ÿ“ Report Generation - HTML to PDF at scale
  • ๐Ÿ‘€ Web Monitoring - Content change tracking
  • ๐Ÿ“Š Data Collection - Efficient web scraping
  • โœ… E2E Testing - Full browser automation
  • ๐Ÿ–ผ๏ธ Thumbnails - Batch screenshot generation
  • ๐Ÿ” SEO Audits - Page analysis and crawling

โ Troubleshooting

Chromium won't start:

# Ensure shared memory is set
docker run --shm-size=2gb browserautos/chromium:latest

Out of memory:

# Increase memory limit
docker run --memory=4g browserautos/chromium:latest

Check logs:

docker logs chromium
docker logs -f chromium  # Follow mode

Authentication errors:

# Disable auth for testing (not recommended for production)
docker run -e REQUIRE_AUTH=false browserautos/chromium:latest

โ Tech Stack

  • Runtime: Node.js 20 + TypeScript
  • Framework: Fastify
  • Browser: Playwright Chromium 141.0.7390.37
  • Queue: Bull + Redis (optional)
  • Monitoring: Prometheus
  • Base: Debian Bookworm Slim

โ Security

  • Non-root execution (UID 1001)
  • JWT + API Key authentication
  • Rate limiting
  • CORS protection
  • Resource limits
  • Regular security updates

โ Updates & Versioning

browser.autos follows semantic versioning:

  • Chromium: Updated every 1-2 weeks via Playwright
  • Security: Critical patches within 48 hours
  • Versions: All releases tagged (1.0.0, 1.1.0, etc.)
  • Latest: Always points to newest stable

Check version:

docker run --rm browserautos/chromium:latest \
  node -e "console.log(require('./package.json').version)"


โ About browser.autos

browser.autos is an open-source browser automation platform for developers, testers, and businesses.

Why browser.autos?

  • ๐ŸŽฏ Production-ready and battle-tested
  • ๐Ÿš€ High performance with browser pooling
  • ๐Ÿ”’ Secure by default
  • ๐Ÿ“Š Observable with Prometheus
  • ๐ŸŒ Multi-platform support
  • ๐Ÿ“ฆ Easy deployment

Maintained by the browser.autos Team

Image: browserautos/chromium (stable, unchanged) Version: 1.0.0 Chromium: 141.0.7390.37 (Playwright) Updated: 2025-10-11

โญ Star us on GitHubโ !


MIT License - Free for commercial use

Tag summary

Content type

Image

Digest

sha256:a138b5479โ€ฆ

Size

478.7 MB

Last updated

11 months ago

docker pull browserautos/chromium