When users share your mini app URL, the Base app requests your page, reads the fc:miniapp metadata, and fetches the imageUrl. You can serve either a static file (same image for everyone) or a dynamic endpoint that generates unique images on-demand based on URL parameters.
Technical Guides
Generate Dynamic Embed Images
Create viral loops by turning every user interaction into dynamic, shareable content directly in the feed.
How metadata transforms into embeds
When users share your mini app URL, the Base app requests your page, reads the fc:miniapp metadata, and fetches the imageUrl. You can serve either a static file (same image for everyone) or a dynamic endpoint that generates unique images on-demand based on URL parameters.
Embeds are the first thing users see when they encounter your mini app in their feed. Each share can display unique, contextual content tailored to drive engagement.
This guide uses Minikit but the principles apply to any framework with server-side rendering.
This guide shows how to create shareable links with dynamic embed images. Users click a share button, which opens a compose window with their personalized link. When shared, the embed displays a unique image with their username.
1
Install the required package
Install @vercel/og by running the following command inside your project directory. This isn’t required for Next.js App Router projects, as the package is already included:
Report incorrect code
Copy
Ask AI
npm install @vercel/og
2
Create the image generation API endpoint
Build an API route that generates images based on the username parameter.
This endpoint generates a unique image for each username: /api/og/alice, /api/og/bob, etc.
<div> elements must have display: "flex" or display: "none". If you see a 500 error when accessing /share/[username], check your ImageResponse JSX structure.
3
Create shareable page with dynamic metadata
Build a page route that uses the username to generate fc:miniapp metadata pointing to your image endpoint.
When you click the button, it opens the compose window with /share/alice as the embed. The embed displays the dynamic image from /api/og/alice.
5
Test the flow
Verify the complete sharing flow works.
Report incorrect code
Copy
Ask AI
# Start your appnpm run dev# Test the image endpoint directlycurl http://localhost:3000/api/og/testuser > test.pngopen test.png# Visit the share page to verify metadatacurl http://localhost:3000/share/testuser | grep "fc:miniapp"
Click the share button in your app to test the full experience. You should see the compose window open with your personalized share link, and the embed should display your custom generated image.