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
- Backend schema using Prisma and MySQL:
SeoPagestores slug, title, description,ogImage,jsonLdas JSON, carousels as JSON, andisActivePoststores title, slug, content, tags, categories, FAQ JSON, and SEO overridesTagandCategoryprovide the taxonomy
- Global SEO configuration in the 327-line
global-seo.config.json:
- Per-route defaults, including the
/gamestitle template, description template, andog:type - Fallback values for every metadata field
- JSON-LD defaults for Organization, Website, and BreadcrumbList schemas
- The
schema-generator.tsschema 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
- Server-side rendering in
page.tsxandgenerateMetadata:
[slug]/page.tsxreads the page throughPrisma.seoPage.findUnique({ where: { slug } })generateMetadata()combines global defaults, the backend SEO page, and page-specific overrides- It renders sanitised HTML from the backend
contentfield - It mounts game carousels defined in the backend
carouselsJSON field
- ISR revalidation:
export const revalidate = 60uses 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
- 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