alrukn-payload-website

Next.js 16 and Payload CMS website starter for service businesses with SEO, GTM tracking and lead capture

alrukn-payload-website preview

Overview

Summary generated from the README

A website template built on the official Payload website template, using Next.js 16, PostgreSQL and Tailwind CSS 4. It adds service, project and portfolio content, a layout builder, local SEO structured data, Google Tag Manager with GA4 and Consent Mode v2, and Google Reviews and Maps. Requires Node 22+, pnpm and PostgreSQL 16+.

Features

  • Layout builder with about 20 blocks including Hero, QuoteForm, FAQs, Service Grid and Location Coverage
  • Collections for Pages, Posts, Projects, Services, Portfolio items, FAQs, Testimonials and private Leads
  • SEO stack with canonical URLs, JSON-LD schema, sitemap, robots and managed redirects
  • GTM and GA4 integration with Consent Mode v2 and conversion events for form, WhatsApp and phone clicks
  • Google Reviews through Places API and Google Maps links managed from a Payload global
  • Quote request endpoint with SMTP email notifications, Docker setup and Vitest and Playwright test suites

Good for

  • Building websites for service businesses that need lead capture and Google Ads conversion tracking
  • Delivering local-SEO focused sites for agencies and freelancers working with service brands
  • Launching portfolio and service landing sites with a CMS-managed layout builder

From the author

Al Rukn Furniture website and content platform

Get started

This repository is a GitHub template: create your own copy of it in one click.

Create a repository from this template

README

Next.js + Payload CMS Website Template

Next.js 16 + Payload CMS 3 website template with SEO, Google Tag Manager, GA4 and conversion tracking

Next.js 16 Payload CMS 3 TypeScript PostgreSQL Tailwind CSS Use this template

Next.js Payload CMS template for service-business websites: SEO-ready, Google Tag Manager + GA4 built in, lead conversion tracking (form, WhatsApp, phone) for Google Ads, and a full Payload admin. Live demo: repair.kanzelectronic.com

Built on the official Payload Website Template (Payload 3.89 + Next.js 16), then production-hardened for real service businesses.

A reusable Next.js 16 + Payload CMS 3 starter with PostgreSQL, layout builder, SEO / AEO / GEO, Google Tag Manager + GA4, Cookie Consent Mode v2, Google Reviews, Google Maps, leads, service landings, and portfolio — already proven on live sites.

Live production sites

SiteURL
Al Rukn Furniturehttps://alruknfurniture.ae/
Al Mustajid Aluminium & Glasseshttps://almustajid.ae/
Kanz Electronic TV Repairhttps://repair.kanzelectronic.com/
Homes Renovatorshttps://homesrenovators.com/
Al Mustajid Serviceshttps://services.almustajid.ae/
Mudassar (developer portfolio)https://mudassar.net/

Developer

Built and maintained by Mudassar — mudassar.net

Why use this template

  • Battle-tested in production — Same codebase family powers alruknfurniture.ae, almustajid.ae, repair.kanzelectronic.com, homesrenovators.com and services.almustajid.ae, not a demo-only starter.
  • Next.js 16 App Router + Payload 3.89 — Admin at /admin, frontend App Router, React Server Components, standalone Docker-ready output.
  • PostgreSQL first — @payloadcms/db-postgres with migrations and production env checks.
  • Service-business CMS — Pages, Posts, Projects, Services, Portfolio, FAQs, Testimonials, private Leads, Redirects, Areas, Categories, plus catalogue collections for product-style service lines.
  • Rich layout builder — 20 blocks (Hero, Content, CTA, Forms, Quote, FAQs, Testimonials, Service Grid, Process, Stats, Location Coverage, Project Gallery, and more).
  • SEO + AEO + GEO — Full metadata/canonical/OG stack, JSON-LD entities, FAQ answer schema, LocalBusiness / area coverage, sitemap & robots, redirects — built for classic search, answer engines, and generative/local discovery.
  • Google Tag Manager (integrated) — Production GTM container + GA4 gtag, Consent Mode v2 defaults before tags fire, shared dataLayer conversion events.
  • Google Reviews + Maps — Places API (New) native reviews, Maps / write-review links, Contact mapURL, Place ID via Payload global.
  • Quality gates — template:check, lint, typecheck, Vitest unit/integration, Playwright e2e/a11y, optional LHCI.
  • Clean reuse — Demo Payload artifacts removed; follow TEMPLATE.md to rebrand for a new project.

Who this is for

  • Agencies, studios, and freelancers shipping CMS websites for service brands
  • Teams that need SEO/AEO/GEO, GTM analytics, Google Reviews/Maps, leads, and portfolio/service pages out of the box
  • Anyone who wants a production Payload + Next baseline stronger than the stock website template

Quick start

Requirements

  • Node.js 22+ (Docker image uses Node 22; local Node 24+ also works)
  • pnpm (via Corepack)
  • PostgreSQL 16+

Clone

git clone https://github.com/mhkxx2/nextjs-payload-website-template.git
cd nextjs-payload-website-template

Or use Use this template on GitHub.

Development

cp .env.example .env
# edit DATABASE_URI, PAYLOAD_SECRET (>=32 chars), NEXT_PUBLIC_SERVER_URL, PREVIEW_SECRET, REVALIDATION_SECRET

pnpm install
pnpm payload migrate    # apply DB migrations
pnpm dev                # http://localhost:3000  |  admin: /admin

First admin user is created through the Payload onboarding flow at /admin.

Optional: Docker Compose (app + Postgres)

docker compose up

Compose starts Postgres 16 and the Next/Payload app on port 3000 with local-only defaults. Replace every secret before any shared or production use.


SEO, AEO & GEO (detailed)

This template ships a production search + answer + generative/local discovery stack — not just a meta title field.

SEO (classic search engines)

CapabilityWhat ships
CMS SEO fieldsPer-document SEO title (≤60), meta description (≤180), required canonical URL, index/follow toggles
Open Graph & TwitterOG title/description/image + Twitter card metadata via Next Metadata helpers
Admin SEO previewIn-admin search/social preview UI (SEOPreview)
Site-wide defaultsSEODefaults global + @payloadcms/plugin-seo
Canonical policyTrailing-slash canonical URLs, origin-safe resolution, drafts/utility paths excluded
robots.txtApp Router robots route; disallows /admin/, /api/, /graphql/, /internal/, /next/, /search/
sitemap.xmlDynamic sitemap of published, indexable pages/posts/projects/services (+ structural routes & catalogue products)
RedirectsPayload redirects plugin + collision-safe public route contract
404 / soft 404 hygieneDedicated not-found handling; filtered catalogue views can force noindex when appropriate
Site icons for crawlersFavicon / apple-touch / icon routes served outside /api/ so robots are not blocked
On-demand revalidationCache tags + revalidation hooks so SEO URLs stay fresh after CMS edits

AEO (Answer Engine Optimization)

Built so assistants and answer surfaces can extract clear entities and Q&A:

  • JSON-LD schema.org graph with allowlisted types only: Organization, LocalBusiness, Service, Article, FAQPage, BreadcrumbList
  • FAQPage emitted only for FAQs editors mark schemaEligible (and that are publicly published)
  • Service / Article / Breadcrumb entities for service landings, posts, and navigation trails
  • Safe serialization (escaped JSON-LD) so markup cannot break out of the script tag
  • Structured contact & organization fields from globals (brand, business name, logo, social) for entity clarity
  • CMS-controlled schema type selection on records (schemaTypes multi-select)

GEO (Generative + geographic / local discovery)

  • LocalBusiness schema with opening hours, contact, and areaServed when service areas exist
  • Areas collection + Location Coverage layout block for city/emirate service geography
  • Google Maps business URL on Contact (mapURL) and Google Reviews (mapsUrl) — validated HTTPS Maps hosts only
  • Google Place ID (Payload google-reviews global) ties the site to the real Maps listing
  • Write-a-review + View on Google deep links for local trust signals
  • Entity-rich service/portfolio pages that generative engines can cite with NAP-style business context

Analytics & Google Tag Manager (integrated)

Production frontends load a full measurement stack from the root layout:

  1. Consent Mode v2 defaults (beforeInteractive) — storage defaults queued before tags
  2. Google Tag Manager — container snippet + <noscript> iframe (NEXT_PUBLIC_GTM_ID)
  3. Google Analytics 4 — gtag.js loader + config (NEXT_PUBLIC_GA_ID)
  4. Shared dataLayer — typed helper pushes privacy-safe events (allowlisted params only; no raw PII)

Conversion / engagement events

EventTypical trigger
whatsapp_clickTracked WhatsApp CTAs (hero, sticky bar, service landings, catalogue)
phone_call_clickClick-to-call CTAs
generate_leadConfirmed quote/lead form success
select_item / view_itemCatalogue / product exploration
reviews_view_google_click / review_write_clickGoogle Reviews CTAs

Cookie UI: Cookie Consent banner + settings button; consent updates align with GTM/GA4 Consent Mode v2. Analytics scripts are intended for production (NODE_ENV=production).

Step-by-step setup (GTM container, Payload admin tracking settings, Google Ads conversions for form / WhatsApp / phone clicks, deploy and testing): .claude/skills/nextjs-payload-gtm-tracking/SKILL.md.

Configure per brand:

NEXT_PUBLIC_GA_ID=G-XXXXXXXXXX
NEXT_PUBLIC_GTM_ID=GTM-XXXXXXX

Google Reviews & Google Maps

PieceDetails
Payload globalGoogle Reviews (google-reviews): enable flag, Place ID, heading/subheading, review limit (3–5), Maps URL, write-review URL
Native reviewsServer fetch via Places API (New) using server-only GOOGLE_PLACES_API_KEY (never NEXT_PUBLIC_*, never stored in Payload)
UIStars, carousel/scroller, review text, attribution links; tracked view/write CTAs
FallbackIf disabled / missing key / missing Place ID → still shows “View on Google” + “Write a Review” Maps links
Contact MapsContactInformation.mapURL for the business listing (validated Google Maps hosts)
CachingReviews payload revalidated periodically; graceful last-good fallback while the process is warm

Production gate: pnpm env:check requires a non-empty GOOGLE_PLACES_API_KEY for production-shaped environments.


Features (detailed)

Collections

CollectionPurpose
UsersAuth-enabled admins for Payload
PagesDraft-enabled layout-builder pages
PostsBlog / news with layout builder
ProjectsCase-style project pages
ServicesService catalogue + landing data
PortfolioItemsPortfolio gallery / explorer
Media / LeadMediaUploads + lead attachment media
FAQs / TestimonialsReusable trust content (FAQs support schema-eligible AEO)
LeadsPrivate inbound quote/contact leads
RedirectsManaged URL redirects (SEO migrations)
Areas / CategoriesLocation + taxonomy (GEO / local coverage)
CurtainBlindCategories / CurtainBlindProductsCatalogue-style product lines

Globals

Header, Footer, Homepage, AboutPage, ContactPage, ContactInformation (incl. Google Maps URL), SiteSettings, SEODefaults, SocialMedia, ArchiveSettings, GoogleReviews.

Layout builder blocks

Hero, Content, RichContent, SplitContent, MediaBlock, Banner, CallToAction, Form, QuoteForm, Faqs, Testimonials, ServiceGrid, ProcessSteps, Benefits, Statistics, LocationCoverage, ProjectGallery, RelatedPosts, ArchiveBlock, Code.

Frontend / growth

  • Service landings (sofa upholstery, bed upholstery, curtains & blinds)
  • Portfolio explorer
  • Quote request endpoint + SMTP notifications (@payloadcms/email-nodemailer)
  • Mobile sticky contact bar + GTM-tracked contact links
  • GTM + GA4 + Consent Mode v2 analytics scripts
  • Google Reviews section (Places API New) + Maps deep links
  • Import/verify scripts for catalogue and portfolio batches

Plugins & platform

  • @payloadcms/plugin-seo, form-builder, nested-docs, redirects, search
  • @payloadcms/richtext-lexical, live-preview-react, admin-bar
  • next-sitemap, Tailwind CSS v4, Radix/shadcn-style primitives
  • Access control for published vs authenticated content
  • On-demand revalidation hooks + cache tags
  • Draft / live preview secrets

Inherited from Payload Website Template

Pre-configured Payload config, authentication, access control, layout builder, draft preview, live preview, on-demand revalidation, SEO, search, redirects, and website App Router — then extended for service-business production use. See Payload Website Template.


Environment variables

Copy .env.example → .env. Required for a healthy local/prod boot:

VariableNotes
DATABASE_URIPostgreSQL connection string (project-specific DB — never reuse another brand’s DB)
PAYLOAD_SECRET≥ 32 random characters
NEXT_PUBLIC_SERVER_URLPublic site origin, e.g. https://example.com
PREVIEW_SECRETDraft preview
REVALIDATION_SECRETOn-demand revalidation

Analytics, Maps & Reviews:

VariableNotes
NEXT_PUBLIC_GTM_IDGoogle Tag Manager container ID (integrated in root layout)
NEXT_PUBLIC_GA_IDGoogle Analytics 4 measurement ID
GOOGLE_PLACES_API_KEYServer-only Places API (New) for native Google Reviews — never expose as NEXT_PUBLIC_*
SMTP_*Lead email delivery

Run pnpm env:check before production builds.


Scripts

CommandPurpose
pnpm devLocal development
pnpm build / pnpm startProduction build & serve
pnpm payload migrateRun migrations
pnpm seedOptional seed content
pnpm template:checkEnsure demo artifacts stay removed
pnpm release:gateEnv + template check + lint + types + tests + build
pnpm test:unit / test:integration / test:e2e / test:a11yQuality suites

Production build (VPS / bare metal)

Typical flow used for the live UAE sites (Node process behind Nginx / reverse proxy):

cp .env.example .env
# set production DATABASE_URI, secrets, NEXT_PUBLIC_SERVER_URL=https://your-domain.com

pnpm install --frozen-lockfile
pnpm payload migrate
pnpm env:check
pnpm build
pnpm start
# or: node .next/standalone/server.js  when using Next standalone output

Reverse proxy checklist

  1. Point DNS A/AAAA (and www) to the server.
  2. Terminate TLS on Nginx / Caddy / aaPanel.
  3. Proxy to the Node listen address (e.g. 127.0.0.1:3000 or your chosen port).
  4. Forward Host, X-Forwarded-For, X-Forwarded-Proto.
  5. Allow Payload media routes (/api/media/...) and admin (/admin).
  6. Persist upload storage (storage/ or your configured media path) across deploys.
  7. Keep .env outside the public web root; never commit it.

Standalone / process manager

next.config.ts sets output: 'standalone'. After pnpm build you can run the standalone server under pm2, systemd, or Docker.

Example pm2:

pnpm build
pm2 start pnpm --name my-site -- start
# or point pm2 at .next/standalone/server.js with HOSTNAME=0.0.0.0 PORT=3000

Docker production image

docker build -t nextjs-payload-website .
docker run --env-file .env -p 3000:3000 nextjs-payload-website

Ensure Postgres is reachable from the container (DATABASE_URI host must work inside the network).

Deploy updates

git pull
pnpm install --frozen-lockfile
pnpm payload migrate
pnpm build
# restart process manager / container

Always backup Postgres + media storage before migrate/deploy.


Reuse on a new brand

  1. Clone this repo (or use Use this template on GitHub).
  2. Follow TEMPLATE.md: rename package/brand, swap logo/favicon, new DB + secrets.
  3. Update NEXT_PUBLIC_SERVER_URL and any hardcoded image host allowlists in next.config.ts.
  4. pnpm install → pnpm payload migrate → pnpm template:check → pnpm dev.
  5. Do not copy another site’s .env, database, or upload storage.

Isolation tip (as used for Al Mustajid vs Al Rukn): each brand gets its own database, secrets, deploy directory, and env file.


Project structure (high level)

src/
  app/(frontend)/     # Public Next.js routes
  app/(payload)/      # Payload admin + API
  blocks/             # Layout builder blocks
  collections/        # CMS collections
  globals/            # Site-wide globals
  components/         # UI + landing kits
  endpoints/          # Custom API (e.g. quote request)
  migrations/         # Payload DB migrations
  lib/                # SEO, analytics, cache, queries
docs/                 # Provenance, plans, ops notes
scripts/              # Seed, import, verify, env checks
tests/                # Unit, integration, e2e, a11y

Provenance & license


Support

More Business & agency templates

basesmi screenshot

basesmi

Small business website for counseling practices with services, team and resources pages on Next.js and MongoDB

41
v3
Next.js
Updated 2 weeks ago
smart-site screenshot

smart-site

Next.js and Payload CMS website kit with an MCP plugin and coding-agent skills for Codex and Claude Code

1
v3
Next.js
Updated 1 months ago
events screenshot

events

Event ticketing demo with venues, seat capacity and Stripe checkout using the payload-reserve plugin

0
v3
Next.js
Updated 2 weeks ago