DEV Community

Custodia-Admin
Custodia-Admin

Posted on • Originally published at pagebolt.dev

How to Generate Screenshots at Scale with a REST API (No Puppeteer)

How to Generate Screenshots at Scale with a REST API (No Puppeteer)

You've managed Puppeteer in production. You know the pain: 300MB+ Chrome per instance, memory leaks after ~1000 page loads, 5–10 second startup per page, and a dedicated DevOps person babysitting zombie processes at 3 AM.

By the time you realize "this is now my job," you've spent 2 months on infrastructure instead of features.

There's a simpler way. A REST API that generates screenshots — no Chrome to manage, no memory leaks, no version conflicts. One endpoint, one API key.

The Problem with Self-Hosted Screenshots

Puppeteer (or Playwright) in production:

  • 300MB Docker image per instance (10 concurrent = 3GB+ RAM)
  • 5–10 second startup per page (AWS CloudWatch data: average 7.3s for fresh launch)
  • Memory leaks after ~1000 page loads (Puppeteer GitHub issues)
  • Infrastructure costs: $150–400/month per instance
  • Version conflicts with Node.js
  • On-call incidents when Chrome crashes

At scale (1,000 screenshots/day):

  • Self-hosted: $400/month infrastructure + $4K/month engineering time = $4,400/month
  • REST API: $99/month

The math is brutal. You're paying for DevOps time that could go to features.

The REST API Solution

One endpoint. Two lines of code.

Curl (command line):

curl -X POST https://api.pagebolt.dev/v1/screenshot \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "options": {
      "format": "png",
      "width": 1280,
      "height": 720,
      "full_page": false
    }
  }' \
  -o screenshot.png
Enter fullscreen mode Exit fullscreen mode

Done. No browser startup. No memory management. PNG in your hand.

Node.js (fetch):

const res = await fetch('https://api.pagebolt.dev/v1/screenshot', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.PAGEBOLT_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    url: 'https://example.com',
    options: {
      format: 'png',
      width: 1280,
      height: 720,
      full_page: true
    }
  })
});

const buffer = await res.arrayBuffer();
fs.writeFileSync('screenshot.png', Buffer.from(buffer));
Enter fullscreen mode Exit fullscreen mode

That's it. No Puppeteer imports. No browser process management. No zombie processes.

Real-World Example: Bulk Screenshot Pipeline

Monitor 100 competitor pages daily. Store screenshots in S3. Compare for layout changes.

import fs from 'fs';
import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';

const s3 = new S3Client({});
const apiKey = process.env.PAGEBOLT_KEY;

const competitors = [
  'https://competitor-1.com',
  'https://competitor-2.com',
  // ... 98 more
];

async function captureDaily() {
  for (const url of competitors) {
    const res = await fetch('https://api.pagebolt.dev/v1/screenshot', {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        url,
        options: { format: 'png', width: 1280, height: 720 }
      })
    });

    const buffer = await res.arrayBuffer();
    const timestamp = new Date().toISOString();
    const key = `screenshots/${new URL(url).hostname}/${timestamp}.png`;

    await s3.send(new PutObjectCommand({
      Bucket: 'competitor-screenshots',
      Key: key,
      Body: new Uint8Array(buffer),
      ContentType: 'image/png'
    }));
  }

  console.log(`✅ Captured ${competitors.length} screenshots`);
}

captureDaily();
Enter fullscreen mode Exit fullscreen mode

Run this on a 5-minute cron. No infrastructure overhead. No memory management. Flat cost.

Why This Wins

Factor Puppeteer REST API
Startup time per image 5–10 seconds <1 second (API call)
Memory per concurrent 300MB <1KB
Infrastructure $150–400/month Included in plan
Engineering overhead 20–40 hrs/month Zero
Version conflicts Yes No
Maintenance Ongoing None

At 100 screenshots/day, REST API is 10–40x cheaper once you factor in engineering time.

Pricing

  • Free tier: 100 screenshots/month, no credit card required
  • Starter: $29/month → 10,000/month
  • Scale: $99/month → 100,000/month

Start with 100 free screenshots. No commitment. Add a credit card only when you need more.

Getting Started

  1. Sign up: pagebolt.dev/pricing
  2. Get API key (60 seconds)
  3. Run the curl example above
  4. Integrate into your Node.js app: copy the fetch code
  5. Deploy and forget

No Docker. No Chrome. No Puppeteer. Just REST.

Try it free: 100 screenshots/month, no credit card.


Next: Read the full API docs at pagebolt.dev/docs for all options (device presets, ad blocking, cookie removal, full-page capture).

Top comments (0)