A high-performance Open Graph image generator built with Cloudflare Workers, Hono, and Vercel OG. Generate beautiful social media cards dynamically with support for multiple font loading strategies and visual styles.
- 🚀 Built on Cloudflare Workers for edge computing
- ⚡ Multiple pre-designed card styles
- 🎨 Flexible font loading strategies
- 🔄 Built-in caching support
- 📱 Responsive designs
- 🎯 Tailwind CSS styling
# Install dependencies
bun install
# Run development server
bun run dev
# Deploy to Cloudflare Workers
bun run deploy
Generate OG images by making GET requests with query parameters:
/og?mainText=Your Title&description=Your Description&footerText=Footer Text&style=1
mainText
: Main heading textdescription
: Detailed descriptionfooterText
: Footer contentstyle
: Visual style (1-4)
The project supports multiple font loading methods:
const font = await googleFont(text, 'Noto Sans JP', 900, 'normal');
const font = await githubFonts();
const font = await directFont('https://example.com/fonts/CustomFont.ttf', 'CustomFont', 400, 'normal');
const font = await getLocalFonts(c, [
{ path: 'Poppins-Regular.ttf', weight: 400 },
{ path: 'Poppins-Bold.ttf', weight: 700 },
]);
The generator includes 4 pre-designed styles:
- Style 1: Modern gradient with glass effect (Blue theme)
- Style 2: Eco/Green technology theme
- Style 3: Cloudflare-inspired design with logo
- Style 4: GitHub profile card style
The project includes built-in caching support for both fonts and generated images. Enable caching by uncommenting the cache middleware in index.ts
.
- Cloudflare Workers
- Hono Framework
- Vercel OG
- TypeScript
- Tailwind CSS
MIT
For more examples and detailed documentation, visit the GitHub repository.