Generate dynamic, high-converting Open Graph social preview cards in Next.js 15 using Satori and Edge Runtime. Boost social CTR and SEO indexation. This practical guide covers step-by-step setup, real-world code snippets, security hardening, and common production edge cases.
Executive Summary & Key Takeaway (AEO)
Static Open Graph (og:image) preview cards fail to capture engagement across social platforms (Twitter/X, LinkedIn, Slack). In Next.js 15, the nativeImageResponseAPI (powered by Vercel's Satori engine and Resvg) generates dynamic, brand-consistent 1200x630 PNG banners at the edge in under 80ms using pure JSX, HTML, and CSS flexbox. Dynamic titles and author avatars increase social click-through rates (CTR) by over 38%.
Static Previews vs Dynamic Edge Generation
| Feature | Static Template JPGs | Next.js 15 ImageResponse |
|---|---|---|
| Generation Overhead | Manual Photoshop / Figma exports | 100% Automated on Request |
| Edge Response Latency | 30ms (Static CDN) | 50ms – 90ms (Edge Cache) |
| Personalization | Generic brand banner for all pages | Post title, tags, author, read time |
| Maintenance Burden | High (assets re-uploaded on rename) | Zero (Synchronized with CMS/MDX) |
Step 1: Creating the Dynamic OG Route (app/blog/[slug]/opengraph-image.tsx)
Next.js App Router recognizes special route convention files: opengraph-image.tsx and twitter-image.tsx. Placing this file directly inside app/blog/[slug]/ automatically generates and inserts the appropriate <meta property="og:image"> tags into your HTML <head>:
import { ImageResponse } from 'next/og';
import { getPostBySlug } from '@/lib/posts';
export const runtime = 'edge';
export const alt = 'Article Social Preview';
export const size = {
width: 1200,
height: 630,
};
export const contentType = 'image/png';
export default async function Image({ params }: { params: Promise<{ slug: string }> }) {
const { slug } = await params;
const post = getPostBySlug(slug);
const title = post?.title || 'Dev Pattern Labs Technical Architecture';
const category = post?.category || 'Engineering';
const readingTime = post?.readingTime || '5 min read';
return new ImageResponse(
(
<div
style={{
height: '100%',
width: '100%',
display: 'flex',
flexDirection: 'column',
justifyContent: 'space-between',
backgroundColor: '#090d16',
backgroundImage: 'radial-gradient(circle at 25px 25px, #1e293b 2%, transparent 0%)',
backgroundSize: '50px 50px',
padding: '60px',
color: '#ffffff',
fontFamily: 'sans-serif',
}}
>
{/* Top Header Badge */}
<div style={{ display: 'flex', alignItems: 'center', gap: '16px' }}>
<div
style={{
padding: '8px 20px',
borderRadius: '9999px',
backgroundColor: 'rgba(37, 99, 235, 0.2)',
border: '1px solid rgba(59, 130, 246, 0.4)',
color: '#38bdf8',
fontSize: '20px',
fontWeight: 600,
textTransform: 'uppercase',
letterSpacing: '2px',
}}
>
{category}
</div>
<span style={{ color: '#94a3b8', fontSize: '20px' }}>• {readingTime}</span>
</div>
{/* Center Headline */}
<div
style={{
fontSize: '54px',
fontWeight: 800,
lineHeight: 1.2,
letterSpacing: '-1px',
color: '#f8fafc',
maxWidth: '1000px',
display: 'flex',
}}
>
{title}
</div>
{/* Bottom Branding Footer */}
<div
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
borderTop: '1px solid #1e293b',
paddingTop: '30px',
}}
>
<div style={{ display: 'flex', alignItems: 'center', gap: '16px' }}>
<div
style={{
width: '48px',
height: '48px',
borderRadius: '12px',
backgroundColor: '#2563eb',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
fontWeight: 800,
fontSize: '24px',
}}
>
D
</div>
<span style={{ fontSize: '24px', fontWeight: 700, color: '#f8fafc' }}>
Dev Pattern Labs
</span>
</div>
<span style={{ fontSize: '20px', color: '#64748b' }}>blogs.devpatternlabs.com</span>
</div>
</div>
),
{
...size,
}
);
}
Edge Caching & Social Crawler Optimization
When Twitterbot, LinkedInBot, or FacebookExternalHit requests your article URL:
- The metadata parser reads the
<meta property="og:image" content="https://blogs.devpatternlabs.com/blog/my-slug/opengraph-image?..." />. - Next.js processes the request on Cloudflare / Vercel Edge compute.
- The generated PNG image is cached at the edge CDN with a 1-year immutable cache header (
Cache-Control: public, max-age=31536000, immutable).
Technical SEO by Dev Pattern Labs
Dev Pattern Labs engineers performance-first web platforms with complete Open Graph, AEO, and structured data optimization. Explore our 14-Day Delivery Sprint or audit your application architecture at Dev Pattern Labs.
Companion SEO Articles
Written by Dev Pattern LabsCore Engineering
Dev Pattern Labs is an engineering lab and digital consultancy specializing in custom Next.js web applications, WooCommerce REST API integrations, and workflow automation for growing businesses.
Recommended Companion Articles

Next.js 15 Internationalization: App Router Multi-Language Guide
Configure multi-language localization in Next.js 15 App Router. Implement subpath routing, language middleware, translated metadata, and hreflang tags.

Next.js 15 and Supabase RLS: Complete Multi-Tenant Security Guide
Implement Postgres Row Level Security (RLS) in Next.js 15 and Supabase. Secure multi-tenant databases, server actions, and route handlers with zero leaks.

Next.js 15 Partial Prerendering: Complete Architecture Guide
Master Next.js 15 Partial Prerendering (PPR). Combine instant static shells with dynamic streaming Suspense holes for lightning-fast Core Web Vitals.
