# makinacorpus/screamshotter architecture

> Architecture diagram of the GitHub repository makinacorpus/screamshotter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/makinacorpus/screamshotter
- Repository: https://github.com/makinacorpus/screamshotter

## Overview

Screamshotter is a Django microservice that accepts a webpage URL and screenshot options, validates them, invokes a Node/Puppeteer capture, and returns PNG or base64 JSON. Its API also supports the browsable interface; deployment settings enable optional Sentry reporting and an external Puppeteer endpoint. The sampled Python code shows API dispatch and capture invocation; browser internals are represented by the JavaScript entry point, but its implementation was not excerpted.

Main entry points: [`src/screenshotter/views.py`](https://github.com/makinacorpus/screamshotter/blob/master/src/screenshotter/views.py) (Screenshot Endpoint), [`src/screenshotter/puppeteer.py`](https://github.com/makinacorpus/screamshotter/blob/master/src/screenshotter/puppeteer.py) (Capture Runner), [`src/screenshotter/js/index.js`](https://github.com/makinacorpus/screamshotter/blob/master/src/screenshotter/js/index.js) (Puppeteer Script), [`src/screenshotter/urls.py`](https://github.com/makinacorpus/screamshotter/blob/master/src/screenshotter/urls.py) (API Routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_routing["API Routing<br/>[urls.py]"]
  node_endpoint["Screenshot Endpoint<br/>[views.py]"]
  node_validation["Request Validation<br/>[serializer.py]"]
  node_response["Response Renderers<br/>[renderers.py]"]
end

subgraph group_capture["Screenshot Capture"]
  node_capture_engine["Capture Runner<br/>[puppeteer.py]"]
  node_browser_script["Puppeteer Script<br/>[index.js]"]
end

subgraph group_config["Configuration"]
  node_app_settings["Capture Settings<br/>[settings.py]"]
  node_django_settings["Service Settings<br/>[__init__.py]"]
end

subgraph group_integrations["External Services"]
  node_sentry["Sentry"]
  node_external_browser["External Puppeteer"]
end

node_client(("API Client"))
node_webpage(("Target Webpage"))

node_client -->|"sends request"| node_routing
node_routing -->|"routes to"| node_endpoint
node_endpoint -->|"validates with"| node_validation
node_endpoint -->|"invokes capture"| node_capture_engine
node_endpoint -->|"selects renderer"| node_response
node_capture_engine -->|"reads settings"| node_app_settings
node_capture_engine -->|"runs script"| node_browser_script
node_browser_script -.->|"captures page"| node_webpage
node_browser_script -.->|"may connect"| node_external_browser
node_capture_engine -->|"reads service settings"| node_django_settings
node_django_settings -->|"initializes reporting"| node_sentry

click node_routing "https://github.com/makinacorpus/screamshotter/blob/master/src/screenshotter/urls.py"
click node_endpoint "https://github.com/makinacorpus/screamshotter/blob/master/src/screenshotter/views.py"
click node_validation "https://github.com/makinacorpus/screamshotter/blob/master/src/screenshotter/serializer.py"
click node_response "https://github.com/makinacorpus/screamshotter/blob/master/src/screenshotter/renderers.py"
click node_capture_engine "https://github.com/makinacorpus/screamshotter/blob/master/src/screenshotter/puppeteer.py"
click node_browser_script "https://github.com/makinacorpus/screamshotter/blob/master/src/screenshotter/js/index.js"
click node_app_settings "https://github.com/makinacorpus/screamshotter/blob/master/src/screenshotter/settings.py"
click node_django_settings "https://github.com/makinacorpus/screamshotter/blob/master/src/screamshotter/settings/__init__.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_routing,node_endpoint,node_validation,node_response,node_client toneBlue
class node_capture_engine,node_browser_script toneAmber
class node_app_settings,node_django_settings toneMint
class node_sentry,node_external_browser toneRose
class node_webpage toneIndigo
```

## Components

### HTTP API

- [API Routing](https://github.com/makinacorpus/screamshotter/blob/master/src/screenshotter/urls.py): `src/screenshotter/urls.py`
- [Screenshot Endpoint](https://github.com/makinacorpus/screamshotter/blob/master/src/screenshotter/views.py): `src/screenshotter/views.py`
- [Request Validation](https://github.com/makinacorpus/screamshotter/blob/master/src/screenshotter/serializer.py): `src/screenshotter/serializer.py`
- [Response Renderers](https://github.com/makinacorpus/screamshotter/blob/master/src/screenshotter/renderers.py): `src/screenshotter/renderers.py`

### Screenshot Capture

- [Capture Runner](https://github.com/makinacorpus/screamshotter/blob/master/src/screenshotter/puppeteer.py): `src/screenshotter/puppeteer.py`
- [Puppeteer Script](https://github.com/makinacorpus/screamshotter/blob/master/src/screenshotter/js/index.js): `src/screenshotter/js/index.js`

### Configuration

- [Capture Settings](https://github.com/makinacorpus/screamshotter/blob/master/src/screenshotter/settings.py): `src/screenshotter/settings.py`
- [Service Settings](https://github.com/makinacorpus/screamshotter/blob/master/src/screamshotter/settings/__init__.py): `src/screamshotter/settings/__init__.py`

### External Services

- **Sentry**
- **External Puppeteer**

### Other components

- **API Client**
- **Target Webpage**

## Connections

- API Client → API Routing: sends request (evidence: `README.md`)
- API Routing → Screenshot Endpoint: routes to (evidence: `src/screenshotter/urls.py`)
- Screenshot Endpoint → Request Validation: validates with (evidence: `src/screenshotter/views.py`)
- Screenshot Endpoint → Capture Runner: invokes capture (evidence: `src/screenshotter/views.py`)
- Screenshot Endpoint → Response Renderers: selects renderer (evidence: `src/screenshotter/views.py`)
- Capture Runner → Capture Settings: reads settings (evidence: `src/screenshotter/puppeteer.py`)
- Capture Runner → Puppeteer Script: runs script (evidence: `src/screenshotter/puppeteer.py`)
- Puppeteer Script → Target Webpage: captures page
- Puppeteer Script → External Puppeteer: may connect (evidence: `README.md`)
- Capture Runner → Service Settings: reads service settings (evidence: `src/screenshotter/puppeteer.py`)
- Service Settings → Sentry: initializes reporting (evidence: `src/screamshotter/settings/__init__.py`)
