<?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: basenull</title>
    <description>The latest articles on DEV Community by basenull (@basenull).</description>
    <link>https://dev.to/basenull</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%2F3901216%2F9af55e45-fb4a-4d82-85b4-cc9516ac3a93.png</url>
      <title>DEV Community: basenull</title>
      <link>https://dev.to/basenull</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/basenull"/>
    <language>en</language>
    <item>
      <title>code-shot: the code-screenshot API that I wish existed</title>
      <dc:creator>basenull</dc:creator>
      <pubDate>Mon, 27 Apr 2026 21:05:01 +0000</pubDate>
      <link>https://dev.to/basenull/i-built-the-hosted-code-screenshot-api-that-i-wish-existed-37ln</link>
      <guid>https://dev.to/basenull/i-built-the-hosted-code-screenshot-api-that-i-wish-existed-37ln</guid>
      <description>&lt;p&gt;For seven years Carbon has been the canonical "make a code screenshot" tool. Same with Ray.so since 2020. Both are fantastic — and both are design surfaces, not endpoints.&lt;/p&gt;

&lt;p&gt;If I'm writing a dev journal post with five code blocks, the workflow is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open Carbon, paste snippet 1, screenshot, save with sensible name, upload, embed&lt;/li&gt;
&lt;li&gt;Repeat for snippets 2-5&lt;/li&gt;
&lt;li&gt;Realize the OG image on Twitter is still stock&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's 45 minutes for what should be one HTML tag.&lt;/p&gt;

&lt;p&gt;So I built &lt;strong&gt;&lt;a href="https://code-shot.labs.basenull.com" rel="noopener noreferrer"&gt;code-shot&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;One GET endpoint. Code in the query string, image/png in the response.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://code-shot.labs.basenull.com/api/img?code=const%20x%20%3D%201&amp;amp;theme=dracula"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Drop the URL into &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt;, OG meta, Markdown — same URL renders inline anywhere images do. Cached forever at the Vercel CDN.&lt;/p&gt;

&lt;p&gt;For longer snippets (over ~1500 chars URL-encoded), POST to /api/snippets and use the returned ?id= URL.&lt;/p&gt;

&lt;h2&gt;
  
  
  CLI
&lt;/h2&gt;

&lt;p&gt;If you'd rather pipe than encode:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Download (no npm needed — single Node.js file, ~12 KB)&lt;/span&gt;
curl &lt;span class="nt"&gt;-o&lt;/span&gt; code-shot https://code-shot.labs.basenull.com/code-shot
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x code-shot
&lt;span class="nb"&gt;mv &lt;/span&gt;code-shot ~/.local/bin/

&lt;span class="c"&gt;# Render&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"const x = 1"&lt;/span&gt; | code-shot &lt;span class="nt"&gt;--theme&lt;/span&gt; dracula
&lt;span class="c"&gt;# → https://code-shot.labs.basenull.com/api/img?id=abc123&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;code-shot login&lt;/code&gt; opens a browser for one-click pairing. After that, snippets you create are attributed to your account.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's behind it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Shiki for syntax highlighting (themes inline)&lt;/li&gt;
&lt;li&gt;Satori for layout (HTML/JSX → SVG)&lt;/li&gt;
&lt;li&gt;@resvg/resvg-js for SVG → PNG&lt;/li&gt;
&lt;li&gt;Magic-link auth, Stripe Checkout for Pro&lt;/li&gt;
&lt;li&gt;Turso (libSQL) for snippet metadata; Vercel CDN handles the render cache&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Live: &lt;a href="https://code-shot.labs.basenull.com" rel="noopener noreferrer"&gt;https://code-shot.labs.basenull.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>api</category>
      <category>productivity</category>
      <category>showdev</category>
      <category>tooling</category>
    </item>
  </channel>
</rss>
