Free

Province Immigration

Re-architecting a Delhi-based immigration consultancy serving 14,000+ applicants onto an embedded Payload CMS 3, Next.js 15, and PostgreSQL platform—unifying 13 points calculators, paid-ad funnels, and zero-rebuild ISR publishing.

Starting from scratch in Sep 2024 as the solo v1 engineer (117 commits on Payload 3.0 Beta & Next.js 15 Canary—31 collections, the full IRCC CRS calculator engine, 11 calculator routes, 6 lead forms, and 3-level CMS navigation), I then led the Payload CMS 3.69 migration bootstrap, on-demand revalidation API, paid-ad lead collections, custom Admin CSV export dashboards, homepage performance pass, and technical SEO / sitemap indexing fixes.

My role
Founding Solo Engineer (v1) → Lead Platform Engineer (v2)
Core stack
Next.js 15 · Payload CMS 3.69 · PostgreSQL · S3
Origin stack (v1)
Next.js 15 Canary · Payload 3.0 Beta · React 19 RC
Codebase scale
62.9k LOC · 518 files · 33 collections (v1: 49.1k LOC · 415 files)
Direct commits
155 commits — 117 solo v1 (Sep–Dec 2024) + 38 v2 (Dec 2025–Feb 2026)
provinceimmigration.comLive Production
Province Immigration live Next.js and Payload CMS platform

33

Payload CMS 3 collections on PostgreSQL + 2 globals & S3 media storage

13

Interactive PR & PNP points calculators across Canada, Australia & NZ

19

Custom Payload Admin date-range CSV export dashboards for counselors

159

Permanent 301 legacy URL redirects + 3 tagged dynamic XML sitemaps

End-to-End Platform Arc · Sep 2024 – Feb 2026

From greenfield v1 origin to production scale

117 solo v1 commits → +38 v2 rebuild commits

LayerPhase 1 · v1 Origin (payload-visa, 2024)Phase 2 · v2 Production Rebuild (2025–2026)
Timeline & Git HistorySep 27 – Dec 6, 2024 · 117 solo commits (payload-visa)Dec 2025 – Feb 2026 · +38 foundational commits (155 total)
Runtime & CMS StackNext.js 15 Canary · Payload 3.0 Beta · React 19 RC · PostgreSQLNext.js 15 · Payload CMS 3.69 · React 19 · PostgreSQL + AWS S3
Codebase & Schema Footprint415 files · 49.1k LOC · 31 collections + Header global518 files · 62.9k LOC · 33 collections + 2 globals & 19 CSV UIs
Calculators & Lead Capture11 calculator routes (~24.8k LOC) · 10 calc & 6 lead collections13 calculator routes · 12 calc & 8 lead/ad collections (/australia-ad, /germany-ad)
SEO, Sitemaps & Caching29 legacy 301 redirects · /api/sitemap (24h CDN) · revalidatePost159 legacy 301 redirects · 3 tagged XML sitemaps · /api/revalidate · double-// fix

What I directly engineered

Key architectural pillars I designed and shipped across git history—from the greenfield solo v1 build (payload-visa, Sep–Dec 2024) and the initial Payload CMS 3 + PostgreSQL rebuild through on-demand ISR, paid-ad lead ops, and search-index hardening.

Phase 1 · v1 Origin (Sep–Dec 2024)

Greenfield Payload 3.0 Beta + Next.js 15 Foundation (payload-visa)

e86cb11 · 903c938 · 65710ff · 117 solo commits

Built the original payload-visa repository solo from commit one on Next.js 15 Canary, React 19 RC, Payload 3.0 Beta, and PostgreSQL (415 source files, 49.1k LOC)—designing 31 initial collections, Lexical rich text with experimental tables & blocks, 100ms draft autosave Live Preview across 3 viewports, and custom slash-validated nested page slugs replacing Payload's nested-docs plugin.

Phase 1 · v1 Origin (Sep–Dec 2024)

IRCC CRS Scoring Engine & 11-Calculator Suite

1c6a5ef · 4a8845b · 0cdffa7 · 971d6ff

Authored ~24.8k LOC across 160 calculator files—including a 3,191-LOC multi-step Canada Express Entry CRS calculator (crscalc.tsx, logic1.tsx, logic2.tsx) handling CELPIP-G, IELTS, PTE Core, TEF Canada, and TCF Canada band conversions, dual with-spouse/single applicant scoring paths, 100-point skill-transferability matrices, and 10 additional Canada PNP & Australia PR calculators persisting directly to PostgreSQL.

Phase 1 · v1 Origin (Sep–Dec 2024)

3-Level CMS Navigation, 6 Lead Forms & Social Proof

627d7b1 · e780183 · 463a5a7 · 2dd9f34

Engineered the recursive 3-level NavItem collection and responsive hover/mobile navbar (Nav3.tsx), 6 dedicated lead-capture collections (Sticky, IELTS, Free Eligibility, Popup, Contact, Newsletter), categorized text & video testimonials with Lite YouTube embeds, Team/About collections, paginated /blogs and /news archives, and site-wide search via @payloadcms/plugin-search.

Phase 1 · v1 Origin (Sep–Dec 2024)

Initial WordPress SEO Migration, 29 Redirects & /api/sitemap

91fd3dc · 0c31562 · 778c131 · 0b7f4f4

Authored the first 29 permanent 301 WordPress-to-Next.js redirects in redirects.js, dynamic /api/sitemap XML endpoint (24h s-maxage=86400 CDN caching covering Pages, Blogs, News, and all 11 calculators), an HTML /sitemap directory, and robots.ts—establishing the SEO plumbing later expanded in v2.

Phase 2 · v2 Rebuild (Dec 2025–Feb 2026)

Payload CMS 3 + PostgreSQL Bootstrap

cc89dec · 225ad65 · 38 commits

Initiated and architected the new Payload CMS 3.69 + Next.js 15 App Router codebase (Dec 2025), uniting the frontend and CMS admin in a single deployable PostgreSQL + S3 application.

Phase 2 · v2 Rebuild (Dec 2025–Feb 2026)

Full-Site On-Demand ISR Revalidation API

c18076f · 063c875 · fc49e73

Built /api/revalidate to query published pages, news, and blogs in parallel, expand paginated archives and 14 service/calculator routes, and purge root layouts + paths with structured telemetry.

Phase 2 · v2 Rebuild (Dec 2025–Feb 2026)

Catch-All CMS Routing & Homepage Perf

e08a50c · 1af7b5f · b81a719

Engineered static force-static + dynamicParams routing with React.cache() slug deduplication, select-projected blog/news queries, and homepage rendering improvements.

Phase 2 · v2 Rebuild (Dec 2025–Feb 2026)

Paid Ads Collections & CSV Lead Ops

c6c1217 · a65293e · 013d002 · 1d11361

Shipped Australia and Germany ad collections (AustraliaAdForm, GermanyAdForm), dedicated conversion landing pages (/australia-ad, /germany-ad), and custom Admin CSV export UIs.

Phase 2 · v2 Rebuild (Dec 2025–Feb 2026)

Canonical URLs & Double-// Indexing Fix

a61db77 · f86930b · 925a9ed · 6d1b1a5

Added explicit canonical URLs across dynamic pages, blogs, news, and utility routes, eliminated a double-slash (//) indexing bug across getURL.ts and all 3 XML sitemaps, and fixed invalid <head>-in-<body> markup.

One PostgreSQL backbone. Zero CMS glue code.

Embedding Payload CMS 3.69 directly inside Next.js 15 App Router gave the team generated TypeScript types across 33 collections, local Server Component reads, S3 media storage, and multi-viewport Live Preview—without maintaining a separate CMS server.

Interactive Payload CMS 3 schema explorer

Inspect all 33 PostgreSQL collections, access policies, and hooks configured in payload.config.ts.

Editorial & CMS Core

Lexical rich text, Live Preview across 3 viewports, and S3 media storage

9 collections + 2 globals

REGISTERED COLLECTIONS & MODULES

PagesBlogs (Posts)NewsCategoriesMedia (S3)HomepageBannerCircleAboutMediaLogosUsersHeader (Global)Footer (Global)

Every page and editorial collection uses Payload 3.69's Postgres adapter with select-projected queries, Draft Mode previews (375px / 768px / 1440px), and instant on-demand ISR hooks on publish or slug rename.

ACCESS CONTROL BOUNDARY

Public read (published only) · Authenticated draft & write

LIFECYCLE HOOKS & ADMIN EXTENSIONS

revalidatePage, revalidatePost, revalidateHomepage, populateAuthors

Zero-rebuild publishing & airtight SEO migration.

An immigration consultancy lives on search rankings for visa draws, CRS guides, and eligibility calculators. Every CMS edit needed to go live instantly while 159 legacy URLs redirected cleanly and zero duplicate double-slash URLs leaked into Google.

src/collections/Pages/hooks/revalidatePage.ts

Editor publishes or renames a page in Payload Admin

  1. 01

    afterChange fires on publish

    Checks !context.disableRevalidate and resolves canonical path (/ or /slug).

  2. 02

    Targeted path + layout purge

    Calls revalidatePath(path), revalidatePath('/', 'layout'), and revalidateTag('pages-sitemap').

  3. 03

    Old slug cleanup on rename / unpublish

    Compares previousDoc.slug !== doc.slug so stale URLs purge immediately instead of lingering.

Runtime traceverified in repo
> [payload] Revalidating page at path: /canada-immigration/express-entry
> revalidatePath('/canada-immigration/express-entry') -> OK
> revalidatePath('/', 'layout') -> nav & footer synced
> revalidateTag('pages-sitemap') -> XML sitemap refreshed

Why one trailing slash broke sitemap indexing

When NEXT_PUBLIC_SERVER_URL carried a trailing slash in production, every XML sitemap entry and canonical tag concatenated into https://provinceimmigration.com//slug. Normalizing getServerSideURL() at the origin helper (commit a61db77) fixed all three XML sitemaps, the HTML sitemap, and every dynamic generateMetadata() canonical in one single source of truth.

// src/utilities/getURL.ts (commit a61db77 — double-// indexing fix)
export const getServerSideURL = () => {
  let url = process.env.NEXT_PUBLIC_SERVER_URL
    || (process.env.VERCEL_PROJECT_PRODUCTION_URL
      ? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
      : 'http://localhost:3000')
  return url.endsWith('/') ? url.slice(0, -1) : url
}

// src/app/(frontend)/[...slug]/page.tsx (static + on-demand ISR)
export const dynamic = 'force-static'
export const dynamicParams = true
export const revalidate = 600

Calculators & ad funnels built for counseling ops.

Every calculator and ad campaign writes structured eligibility data to PostgreSQL and ships with a custom Payload Admin date-range CSV export dashboard—eliminating manual database exports for the sales team.

13 Calculator Routes · 19 Admin Export UIs

Canada Federal & Express Entry

  • CRS Score Calculator
  • Express Entry Points Calculator
  • Canada PR 67-Points Calculator
  • Six Selection Factors Calculator

Canadian Provincial Nominee (PNP)

  • Alberta (AAIP) Calculator
  • British Columbia (BC PNP) Calculator
  • Ontario (OINP) Calculator
  • Saskatchewan (SINP) Calculator
  • Manitoba (MPNP) Calculator
  • Nova Scotia (NSNP) Calculator
  • Quebec Points Calculator

Australia, New Zealand & Europe

  • Australia PR Points Calculator
  • New Zealand Skilled Migrant Calculator
  • Australia Paid-Ad Eligibility Funnel
  • Germany Opportunity Card Ad Funnel

ORIGIN ENGINE · ~24.8k LOC ACROSS 160 CALCULATOR FILES

Inside the Canada Express Entry CRS scoring engine

Built solo in v1 (commits 1c6a5ef → 63f19ff)

3,191 LOC

Core CRS wizard & scoring engine (crscalc.tsx, logic1.tsx, logic2.tsx)

5 Tests

CELPIP-G, IELTS, PTE Core, TEF Canada & TCF Canada → CLB bands

2 Tracks

Single-applicant vs. accompanied-spouse scoring matrices + 100-pt transferability cap

35+ Fields

Structured applicant profile persisted straight into PostgreSQL (crs-calc)

Technical questions

What did you architect and build on Province Immigration?

I built the platform across both phases: first as the sole founding engineer of the v1 payload-visa codebase (Sep–Dec 2024, 117 commits on Payload 3.0 Beta, Next.js 15 Canary, and PostgreSQL—31 collections, custom slash-validated nested pages, a 3,191-LOC Canada CRS calculator plus 10 PR/PNP calculators, 6 lead forms, 3-level CMS navigation, and the initial 29 redirects + /api/sitemap), and then leading the Payload CMS 3.69 + Next.js 15 platform migration and core technical architecture—bootstrapping the new PostgreSQL/S3 codebase and shipping the catch-all CMS router, /api/revalidate on-demand ISR engine, homepage performance pass, Australia and Germany paid-ad collections and landing pages, Admin CSV export tools, canonical URLs, and the double-slash sitemap indexing fix.

How did the project start before the Payload 3.69 production rebuild?

The project began in September 2024 as the greenfield payload-visa repository (117 solo commits, 415 source files, ~49.1k LOC) on Payload CMS 3.0 Beta, Next.js 15 Canary, and React 19 RC. That initial v1 build replaced WordPress with 31 PostgreSQL collections, custom multi-segment slash-validated slugs (replacing Payload's nested-docs plugin), 11 interactive calculator routes (~24.8k LOC), 6 lead forms, a 3-level CMS-managed navbar, and 29 seed 301 redirects—establishing the exact domain model that later scaled to 33 collections, AWS S3 storage, 19 Admin CSV export dashboards, and 159 redirects on stable Payload 3.69.

How was the Canada Express Entry CRS points calculator engineered?

Built during the v1 foundation in crscalc.tsx (1,806 LOC), logic1.tsx (886 LOC), and logic2.tsx (499 LOC), the multi-step React Hook Form wizard converts raw Speaking, Listening, Reading, and Writing scores across five official tests (CELPIP-G, IELTS, PTE Core, TEF Canada, TCF Canada) into CLB tiers, branches across single-applicant vs. accompanied-spouse matrices, caps Skill Transferability combinations at 100 points, and persists 35+ structured applicant fields directly to PostgreSQL's crs-calc collection.

Why choose Payload CMS 3 embedded in Next.js 15 instead of keeping a separate WordPress CMS?

Running Payload CMS 3 directly inside Next.js 15 App Router over PostgreSQL eliminates the network hop and plugin fragility of a separate WordPress backend. Server Components query Postgres locally via Payload's Local API with strict TypeScript types generated straight from collection schemas, while editors get Live Preview across mobile/tablet/desktop and instant on-demand ISR hooks.

How does the platform turn calculator traffic into actionable counseling leads?

Instead of generic contact forms, 12 dedicated PostgreSQL collections capture structured points-calculator submissions (age, education, IELTS/CLB bands, work experience, provincial factors) alongside 8 lead/ad form collections. Nineteen custom beforeListTable components inside Payload Admin let counselors filter any collection by date range and export clean CSVs directly without developer help.

How was existing search equity preserved during the migration?

We combined 159 permanent 301 legacy URL redirects in redirects.js with Payload's database-backed redirects plugin, explicit canonical URLs on every dynamic route, three tag-cached XML sitemaps (pages, posts, news), normalized trailing-slash origin URLs to prevent double-// duplicates, and dedicated JSON-LD schemas for Articles, FAQs, Breadcrumbs, and Customer Reviews.

Migrating a content platform to Next.js & Payload?

Architecture & SEO audits start at $500 fixed (3–5 days). Scoped Next.js & Payload CMS builds start at $1,500. Ongoing engineering is $35–$45/hr with daily UK/EU live overlap and US async-first delivery.