Zero-DB `llms.txt`, Static Markdown Mirrors, and `VideoObject` Parity Checks in Next.js App Router
When developers ship an AI meme video generator or a catalog of trending AI video templates, the human HTML pages are only half the surface area. AI assistants and search crawlers now fetch /llms.txt, /llms-full.txt, and plain-text .md mirrors directly—and if those text files drift from your TypeScript billing or duration config, crawlers hallucinate wrong credit prices, wrong aspect ratios, or nonexistent exports without payment.
Maintaining Markdown summaries by hand guarantees drift within two deploys. A cleaner approach in Next.js App Router is to treat llms.txt, .md mirrors, and VideoObject structured data as pure build-time projections of one typed catalog array.
Here is the exact TypeScript pattern—including a static Next.js route handler and an automated Vitest parity test—that keeps every machine-readable route accurate without touching a database at request time.
1. Projecting Catalog Specs Into Clean .md Mirrors (Zero DB Calls)
Rather than querying Postgres when a bot requests /markdown/some-template, expose a static route handler or llms-full.txt builder that compiles directly from your typed site config:
export interface TemplateSpec { id: string; slug: string; title: "string;" aspectRatio: "9:16" | "3:4" | "4:3" | "16:9"; seconds: number; photosRequired: 1 | 2; variants: Array<{ resolution: "480p" | "720p"; credits: number; }>; exportFormats: string[]; } export function renderTemplateMarkdown( origin: string, spec: TemplateSpec, ): string { const pricingLine = spec.variants .map((v) => `${v.resolution}: ${v.credits} credits`) .join(" / "); return [ `# ${spec.title}`, "", `- Canonical: ${origin}/${spec.slug}`, `- Frame: ${spec.aspectRatio}, ~${spec.seconds}s`, `- Photos needed: ${spec.photosRequired}`, `- Credits: ${pricingLine}`, `- Export formats: ${spec.exportFormats.join(", ")}`, `- Watermark: none (MP4 with original audio)`, ].join("\n"); } Serving this output with Content-Type: text/markdown; charset=utf-8 and Cache-Control: public, max-age=3600, s-maxage=86400 avoids waking serverless database connections on crawler bursts while stripping navigation HTML noise.
2. Keeping VideoObject JSON-LD Honest for Borrowed vs. Self-Made Clips
When a template catalog displays example clips on landing pages, structured data has one critical boundary: only mark up videos you actually produced and host.
If a page temporarily credits an external creator's clip while a custom showcase is still pending, omit VideoObject JSON-LD and video sitemap entries for that entry at build time:
export interface ShowcaseVideo { url: string; posterUrl: string; seconds: number; uploadDate?: string; externalCredit?: { label: string; postUrl: string }; } export function buildVideoObjectJsonLd( pageUrl: string, title: string, showcase: ShowcaseVideo, ) { if (showcase.externalCredit || !showcase.uploadDate) { return null; } return { "@context": "https://schema.org", "@type": "VideoObject", name: title, thumbnailUrl: showcase.posterUrl, contentUrl: showcase.url, uploadDate: showcase.uploadDate, duration: `PT${showcase.seconds}S`, embedUrl: pageUrl, }; } This single guard prevents search engines from associating third-party video metadata with your domain's structured-data feed.
3. Enforcing Parity Between UI Config, llms-full.txt, and .md Routes
Add a fast unit test that compares rendered Markdown mirrors against the live catalog array on every CI run:
import { describe, expect, it } from "vitest"; export function assertMirrorParity( origin: string, catalog: TemplateSpec[], llmsFullText: string, ) { for (const item of catalog) { const md = renderTemplateMarkdown(origin, item); expect(md).toContain(`${origin}/${item.slug}`); expect(llmsFullText).toContain(`/${item.slug}`); for (const v of item.variants) { expect(md).toContain(`${v.resolution}: ${v.credits} credits`); } } } describe("machine-readable catalog parity", () => { it("keeps rendered markdown aligned with typed specs", () => { const sample: TemplateSpec[] = [ { id: "crying-faces", slug: "crying-faces-ai-video-generator", title: "Crying Faces AI Video Generator", aspectRatio: "3:4", seconds: 10, photosRequired: 1, variants: [ { resolution: "480p", credits: 70 }, { resolution: "720p", credits: 155 }, ], exportFormats: ["9:16", "1:1"], }, ]; const full = renderTemplateMarkdown("https://example.com", sample[0]); assertMirrorParity("https://example.com", sample, full); }); }); Production Reference
This zero-DB Markdown mirror and llms.txt architecture runs in production on SameButMe, which serves 93 active photo-to-video formats across its trending AI video templates catalog—including close-up reaction formats like the Crying Faces AI video generator. All finished MP4s export without a watermark with original audio intact; paid credits are required (starting with a $6.99 Try pack for 110 credits), and credits from failed or timed-out renders are returned to your balance.