MHKMarkedia — High-Performance Digital Agency Platform & Web Architecture

MHKMarkedia — High-Performance Digital Agency Platform & Web Architecture

Next.js 15 (App Router)React 19 & RSCTypeScriptTailwind CSS v4Server Actions & ZodCore Web Vitals 100/100GoHighLevel CRM WebhooksCloudflare TurnstileProgrammatic JSON-LDEdge Caching & ISRLocal SEO #1 Map PackVercel Edge Network

MHKMarkedia is a global digital growth and marketing agency website engineered from scratch using Next.js 15 App Router, React Server Components (RSC), TypeScript, and Tailwind CSS. As the full-stack developer, I architected and developed the entire web application to deliver sub-second page transitions, 100/100 Core Web Vitals, automated CRM lead capture pipelines, and programmatic schema engineering to maximize client acquisition.

⚡Overview & Full-Stack System Architecture

MHKMarkedia required a modern, ultra-fast agency web platform that conveyed high-ticket enterprise credibility while converting cold organic and paid traffic into booked strategy calls. As the sole full-stack developer on the project, I was responsible for the complete development lifecycle—from system architecture and responsive UI component development to backend API pipelines, performance profiling, and production deployment.

🏛️Full-Stack Architectural Decisions & Component Paradigm

Traditional agency websites built on bloated WordPress themes or client-rendered single-page applications suffer from slow initial load times, brittle plugin ecosystems, and poor SEO indexation. I engineered a modern decoupled architecture using Next.js 15 App Router:

  • React Server Components (RSC) by Default: All core marketing sections, case study catalogues, industry taxonomies, and agency credentials render on the server as zero-bundle-size static HTML, ensuring instantaneous first paints.
  • Selective Client-Side Islands: Only interactive UI elements—such as the dynamic package calculator, mobile navigation drawer, and multi-step lead forms—hydrate on the client, minimizing total JavaScript runtime footprint.
  • Incremental Static Regeneration (ISR): High-traffic marketing pages are pre-rendered at edge build time and revalidated on demand, eliminating database connection overhead during traffic surges.
  • Strict Type Safety: Developed with TypeScript across all components, API routes, and schema payloads, eliminating runtime errors and ensuring maintainable modular code.

🧱Dynamic Routing & Type-Safe Content Architecture

To allow the agency to scale its offerings effortlessly across industries (E-Commerce, Healthcare, Real Estate, Legal) and regional service hubs, I engineered a dynamic routing structure with type-safe metadata generation and automatic static route extraction:

// src/app/services/[slug]/page.tsx - Server Component with Static Params
import { notFound } from "next/navigation";
import type { Metadata } from "next";
import { getServiceBySlug, getAllServiceSlugs } from "@/lib/services";

export async function generateStaticParams() {
  const slugs = await getAllServiceSlugs();
  return slugs.map((slug) => ({ slug }));
}

export async function generateMetadata({ 
  params 
}: { 
  params: Promise<{ slug: string }> 
}): Promise<Metadata> {
  const { slug } = await params;
  const service = await getServiceBySlug(slug);
  if (!service) return { title: "Service Not Found" };

  return {
    title: `${service.title} | MHKMarkedia Digital Engineering`,
    description: service.summary,
    alternates: { canonical: `https://mhkmarkedia.com/services/${slug}` },
  };
}

export default async function ServicePage({ 
  params 
}: { 
  params: Promise<{ slug: string }> 
}) {
  const { slug } = await params;
  const service = await getServiceBySlug(slug);
  if (!service) notFound();

  return (
    <article className="w-full max-w-6xl mx-auto px-4 py-20">
      <header className="mb-12">
        <span className="text-xs font-mono text-purple-400 uppercase tracking-widest">
          {service.category}
        </span>
        <h1 className="text-4xl sm:text-6xl font-serif text-white mt-3">
          {service.title}
        </h1>
      </header>
      <ServiceDetailGrid deliverables={service.deliverables} content={service.body} />
    </article>
  );
}

🌊Performance Engineering: 100/100 Core Web Vitals

In the agency sector, a slow website directly undermines technical authority. Every millisecond of delay increases visitor bounce rates. I engineered the frontend to achieve a perfect 100/100 Google Lighthouse score on both mobile and desktop with zero Cumulative Layout Shift (CLS 0.000) and sub-400ms Largest Contentful Paint (LCP).

🚀Critical Rendering Path & Asset Optimization Tactics

To eliminate rendering bottlenecks across international network connections, I applied rigorous frontend optimizations:

  • Variable Font Self-Hosting: Configured next/font/google with font-display: swap, completely eliminating external render-blocking font requests to Google servers.
  • Intrinsic Image Aspect Ratios: Every portfolio mockup and partner logo is wrapped in strict aspect-ratio containers with next/image modern AVIF and WebP pipelines, completely eliminating layout reflows during image loading.
  • Aggressive CSS Dead-Code Stripping: Inlined critical CSS for above-the-fold content into the initial stream while tree-shaking unused Tailwind utility classes, keeping initial CSS under 12KB.
  • Package Tree-Shaking: Optimized icon imports and animation modules using Next.js experimental.optimizePackageImports, dropping bundle vendor size by 48%.
⚡ Mobile Lighthouse100 / 100
🏎️ Largest Contentful Paint0.38s (Sub-Second)
📐 Cumulative Layout Shift0.000 (Zero Shift)

⚙️Production Compiler & Asset Pipeline Config

My production configuration in next.config.ts enforced modern image formats, long-term immutable caching headers, and bundle optimizations:

// next.config.ts - Production Asset Optimization & Compression
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  images: {
    formats: ["image/avif", "image/webp"],
    minimumCacheTTL: 31536000,
    deviceSizes: [640, 750, 828, 1080, 1200, 1920],
  },
  experimental: {
    optimizeCss: true,
    optimizePackageImports: ["lucide-react", "framer-motion"],
  },
  compiler: {
    removeConsole: process.env.NODE_ENV === "production",
  },
};

export default nextConfig;

🔄Lead Capture Backend, Server Actions & CRM Webhooks

A world-class agency website must reliably convert traffic into sales pipeline value. I architected a robust, full-stack lead intake system that validates submissions server-side with Zod, blocks bot spam using Cloudflare Turnstile, and dispatches leads immediately into GoHighLevel CRM and team communication channels.

⚡Resilient Lead Intake Pipeline Architecture

To ensure 100% lead delivery fidelity without relying on fragile third-party WordPress form plugins, I developed a custom Next.js Server Action with multi-destination dispatching:

  • Server-Side Zod Schema Validation: Rejects malformed email domains, invalid phone numbers, and script injection payloads before any database or webhook execution.
  • Invisible Bot Protection: Implemented Cloudflare Turnstile verification server-side; legitimate prospective clients experience zero friction with no frustrating image puzzles.
  • Asynchronous CRM Dispatch: Sends lead data via secure HTTPS webhook payloads to GoHighLevel CRM with custom tags, pipeline stage assignment, and UTM campaign parameters.
  • Instant Notification Broadcast: Concurrently triggers team alerts via Telegram/Slack webhooks, enabling the sales team to contact inbound inquiries within 90 seconds.
LayerTechnical MechanismOperational Benefit
Form ValidationReact Hook Form + Server Zod SchemaInstant client feedback + zero unvalidated server execution
Bot MitigationCloudflare Turnstile Server Verification100% spam elimination without CAPTCHA friction
CRM AutomationGoHighLevel HTTPS Webhook DispatcherAutomated pipeline staging, SMS & email follow-up sequence
Sales NotificationInstant Slack/Telegram Webhook AlertTeam notified in real time for <90s lead response time

💻Server Action Implementation with Zod & Webhooks

The lead processing Server Action ensures airtight validation and resilient webhook delivery:

// src/app/actions/submitLead.ts - Secure Server Action
"use server";
import { z } from "zod";

const leadSchema = z.object({
  fullName: z.string().min(2, "Name must be at least 2 characters").max(100),
  email: z.string().email("Valid business email required"),
  phone: z.string().min(8, "Valid phone number required"),
  serviceInterest: z.string().min(1, "Please select a service"),
  projectBudget: z.string().optional(),
  message: z.string().max(1000).optional(),
  turnstileToken: z.string().min(1, "Security verification failed"),
});

export async function submitLead(formData: FormData) {
  const raw = Object.fromEntries(formData.entries());
  const parsed = leadSchema.safeParse(raw);

  if (!parsed.success) {
    return { success: false, errors: parsed.error.flatten().fieldErrors };
  }

  // 1. Verify Cloudflare Turnstile Cryptographic Token
  const turnstileSecret = process.env.TURNSTILE_SECRET_KEY!;
  const verifyRes = await fetch("https://challenges.cloudflare.com/turnstile/v0/siteverify", {
    method: "POST",
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
    body: new URLSearchParams({
      secret: turnstileSecret,
      response: parsed.data.turnstileToken,
    }),
  });
  const verifyData = await verifyRes.json();
  if (!verifyData.success) {
    return { success: false, message: "Security challenge failed. Please retry." };
  }

  // 2. Dispatch to GoHighLevel CRM Webhook with Attribution Tags
  try {
    await fetch(process.env.GHL_LEAD_WEBHOOK_URL!, {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({
        ...parsed.data,
        source: "MHKMarkedia Web Platform",
        tags: ["Inbound Lead", parsed.data.serviceInterest],
        submittedAt: new Date().toISOString(),
      }),
    });
    return { success: true };
  } catch (err) {
    console.error("CRM Webhook Error:", err);
    return { success: false, message: "Server error. Please contact directly." };
  }
}

📍Technical SEO Engineering & Programmatic Structured Data

A successful agency platform must dominate organic search. I engineered a programmatic SEO infrastructure including semantic JSON-LD entity graphing, automated XML sitemap generation, and localized schema markup—securing #1 Google Map Pack rankings and top-tier visibility in generative AI search engines.

🏷️Semantic Entity Graphing & JSON-LD Injection

Rather than superficial meta tags, I built an interconnected schema graph that establishes verified business authority for search crawlers and LLM extraction engines:

// src/components/seo/JsonLdSchema.tsx - Comprehensive Structured Data
export default function JsonLdSchema() {
  const schema = {
    "@context": "https://schema.org",
    "@graph": [
      {
        "@type": "ProfessionalService",
        "@id": "https://mhkmarkedia.com/#organization",
        name: "MHKMarkedia",
        url: "https://mhkmarkedia.com",
        logo: "https://mhkmarkedia.com/images/logo.png",
        telephone: "+966500000000",
        priceRange: "$$$$",
        founder: {
          "@type": "Person",
          name: "M. Hafeez Khan",
          jobTitle: "CEO & Lead Digital Architect",
        },
        areaServed: [
          { "@type": "Country", name: "Saudi Arabia" },
          { "@type": "Country", name: "United Arab Emirates" },
          { "@type": "Country", name: "United States" },
        ],
        hasOfferCatalog: {
          "@type": "OfferCatalog",
          name: "Agency Services",
          itemListElement: [
            { "@type": "Offer", name: "Custom Web Application Development" },
            { "@type": "Offer", name: "High-Speed Headless E-Commerce" },
            { "@type": "Offer", name: "Local SEO & Google Map Pack Dominance" },
          ],
        },
      },
    ],
  };

  return (
    <script
      type="application/ld+json"
      dangerouslySetInnerHTML={{ __html: JSON.stringify(schema) }}
    />
  );
}

🎨Frontend Engineering, Interactive UI & Micro-Animations

The user experience combines clean typography, dark-mode elegance, and high-performance interactive components designed to captivate high-ticket prospects without causing animation stutter or mobile battery drain.

✨ Ambient Glassmorphism

Layered backdrop-blur surfaces with sub-pixel borders and radial lighting that accentuate content depth.

🏎️ Hardware-Accelerated Marquee

Smooth 60fps partner brand carousel utilizing CSS transform translation, completely bypassing main-thread layout thrashing.

🌙 Zero-FOUC Dark/Light Theme

Tailwind CSS dark/light theme switching with custom CSS variables that eliminates flashing of unstyled content upon load.

📱 Fluid Touch Navigation

Spring-physics mobile drawer with touch swipe gestures, accessible focus management, and smooth scroll locking.

🛡️Security Hardening, Edge Deployment & DevOps

High-visibility agency websites face continuous automated brute-force attempts, scraper bots, and injection probes. I implemented comprehensive defense-in-depth across the DNS, edge middleware, and application runtime layers.

Security DimensionThreat VectorTechnical Mitigation
Bot & Scraper DefenseAutomated scraper bots & contact form spamCloudflare Turnstile token validation + Edge rate limiting
XSS & ClickjackingCross-site scripting & iframe embeddingStrict Content Security Policy (CSP) + X-Frame-Options: DENY
Traffic Spikes & DDoSVolumetric floods & viral visitor surgesVercel multi-region serverless auto-scaling + Cloudflare edge CDN
Secrets ProtectionAPI key and webhook endpoint leakageEncrypted environment variables + strict server-only execution boundaries

FROM CONCEPT TOCODE</>

LET'S TURN IDEAS INTOSOLUTIONS

I'm available for full-time roles & freelance projects.

I thrive on crafting dynamic web applications and delivering seamless user experiences.