This site is not affiliated with or endorsed by Vercel, Inc. Read the docs, then deploy or run each experiment yourself.
Developer Tools

OG from Database

Seed/list Neon product rows (or in-memory fallback) and render ImageResponse OG cards by slug.

Run this experiment yourself

Demos are not embedded on this site. Deploy a standalone copy on Vercel or run the experiment app locally.

Local development

cd apps/experiments/og-from-database
pnpm install
pnpm dev

Then open http://localhost:3010.

This is an experimental demo. Use it as a starting point for your own projects.

OG from Database seeds product rows into Neon (experiment_products) when DATABASE_URL is set, otherwise uses an in-memory seed list. GET /api/og?slug= looks up the row and returns an ImageResponse card from title/description. No AI provider is required.

Features

  • Seed / list / upsert products – Neon or in-memory.
  • OG by slug – ImageResponse from row fields.
  • Shared memory store – in-memory adds appear in OG previews.
  • Sample catalog – Edge Cache Kit, Neon Notes, Blob Drop.
  • Honest storage note when Postgres is missing.

API Reference

GET /api/products / POST /api/products

List or upsert { slug?, title, description }.

GET /api/og?slug=

Returns a 1200×630 PNG Open Graph image for the product.

StatusCause
400Missing slug / invalid product body
404Unknown slug

Implementation Details

ensureTable + seedIfEmpty

Creates experiment_products and seeds defaults once.

ImageResponse

Renders title + description from the looked-up row.

Use Cases

  • Learn composition patterns for this lab’s stack.
  • Prototype before wiring production auth and quotas.
  • Deploy the standalone app as a reference implementation.

Limitations

  • Demo-scale caps on input size and output counts.
  • No auth / rate limits on public deploys.
  • Model quality depends on input clarity.

Use in your project

Copy the Route Handler and logic.ts helpers from apps/experiments/og-from-database/. Wire your own persistence and auth as needed.

Deployment

Deploy on Vercel

Local Development

cd apps/experiments/og-from-database
pnpm install
pnpm dev

Configuration

VariableRequiredPurpose
DATABASE_URLNoNeon product storage

Vercel / Next.js Features Used

  • next/og ImageResponse
  • Neon serverless Postgres
  • Route Handlers
  • Zod

Next Steps

On this page