Rust developer builds social preview cards without headless Chrome using resvg
A developer building Cloud Cost Analyzer (CCA) needed shareable links to unfurl into rich social cards on Slack, LinkedIn, and X, but the app is a client-side single-page app that social crawlers cannot parse. To solve the crawler problem, a CloudFront function detects bot user-agents and redirects them to a lightweight server-rendered page carrying Open Graph meta tags, while human visitors continue to receive the full interactive dashboard. For the card image itself, the developer chose to avoid headless Chrome due to its memory, cold-start, and maintenance overhead in a Rust backend. Instead, cards are generated by building an SVG string and rasterizing it in-process using the pure-Rust libraries resvg and tiny-skia. Fonts are compiled directly into the binary via include_bytes!, ensuring consistent rendering across local and containerized environments without any external font dependencies.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in