This is a simple Next project that generates dynamic Mini App Embed images.
pnpm install
pnpm dev
http://localhost:3000/api/img?title=Title&description=Description
Create a dynamic image using query parameters or other data sources.
Setup additional templates by adding directories + route.ts
files under app/img
:
app/img/other/route.ts -> http://localhost:3000/api/img/other
By default images will be served with a Cache-Control: public, immutable, no-transform, max-age=31536000
so that after one request images will be served
from the CDN. You can add another query parameter if you need to bust a cache.
If you want the image content to get regenerated more often use a shorter max-age
.
For more information see the Dynamic Mini App Embed images docs.