<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Namor Nimash</title>
    <description>The latest articles on DEV Community by Namor Nimash (@namornimash).</description>
    <link>https://dev.to/namornimash</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3915298%2F3dce3de8-bdc1-468f-a825-7a7de3a0270a.jpg</url>
      <title>DEV Community: Namor Nimash</title>
      <link>https://dev.to/namornimash</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/namornimash"/>
    <language>en</language>
    <item>
      <title>How I Built a Screenshot API That Doesn't Suck</title>
      <dc:creator>Namor Nimash</dc:creator>
      <pubDate>Wed, 06 May 2026 18:37:35 +0000</pubDate>
      <link>https://dev.to/namornimash/how-i-built-a-screenshot-api-that-doesnt-suck-7a2</link>
      <guid>https://dev.to/namornimash/how-i-built-a-screenshot-api-that-doesnt-suck-7a2</guid>
      <description>&lt;h1&gt;
  
  
  How I Built a Screenshot API That Developers Can Actually Trust
&lt;/h1&gt;

&lt;p&gt;After spending too many nights babysitting headless Chrome, I stopped trying to make a fragile stack behave and started building something simpler.&lt;/p&gt;

&lt;p&gt;This is the story of &lt;strong&gt;SnapForge&lt;/strong&gt; — a screenshot &amp;amp; PDF API for developers who want reliable rendering without turning browser orchestration into a second job.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Every time I tried to build screenshot infrastructure myself, I ran into the same set of problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Too much browser baggage&lt;/strong&gt; — heavyweight installs, messy dependencies, and too many moving parts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Random rendering failures&lt;/strong&gt; — timeouts, stuck processes, and pages that worked fine until they suddenly didn’t.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Operational overhead&lt;/strong&gt; — instead of shipping product features, I was debugging browser lifecycle issues.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hosted tools that felt expensive too early&lt;/strong&gt; — fine at low volume, but hard to justify once usage starts growing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I didn’t want a giant DIY browser farm, and I didn’t want to be locked into a black-box service either.&lt;/p&gt;

&lt;p&gt;I wanted something in the middle: predictable, self-hostable, and simple enough that a small team could actually run it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Approach
&lt;/h2&gt;

&lt;p&gt;SnapForge is built around a few decisions that trade a bit of theoretical efficiency for a lot more predictability:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Fresh browser context per job&lt;/strong&gt; — each render starts clean, which makes failures easier to isolate and avoids the “what state is Chrome in now?” problem.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Async-first workflow&lt;/strong&gt; — you submit a job, get an ID back immediately, and handle completion through polling or a webhook.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker-first deployment&lt;/strong&gt; — if you want to self-host it, getting started should feel like launching an app, not assembling a browser lab.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That design is not the most clever possible version of a rendering API.&lt;/p&gt;

&lt;p&gt;It is the version I would actually trust to run in production.&lt;/p&gt;

&lt;h2&gt;
  
  
  Architecture
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌─────────────┐     ┌──────────────┐     ┌─────────────┐
│   Client    │───&amp;gt; │  FastAPI     │────&amp;gt;│  Playwright │
│  (curl, JS) │     │  + Queueing  │     │   Chromium  │
└─────────────┘     └──────────────┘     └─────────────┘
                           ↓
                    ┌──────────────┐
                    │   Webhook    │
                    │   Callback   │
                    └──────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;FastAPI&lt;/strong&gt; handles the API layer and request lifecycle.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Concurrency limits&lt;/strong&gt; keep the service from overcommitting CPU and memory under load.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Background processing&lt;/strong&gt; lets jobs finish outside the request/response path.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Playwright&lt;/strong&gt; launches a fresh browser context, renders the page, saves the result, and exits cleanly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are faster ways to squeeze more throughput out of browser automation.&lt;/p&gt;

&lt;p&gt;This setup is optimized less for benchmark screenshots and more for sane operations.&lt;/p&gt;

&lt;h2&gt;
  
  
  The API (Live Demo)
&lt;/h2&gt;

&lt;p&gt;The public demo API below is rate-limited to 5 requests per day per IP.&lt;/p&gt;

&lt;p&gt;It runs on a temporary public demo endpoint, so the URL may change over time.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Submit a screenshot job
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST https://ministers-just-levy-groups.trycloudflare.com/screenshot &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"url": "https://example.com", "format": "png", "full_page": true}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Response:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"750d77e5-e4e6-4a3b-a36f-570a7d323e96"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"pending"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"screenshot"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://example.com/"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Check job status
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl https://ministers-just-levy-groups.trycloudflare.com/jobs/750d77e5-e4e6-4a3b-a36f-570a7d323e96
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the job is done:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"done"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"result_url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/files/750d77e5-e4e6-4a3b-a36f-570a7d323e96.png"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Download the file
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-o&lt;/span&gt; screenshot.png &lt;span class="se"&gt;\&lt;/span&gt;
  https://ministers-just-levy-groups.trycloudflare.com/files/750d77e5-e4e6-4a3b-a36f-570a7d323e96.png
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Generate a PDF
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST https://ministers-just-levy-groups.trycloudflare.com/pdf &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"url": "https://example.com"}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The API is intentionally boring in a good way: submit a job, track it, download the result, move on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Self-Hosting in 30 Seconds
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/NamorNimash/snapforge-api.git
&lt;span class="nb"&gt;cd &lt;/span&gt;snapforge-api
docker compose up &lt;span class="nt"&gt;-d&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s it.&lt;/p&gt;

&lt;p&gt;You get a local API on &lt;code&gt;http://localhost:8000&lt;/code&gt;, predictable deployment, and no extra ceremony just to make a browser render a page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pricing
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Plan&lt;/th&gt;
&lt;th&gt;Price&lt;/th&gt;
&lt;th&gt;Screenshots&lt;/th&gt;
&lt;th&gt;PDFs&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Open Source&lt;/td&gt;
&lt;td&gt;Free&lt;/td&gt;
&lt;td&gt;Unlimited (self-hosted)&lt;/td&gt;
&lt;td&gt;Unlimited&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cloud Early Bird&lt;/td&gt;
&lt;td&gt;$20/mo&lt;/td&gt;
&lt;td&gt;10,000&lt;/td&gt;
&lt;td&gt;5,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Scale&lt;/td&gt;
&lt;td&gt;$100/mo&lt;/td&gt;
&lt;td&gt;100,000&lt;/td&gt;
&lt;td&gt;50,000&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The open-source version stays free for teams that want full control.&lt;/p&gt;

&lt;p&gt;The hosted plans are for people who want the API without thinking about browser workers, queue limits, uptime, or cleanup jobs.&lt;/p&gt;

&lt;h2&gt;
  
  
  What’s Next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Batch jobs for large screenshot runs&lt;/li&gt;
&lt;li&gt;Better PDF layout controls&lt;/li&gt;
&lt;li&gt;SDKs for Python, JavaScript, and Go&lt;/li&gt;
&lt;li&gt;CI-friendly integrations for automated captures&lt;/li&gt;
&lt;li&gt;More rendering options for authenticated and dynamic pages&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The scope is staying narrow on purpose.&lt;/p&gt;

&lt;p&gt;It makes more sense to make screenshot and PDF generation dependable first, then expand from there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Landing page:&lt;/strong&gt; &lt;a href="https://namornimash.github.io/snapforge-landing/" rel="noopener noreferrer"&gt;SnapForge landing page&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live API demo:&lt;/strong&gt; &lt;a href="https://ministers-just-levy-groups.trycloudflare.com" rel="noopener noreferrer"&gt;Temporary public demo endpoint&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/NamorNimash/snapforge-api" rel="noopener noreferrer"&gt;snapforge-api&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Built by a developer who got tired of fighting browser processes and just wanted screenshots to work.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>playwright</category>
      <category>api</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
