OpenGraph Image Generator (app/opengraph-image.tsx)

Codewhale · web/app/opengraph-image.tsx · typescript · MIT
ui, crm, files, infra, fw:nextjs

A Next.js route handler that generates dynamic OpenGraph social media images. It reads brand assets and renders them into PNG format for SEO and social sharing.

// Source: https://github.com/Hmbown/Codewhale | License: MIT | Copyright 2024-2025 DeepSeek-TUI Contributors
// Provided via justclaw.it.com; keep this notice with the code.
import { readFile } from "node:fs/promises";
import { join } from "node:path";
import { ImageResponse } from "next/og";
import { IDENTITY_PHRASE, OG_ALT } from "@/lib/page-meta";

export const alt = OG_ALT;
export const size = { width: 1200, height: 630 };
export const contentType = "image/png";

// Read the brand SVGs when the image is generated, never at import time. This
// route is prerendered at build on Node, but its module is still evaluated
// inside the Cloudflare Worker whenever a page regenerates, and the Workers
// Node shim throws on fs.readFile. A top-level read here made every ISR
// regeneration on the

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key