Skip to content

alx/og-renderer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

og-renderer

Serverless OG image renderer for social media link previews. Deploys as a Vercel function.

How it works

  1. Receives a ?u= query parameter with an encoded URL
  2. Launches headless Chromium via Puppeteer and navigates to the URL
  3. Waits for the #card element to appear
  4. Screenshots the element and processes it with Sharp (resized to 1200×630px JPEG)
  5. Returns the image with aggressive cache headers

API

GET /render?u=<encoded-url>

Only URLs from brainrot.girard-davila.net are allowed (SSRF protection). All other origins return 403.

Response headers:

  • Cache-Control: public, max-age=86400, stale-while-revalidate=604800

Tech stack

Local development

npm install
vercel dev
# → http://localhost:3000/render?u=<encoded-url>

Deployment

vercel deploy         # preview
vercel deploy --prod  # production

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors