Field Notes

SEO

Backend-Driven SEO - Admin Controls Landing Pages Without Frontend Deploys

MemeWin's SEO metadata was spread across more than 50 files. I moved it to a backend-driven system using Prisma, a JSON-LD schema generator, server-rendered metadata, and ISR revalidation. An admin can update an SEO page in the CMS and publish the change without a frontend deployment.

Topic
SEO
Year
Read
5 min

The before state

The new architecture

  1. Backend schema using Prisma and MySQL:
  • SeoPage stores slug, title, description, ogImage, jsonLd as JSON, carousels as JSON, and isActive
  • Post stores title, slug, content, tags, categories, FAQ JSON, and SEO overrides
  • Tag and Category provide the taxonomy
  1. Global SEO configuration in the 327-line global-seo.config.json:
  • Per-route defaults, including the /games title template, description template, and og:type
  • Fallback values for every metadata field
  • JSON-LD defaults for Organization, Website, and BreadcrumbList schemas
  1. The schema-generator.ts schema generator:
  • Takes a page type and data, then returns a complete JSON-LD object
  • Generates Organization, Website, BreadcrumbList, Article, ItemList, and FAQPage schemas
  • Uses TypeScript interfaces that match the schema.org vocabulary
  1. Server-side rendering in page.tsx and generateMetadata:
  • [slug]/page.tsx reads the page through Prisma.seoPage.findUnique({ where: { slug } })
  • generateMetadata() combines global defaults, the backend SEO page, and page-specific overrides
  • It renders sanitised HTML from the backend content field
  • It mounts game carousels defined in the backend carousels JSON field
  1. ISR revalidation:
  • export const revalidate = 60 uses a 60-second stale-while-revalidate window
  • Saving in the admin CMS calls revalidatePath('/' + locale + '/' + slug) through a server action
  • Published changes appear within 60 seconds without a frontend deployment
  1. An isolated Next.js admin CMS:
  • The CMS uses its own JWT authentication with jose EncryptJWT, AES A128CBC-HS256, and a 24-hour expiry
  • Its own Prisma connection, separate from the casino backend
  • A rich-text editor for content and a JSON editor for carousels and FAQs
  • A preview mode before publication

RESULT

Continue conversation

Frontend problem worth thinking through?

Bring the context, including the hard parts. I am happy to talk them through.