How to generate user specific images in the Farcaster Mini App
Creating shareable moments in the Farcaster Mini App is a great way to engage with your users.
You can generate custom shareable user specific images in the Farcaster Mini App and make it easy for the user to share them!

In this guide we setup a dedicated endpoint /api/og for generating images and we use @vercel/og package to generate the images.
Generating images
If you are using the Monad Mini App template, you can simply
edit app/api/og/route.tsx
to generate images of your choice.
12345678910111213141516171819202122232425262728
If you are not using the template, you need to install @vercel/og package.
npm install @vercel/ogCreate a new file app/api/og/route.tsx, if you are using Next.js 14 or higher.
1234567891011121314151617181920212223
If you are not using Next.js, you can setup an endpoint or dedicated microservice to generate the images.
Sharing images via the Mini App

Add shareable elements to your Mini App, so the user can share the generated images via the Mini App.
Below is an example of a button that can be used to generate and share a custom image:
1234567891011121314151617181920212223242526272829303132333435