Skip to main content

Building a Screenshot Worker with Andera and Playwright

Andera

Introduction

Taking website screenshots at scale is a common need for monitoring, reporting, or automation. But orchestrating browser instances, managing concurrency, and ensuring reliability can quickly become complex. This article shows how Andera and Playwright make it simple and robust, using the Screenshot Worker as a real-world example.

📚 New to Andera? See the Base Worker Introduction to understand the core concepts and architecture.

Why Andera?

Andera is a Task Orchestration Platform (TOP) designed for performance, simplicity, and flexibility. It is technology-agnostic, supports both standalone and clustered deployments, and provides:

  • Native slot management for parallelism
  • Built-in maintenance mode for safe updates
  • Secure authentication and best practices
  • Auto-discovery of functions, services, and helpers

Architecture of the Screenshot Worker

The Screenshot Worker leverages several Andera features:

  • Service: A Playwright service launches a Chromium browser and manages a pool of isolated browser contexts (slots), ready to take screenshots in parallel. (Learn more)
  • Function: A screenshot function receives a URL, picks a free context, navigates, captures the screenshot, and resets the context. (Learn more)
  • Helper: Helpers manage context allocation and release, ensuring efficient resource usage.
  • Slots: The Worker exposes a configurable number of slots (e.g., 10), each mapped to a browser context. (Usage details)