惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
大猫的无限游戏
大猫的无限游戏
J
Java Code Geeks
MongoDB | Blog
MongoDB | Blog
Martin Fowler
Martin Fowler
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
F
Fortinet All Blogs
B
Blog
U
Unit 42
B
Blog RSS Feed
D
DataBreaches.Net
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
腾讯CDC
量子位
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Visual Studio Blog
博客园 - 聂微东
MyScale Blog
MyScale Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 三生石上(FineUI控件)
Engineering at Meta
Engineering at Meta

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
code-shot: the code-screenshot API that I wish existed
basenull · 2026-04-28 · via DEV Community

basenull

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.

If I'm writing a dev journal post with five code blocks, the workflow is:

  1. Open Carbon, paste snippet 1, screenshot, save with sensible name, upload, embed
  2. Repeat for snippets 2-5
  3. Realize the OG image on Twitter is still stock

That's 45 minutes for what should be one HTML tag.

So I built code-shot.

How it works

One GET endpoint. Code in the query string, image/png in the response.

<img src="https://code-shot.labs.basenull.com/api/img?code=const%20x%20%3D%201&theme=dracula" />

Enter fullscreen mode Exit fullscreen mode

Drop the URL into <img>, OG meta, Markdown — same URL renders inline anywhere images do. Cached forever at the Vercel CDN.

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

CLI

If you'd rather pipe than encode:

# Download (no npm needed — single Node.js file, ~12 KB)
curl -o code-shot https://code-shot.labs.basenull.com/code-shot
chmod +x code-shot
mv code-shot ~/.local/bin/

# Render
echo "const x = 1" | code-shot --theme dracula
# → https://code-shot.labs.basenull.com/api/img?id=abc123

Enter fullscreen mode Exit fullscreen mode

code-shot login opens a browser for one-click pairing. After that, snippets you create are attributed to your account.

What's behind it

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

Live: https://code-shot.labs.basenull.com