@lynxflow/seo-engine 1.5.1 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3649,10 +3649,10 @@ When discovering or listing product modules, features, or services to build the
3649
3649
  - DO NOT create programmatic pages for internal plumbing like: \`/api/stripe\`, \`/api/resend\`, \`/api/auth\`, \`/api/d1\`, \`/api/webhooks\`, \`/api/openai\`.
3650
3650
  - DO NOT expose internal infrastructure, vendors, or suppliers (e.g. Stripe, Resend, Cloudflare D1, Better-Auth, Supabase, PostgreSQL drivers) as public product features. End users never search for or buy your internal backend plumbing.
3651
3651
  - **✅ ALWAYS inspect the FRONTEND user-facing interface & commercial value propositions:**
3652
- - Read marketing navigation menus & dropdowns (\`components/Navbar.tsx\`, \`components/Header.tsx\`, \`components/Navigation.tsx\`).
3653
- - Read marketing feature pages & pricing tiers (\`app/(marketing)/*\`, \`pages/features/*\`, \`app/pricing/*\`).
3654
- - Read dashboard UI workflows & user modules (\`components/dashboard/*\`, \`components/sidebar/*\`).
3655
- - Identify the actual **benefits and tools the end-user buys** (e.g. "Visual Pipeline Kanban", "Automated Invoice Tracking", "Electronic Signature", "Real-Time Client Portal", "Custom Reporting").
3652
+ - **Step 1A - Marketing Navbars & Dropdowns:** Scan \`components/Navbar.tsx\`, \`components/Header.tsx\`, \`components/Navigation.tsx\` to list all primary product modules.
3653
+ - **Step 1B - Marketing Feature Pages & Pricing:** Scan \`app/(marketing)/*\`, \`pages/features/*\`, \`app/pricing/*\` to list commercial feature names and pricing tiers.
3654
+ - **Step 1C - Dashboard Navigation & User Tools:** Scan \`components/dashboard/*\`, \`components/sidebar/*\` to find actual user workflows.
3655
+ - **Step 1D - Extraction Requirement:** For EACH discovered module (or major product branch), create at least 1 programmatic service entry with \`slug\`, \`name\`, \`category\`, \`description\`, \`keyFeatures\`, and \`priceMonthly\`.
3656
3656
 
3657
3657
  ---
3658
3658
 
@@ -3666,7 +3666,137 @@ When discovering or listing product modules, features, or services to build the
3666
3666
 
3667
3667
  ---
3668
3668
 
3669
- ### \uD83C\uDFDB️ 3. MATRIX ARCHITECTURE: 10 ROOT PILLARS & 50+ SPECIALIZED SUB-MATRICES
3669
+ ### \uD83C\uDFC6 3. THE ARCHITECTURAL PLAYBOOK OF SAAS TITANS (7M+ PAGES WITH 0 DB BOTTLENECKS)
3670
+
3671
+ How category leaders generate millions of high-converting pages without server saturation:
3672
+
3673
+ 1. **Proven Formulas of SaaS Giants:**
3674
+ - ⚡ **Zapier (~25 Million pages):** \`App A × App B\` (e.g. "Connect WhatsApp to Shopify", "Sync Sheets with Notion").
3675
+ - \uD83C\uDFA8 **Canva (~50 Million pages):** \`Template Type × Industry/Theme × Format × Locale\` (e.g. "Restaurant Menu Italian A4").
3676
+ - \uD83D\uDCB8 **Wise (~15 Million pages):** \`Currency Pair × Country × Dynamic Rate Calculator\`.
3677
+ - \uD83D\uDCCA **G2 & Capterra (~10 Million pages):** \`App A vs App B\` / \`Alternative to App X for [Role]\`.
3678
+
3679
+ 2. **The 4 Pillars of Zero-Latency (< 0.05ms) Resolution:**
3680
+ - **0 Bytes in Database:** Never generate physical static files or query heavy databases per request. Pages are resolved mathematically in RAM upon arrival.
3681
+ - **1 Single Universal Catch-All Route:** \`app/[...slug]/page.tsx\` (or \`app/[locale]/[...slug]/page.tsx\`) handles all matrices through one lightweight layout.
3682
+ - **Edge Caching & ISR:** The rendered HTML is instantly cached at the CDN/Edge (Cloudflare / Vercel Edge) on first request.
3683
+ - **Automatic Siloing & Mesh Linking:**
3684
+ - Links to 3 neighboring geographic cities for the same service.
3685
+ - Links to 4 related professions/industries in the same target category.
3686
+ - Complete Schema.org BreadcrumbList navigation.
3687
+ - **Sharded XML Sitemaps:** Split into 50,000 URL chunks with a master sitemap index to respect Google's crawl budget.
3688
+ - **Dynamic \`/llms.txt\` Feed:** High-density Markdown stream enabling direct indexing by ChatGPT Search & Perplexity.
3689
+
3690
+ ---
3691
+
3692
+ ### \uD83D\uDEE0️ 4. AI AGENT IMPLEMENTATION PROTOCOL (STEP-BY-STEP)
3693
+
3694
+ When setting up programmatic SEO in any codebase, the AI Agent MUST generate these exact 4 files:
3695
+
3696
+ #### File 1: Configuration & Dataset (\`lib/seo.ts\`)
3697
+ \`\`\`typescript
3698
+ import { PseoMatrixEngine } from "@lynxflow/seo-engine";
3699
+
3700
+ export const matrixEngine = new PseoMatrixEngine();
3701
+
3702
+ export const SEO_CONFIG = {
3703
+ brandName: "Acme",
3704
+ language: "en",
3705
+ minPopulationToIndex: 15_000,
3706
+ };
3707
+
3708
+ // Discovered EXCLUSIVELY from Frontend UI components
3709
+ export const PSEO_DATASET = {
3710
+ services: [
3711
+ // 1 per major frontend feature branch
3712
+ { slug: "crm-pipeline", name: "Visual CRM Pipeline", category: "Sales", keyFeatures: ["Kanban", "Lead scoring"], description: "Visual deal tracking" },
3713
+ ],
3714
+ targets: [
3715
+ { slug: "law-firms", name: "Law Firms", type: "industry", painPoints: ["Billing"], benefits: ["Compliance"] },
3716
+ ],
3717
+ integrations: [
3718
+ { slug: "shopify", name: "Shopify", category: "E-Commerce", syncFeatures: ["Order sync"] },
3719
+ ],
3720
+ templates: [
3721
+ { slug: "sales-tracker-excel", title: "Sales Tracker", topic: "Sales", format: "excel", benefits: ["Instant setup"] },
3722
+ ],
3723
+ glossaryTerms: [
3724
+ { slug: "mrr", term: "MRR", shortDefinition: "Monthly Recurring Revenue" },
3725
+ ],
3726
+ };
3727
+ \`\`\`
3728
+
3729
+ #### File 2: Universal Dynamic Catch-All Route (\`app/[...slug]/page.tsx\`)
3730
+ \`\`\`tsx
3731
+ import { notFound } from "next/navigation";
3732
+ import { matrixEngine, SEO_CONFIG, PSEO_DATASET } from "@/lib/seo";
3733
+
3734
+ export async function generateMetadata({ params }: { params: { slug: string[] } }) {
3735
+ const path = "/" + params.slug.join("/");
3736
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
3737
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
3738
+ const page = pages.find((p) => p.urlPath === path);
3739
+ if (!page) return {};
3740
+ return { title: page.title, description: page.description, alternates: { canonical: page.canonicalUrl }, robots: page.robots };
3741
+ }
3742
+
3743
+ export default async function ProgrammaticPage({ params }: { params: { slug: string[] } }) {
3744
+ const path = "/" + params.slug.join("/");
3745
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
3746
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
3747
+ const page = pages.find((p) => p.urlPath === path);
3748
+ if (!page) notFound();
3749
+
3750
+ return (
3751
+ <article className="max-w-4xl mx-auto py-12 px-6">
3752
+ <script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(page.schemaGraph) }} />
3753
+ <h1 className="text-4xl font-extrabold">{page.h1}</h1>
3754
+ <p className="mt-4 text-xl text-gray-600">{page.description}</p>
3755
+ {page.disclaimerText && <aside className="mt-8 p-4 bg-gray-50 border rounded text-xs text-gray-500">{page.disclaimerText}</aside>}
3756
+ </article>
3757
+ );
3758
+ }
3759
+ \`\`\`
3760
+
3761
+ #### File 3: Dynamic XML Sitemap (\`app/sitemap.ts\`)
3762
+ \`\`\`typescript
3763
+ import { MetadataRoute } from "next";
3764
+ import { matrixEngine, SEO_CONFIG, PSEO_DATASET } from "@/lib/seo";
3765
+
3766
+ export default function sitemap(): MetadataRoute.Sitemap {
3767
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
3768
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
3769
+ return pages.filter((p) => p.robots.includes("index")).map((p) => ({
3770
+ url: p.canonicalUrl,
3771
+ lastModified: new Date(),
3772
+ changeFrequency: "weekly",
3773
+ priority: 0.8,
3774
+ }));
3775
+ }
3776
+ \`\`\`
3777
+
3778
+ #### File 4: Dynamic AI Search Markdown Feed (\`app/llms.txt/route.ts\`)
3779
+ \`\`\`typescript
3780
+ import { NextResponse } from "next/server";
3781
+ import { matrixEngine, SEO_CONFIG, PSEO_DATASET } from "@/lib/seo";
3782
+
3783
+ export async function GET() {
3784
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
3785
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
3786
+ const markdown = [
3787
+ \`# \${SEO_CONFIG.brandName} Solutions Index\`,
3788
+ \`> Structured knowledge feed for LLMs and AI search engines (ChatGPT, Perplexity).\`,
3789
+ \`\`,
3790
+ \`## Solutions & Matrices\`,
3791
+ ...pages.map((p) => \`- [\${p.h1}](\${p.canonicalUrl}): \${p.description}\`),
3792
+ ].join("\\n");
3793
+ return new NextResponse(markdown, { headers: { "Content-Type": "text/plain; charset=utf-8" } });
3794
+ }
3795
+ \`\`\`
3796
+
3797
+ ---
3798
+
3799
+ ### \uD83C\uDFDB️ 5. MATRIX ARCHITECTURE: 10 ROOT PILLARS & 50+ SPECIALIZED SUB-MATRICES
3670
3800
 
3671
3801
  1. **10 Canonical Root Pillars:**
3672
3802
  - Comparisons: \`/vs/{competitor}\`
@@ -3691,7 +3821,7 @@ When discovering or listing product modules, features, or services to build the
3691
3821
 
3692
3822
  ---
3693
3823
 
3694
- ### \uD83E\uDDF9 4. URL SLUG INTEGRITY & SCHEMA.ORG
3824
+ ### \uD83E\uDDF9 6. URL SLUG INTEGRITY & SCHEMA.ORG
3695
3825
 
3696
3826
  - Use \`cleanSeoSlug(text, { language })\` to strip accents, dates, and stop words.
3697
3827
  - Use \`ExtendedSchemaGraphBuilder\` to output valid JSON-LD graphs (\`SoftwareApplication\`, \`LocalBusiness\`, \`HowTo\`, \`FAQPage\`, \`BreadcrumbList\`, \`Organization\`).
package/dist/index.mjs CHANGED
@@ -3551,10 +3551,10 @@ When discovering or listing product modules, features, or services to build the
3551
3551
  - DO NOT create programmatic pages for internal plumbing like: \`/api/stripe\`, \`/api/resend\`, \`/api/auth\`, \`/api/d1\`, \`/api/webhooks\`, \`/api/openai\`.
3552
3552
  - DO NOT expose internal infrastructure, vendors, or suppliers (e.g. Stripe, Resend, Cloudflare D1, Better-Auth, Supabase, PostgreSQL drivers) as public product features. End users never search for or buy your internal backend plumbing.
3553
3553
  - **✅ ALWAYS inspect the FRONTEND user-facing interface & commercial value propositions:**
3554
- - Read marketing navigation menus & dropdowns (\`components/Navbar.tsx\`, \`components/Header.tsx\`, \`components/Navigation.tsx\`).
3555
- - Read marketing feature pages & pricing tiers (\`app/(marketing)/*\`, \`pages/features/*\`, \`app/pricing/*\`).
3556
- - Read dashboard UI workflows & user modules (\`components/dashboard/*\`, \`components/sidebar/*\`).
3557
- - Identify the actual **benefits and tools the end-user buys** (e.g. "Visual Pipeline Kanban", "Automated Invoice Tracking", "Electronic Signature", "Real-Time Client Portal", "Custom Reporting").
3554
+ - **Step 1A - Marketing Navbars & Dropdowns:** Scan \`components/Navbar.tsx\`, \`components/Header.tsx\`, \`components/Navigation.tsx\` to list all primary product modules.
3555
+ - **Step 1B - Marketing Feature Pages & Pricing:** Scan \`app/(marketing)/*\`, \`pages/features/*\`, \`app/pricing/*\` to list commercial feature names and pricing tiers.
3556
+ - **Step 1C - Dashboard Navigation & User Tools:** Scan \`components/dashboard/*\`, \`components/sidebar/*\` to find actual user workflows.
3557
+ - **Step 1D - Extraction Requirement:** For EACH discovered module (or major product branch), create at least 1 programmatic service entry with \`slug\`, \`name\`, \`category\`, \`description\`, \`keyFeatures\`, and \`priceMonthly\`.
3558
3558
 
3559
3559
  ---
3560
3560
 
@@ -3568,7 +3568,137 @@ When discovering or listing product modules, features, or services to build the
3568
3568
 
3569
3569
  ---
3570
3570
 
3571
- ### \uD83C\uDFDB️ 3. MATRIX ARCHITECTURE: 10 ROOT PILLARS & 50+ SPECIALIZED SUB-MATRICES
3571
+ ### \uD83C\uDFC6 3. THE ARCHITECTURAL PLAYBOOK OF SAAS TITANS (7M+ PAGES WITH 0 DB BOTTLENECKS)
3572
+
3573
+ How category leaders generate millions of high-converting pages without server saturation:
3574
+
3575
+ 1. **Proven Formulas of SaaS Giants:**
3576
+ - ⚡ **Zapier (~25 Million pages):** \`App A × App B\` (e.g. "Connect WhatsApp to Shopify", "Sync Sheets with Notion").
3577
+ - \uD83C\uDFA8 **Canva (~50 Million pages):** \`Template Type × Industry/Theme × Format × Locale\` (e.g. "Restaurant Menu Italian A4").
3578
+ - \uD83D\uDCB8 **Wise (~15 Million pages):** \`Currency Pair × Country × Dynamic Rate Calculator\`.
3579
+ - \uD83D\uDCCA **G2 & Capterra (~10 Million pages):** \`App A vs App B\` / \`Alternative to App X for [Role]\`.
3580
+
3581
+ 2. **The 4 Pillars of Zero-Latency (< 0.05ms) Resolution:**
3582
+ - **0 Bytes in Database:** Never generate physical static files or query heavy databases per request. Pages are resolved mathematically in RAM upon arrival.
3583
+ - **1 Single Universal Catch-All Route:** \`app/[...slug]/page.tsx\` (or \`app/[locale]/[...slug]/page.tsx\`) handles all matrices through one lightweight layout.
3584
+ - **Edge Caching & ISR:** The rendered HTML is instantly cached at the CDN/Edge (Cloudflare / Vercel Edge) on first request.
3585
+ - **Automatic Siloing & Mesh Linking:**
3586
+ - Links to 3 neighboring geographic cities for the same service.
3587
+ - Links to 4 related professions/industries in the same target category.
3588
+ - Complete Schema.org BreadcrumbList navigation.
3589
+ - **Sharded XML Sitemaps:** Split into 50,000 URL chunks with a master sitemap index to respect Google's crawl budget.
3590
+ - **Dynamic \`/llms.txt\` Feed:** High-density Markdown stream enabling direct indexing by ChatGPT Search & Perplexity.
3591
+
3592
+ ---
3593
+
3594
+ ### \uD83D\uDEE0️ 4. AI AGENT IMPLEMENTATION PROTOCOL (STEP-BY-STEP)
3595
+
3596
+ When setting up programmatic SEO in any codebase, the AI Agent MUST generate these exact 4 files:
3597
+
3598
+ #### File 1: Configuration & Dataset (\`lib/seo.ts\`)
3599
+ \`\`\`typescript
3600
+ import { PseoMatrixEngine } from "@lynxflow/seo-engine";
3601
+
3602
+ export const matrixEngine = new PseoMatrixEngine();
3603
+
3604
+ export const SEO_CONFIG = {
3605
+ brandName: "Acme",
3606
+ language: "en",
3607
+ minPopulationToIndex: 15_000,
3608
+ };
3609
+
3610
+ // Discovered EXCLUSIVELY from Frontend UI components
3611
+ export const PSEO_DATASET = {
3612
+ services: [
3613
+ // 1 per major frontend feature branch
3614
+ { slug: "crm-pipeline", name: "Visual CRM Pipeline", category: "Sales", keyFeatures: ["Kanban", "Lead scoring"], description: "Visual deal tracking" },
3615
+ ],
3616
+ targets: [
3617
+ { slug: "law-firms", name: "Law Firms", type: "industry", painPoints: ["Billing"], benefits: ["Compliance"] },
3618
+ ],
3619
+ integrations: [
3620
+ { slug: "shopify", name: "Shopify", category: "E-Commerce", syncFeatures: ["Order sync"] },
3621
+ ],
3622
+ templates: [
3623
+ { slug: "sales-tracker-excel", title: "Sales Tracker", topic: "Sales", format: "excel", benefits: ["Instant setup"] },
3624
+ ],
3625
+ glossaryTerms: [
3626
+ { slug: "mrr", term: "MRR", shortDefinition: "Monthly Recurring Revenue" },
3627
+ ],
3628
+ };
3629
+ \`\`\`
3630
+
3631
+ #### File 2: Universal Dynamic Catch-All Route (\`app/[...slug]/page.tsx\`)
3632
+ \`\`\`tsx
3633
+ import { notFound } from "next/navigation";
3634
+ import { matrixEngine, SEO_CONFIG, PSEO_DATASET } from "@/lib/seo";
3635
+
3636
+ export async function generateMetadata({ params }: { params: { slug: string[] } }) {
3637
+ const path = "/" + params.slug.join("/");
3638
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
3639
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
3640
+ const page = pages.find((p) => p.urlPath === path);
3641
+ if (!page) return {};
3642
+ return { title: page.title, description: page.description, alternates: { canonical: page.canonicalUrl }, robots: page.robots };
3643
+ }
3644
+
3645
+ export default async function ProgrammaticPage({ params }: { params: { slug: string[] } }) {
3646
+ const path = "/" + params.slug.join("/");
3647
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
3648
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
3649
+ const page = pages.find((p) => p.urlPath === path);
3650
+ if (!page) notFound();
3651
+
3652
+ return (
3653
+ <article className="max-w-4xl mx-auto py-12 px-6">
3654
+ <script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(page.schemaGraph) }} />
3655
+ <h1 className="text-4xl font-extrabold">{page.h1}</h1>
3656
+ <p className="mt-4 text-xl text-gray-600">{page.description}</p>
3657
+ {page.disclaimerText && <aside className="mt-8 p-4 bg-gray-50 border rounded text-xs text-gray-500">{page.disclaimerText}</aside>}
3658
+ </article>
3659
+ );
3660
+ }
3661
+ \`\`\`
3662
+
3663
+ #### File 3: Dynamic XML Sitemap (\`app/sitemap.ts\`)
3664
+ \`\`\`typescript
3665
+ import { MetadataRoute } from "next";
3666
+ import { matrixEngine, SEO_CONFIG, PSEO_DATASET } from "@/lib/seo";
3667
+
3668
+ export default function sitemap(): MetadataRoute.Sitemap {
3669
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
3670
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
3671
+ return pages.filter((p) => p.robots.includes("index")).map((p) => ({
3672
+ url: p.canonicalUrl,
3673
+ lastModified: new Date(),
3674
+ changeFrequency: "weekly",
3675
+ priority: 0.8,
3676
+ }));
3677
+ }
3678
+ \`\`\`
3679
+
3680
+ #### File 4: Dynamic AI Search Markdown Feed (\`app/llms.txt/route.ts\`)
3681
+ \`\`\`typescript
3682
+ import { NextResponse } from "next/server";
3683
+ import { matrixEngine, SEO_CONFIG, PSEO_DATASET } from "@/lib/seo";
3684
+
3685
+ export async function GET() {
3686
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
3687
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
3688
+ const markdown = [
3689
+ \`# \${SEO_CONFIG.brandName} Solutions Index\`,
3690
+ \`> Structured knowledge feed for LLMs and AI search engines (ChatGPT, Perplexity).\`,
3691
+ \`\`,
3692
+ \`## Solutions & Matrices\`,
3693
+ ...pages.map((p) => \`- [\${p.h1}](\${p.canonicalUrl}): \${p.description}\`),
3694
+ ].join("\\n");
3695
+ return new NextResponse(markdown, { headers: { "Content-Type": "text/plain; charset=utf-8" } });
3696
+ }
3697
+ \`\`\`
3698
+
3699
+ ---
3700
+
3701
+ ### \uD83C\uDFDB️ 5. MATRIX ARCHITECTURE: 10 ROOT PILLARS & 50+ SPECIALIZED SUB-MATRICES
3572
3702
 
3573
3703
  1. **10 Canonical Root Pillars:**
3574
3704
  - Comparisons: \`/vs/{competitor}\`
@@ -3593,7 +3723,7 @@ When discovering or listing product modules, features, or services to build the
3593
3723
 
3594
3724
  ---
3595
3725
 
3596
- ### \uD83E\uDDF9 4. URL SLUG INTEGRITY & SCHEMA.ORG
3726
+ ### \uD83E\uDDF9 6. URL SLUG INTEGRITY & SCHEMA.ORG
3597
3727
 
3598
3728
  - Use \`cleanSeoSlug(text, { language })\` to strip accents, dates, and stop words.
3599
3729
  - Use \`ExtendedSchemaGraphBuilder\` to output valid JSON-LD graphs (\`SoftwareApplication\`, \`LocalBusiness\`, \`HowTo\`, \`FAQPage\`, \`BreadcrumbList\`, \`Organization\`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynxflow/seo-engine",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "High-Performance Multilingual Programmatic SEO & AI Search Engine SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/src/llm-prompt.ts CHANGED
@@ -17,10 +17,10 @@ When discovering or listing product modules, features, or services to build the
17
17
  - DO NOT create programmatic pages for internal plumbing like: \`/api/stripe\`, \`/api/resend\`, \`/api/auth\`, \`/api/d1\`, \`/api/webhooks\`, \`/api/openai\`.
18
18
  - DO NOT expose internal infrastructure, vendors, or suppliers (e.g. Stripe, Resend, Cloudflare D1, Better-Auth, Supabase, PostgreSQL drivers) as public product features. End users never search for or buy your internal backend plumbing.
19
19
  - **✅ ALWAYS inspect the FRONTEND user-facing interface & commercial value propositions:**
20
- - Read marketing navigation menus & dropdowns (\`components/Navbar.tsx\`, \`components/Header.tsx\`, \`components/Navigation.tsx\`).
21
- - Read marketing feature pages & pricing tiers (\`app/(marketing)/*\`, \`pages/features/*\`, \`app/pricing/*\`).
22
- - Read dashboard UI workflows & user modules (\`components/dashboard/*\`, \`components/sidebar/*\`).
23
- - Identify the actual **benefits and tools the end-user buys** (e.g. "Visual Pipeline Kanban", "Automated Invoice Tracking", "Electronic Signature", "Real-Time Client Portal", "Custom Reporting").
20
+ - **Step 1A - Marketing Navbars & Dropdowns:** Scan \`components/Navbar.tsx\`, \`components/Header.tsx\`, \`components/Navigation.tsx\` to list all primary product modules.
21
+ - **Step 1B - Marketing Feature Pages & Pricing:** Scan \`app/(marketing)/*\`, \`pages/features/*\`, \`app/pricing/*\` to list commercial feature names and pricing tiers.
22
+ - **Step 1C - Dashboard Navigation & User Tools:** Scan \`components/dashboard/*\`, \`components/sidebar/*\` to find actual user workflows.
23
+ - **Step 1D - Extraction Requirement:** For EACH discovered module (or major product branch), create at least 1 programmatic service entry with \`slug\`, \`name\`, \`category\`, \`description\`, \`keyFeatures\`, and \`priceMonthly\`.
24
24
 
25
25
  ---
26
26
 
@@ -34,7 +34,137 @@ When discovering or listing product modules, features, or services to build the
34
34
 
35
35
  ---
36
36
 
37
- ### 🏛️ 3. MATRIX ARCHITECTURE: 10 ROOT PILLARS & 50+ SPECIALIZED SUB-MATRICES
37
+ ### 🏆 3. THE ARCHITECTURAL PLAYBOOK OF SAAS TITANS (7M+ PAGES WITH 0 DB BOTTLENECKS)
38
+
39
+ How category leaders generate millions of high-converting pages without server saturation:
40
+
41
+ 1. **Proven Formulas of SaaS Giants:**
42
+ - ⚡ **Zapier (~25 Million pages):** \`App A × App B\` (e.g. "Connect WhatsApp to Shopify", "Sync Sheets with Notion").
43
+ - 🎨 **Canva (~50 Million pages):** \`Template Type × Industry/Theme × Format × Locale\` (e.g. "Restaurant Menu Italian A4").
44
+ - 💸 **Wise (~15 Million pages):** \`Currency Pair × Country × Dynamic Rate Calculator\`.
45
+ - 📊 **G2 & Capterra (~10 Million pages):** \`App A vs App B\` / \`Alternative to App X for [Role]\`.
46
+
47
+ 2. **The 4 Pillars of Zero-Latency (< 0.05ms) Resolution:**
48
+ - **0 Bytes in Database:** Never generate physical static files or query heavy databases per request. Pages are resolved mathematically in RAM upon arrival.
49
+ - **1 Single Universal Catch-All Route:** \`app/[...slug]/page.tsx\` (or \`app/[locale]/[...slug]/page.tsx\`) handles all matrices through one lightweight layout.
50
+ - **Edge Caching & ISR:** The rendered HTML is instantly cached at the CDN/Edge (Cloudflare / Vercel Edge) on first request.
51
+ - **Automatic Siloing & Mesh Linking:**
52
+ - Links to 3 neighboring geographic cities for the same service.
53
+ - Links to 4 related professions/industries in the same target category.
54
+ - Complete Schema.org BreadcrumbList navigation.
55
+ - **Sharded XML Sitemaps:** Split into 50,000 URL chunks with a master sitemap index to respect Google's crawl budget.
56
+ - **Dynamic \`/llms.txt\` Feed:** High-density Markdown stream enabling direct indexing by ChatGPT Search & Perplexity.
57
+
58
+ ---
59
+
60
+ ### 🛠️ 4. AI AGENT IMPLEMENTATION PROTOCOL (STEP-BY-STEP)
61
+
62
+ When setting up programmatic SEO in any codebase, the AI Agent MUST generate these exact 4 files:
63
+
64
+ #### File 1: Configuration & Dataset (\`lib/seo.ts\`)
65
+ \`\`\`typescript
66
+ import { PseoMatrixEngine } from "@lynxflow/seo-engine";
67
+
68
+ export const matrixEngine = new PseoMatrixEngine();
69
+
70
+ export const SEO_CONFIG = {
71
+ brandName: "Acme",
72
+ language: "en",
73
+ minPopulationToIndex: 15_000,
74
+ };
75
+
76
+ // Discovered EXCLUSIVELY from Frontend UI components
77
+ export const PSEO_DATASET = {
78
+ services: [
79
+ // 1 per major frontend feature branch
80
+ { slug: "crm-pipeline", name: "Visual CRM Pipeline", category: "Sales", keyFeatures: ["Kanban", "Lead scoring"], description: "Visual deal tracking" },
81
+ ],
82
+ targets: [
83
+ { slug: "law-firms", name: "Law Firms", type: "industry", painPoints: ["Billing"], benefits: ["Compliance"] },
84
+ ],
85
+ integrations: [
86
+ { slug: "shopify", name: "Shopify", category: "E-Commerce", syncFeatures: ["Order sync"] },
87
+ ],
88
+ templates: [
89
+ { slug: "sales-tracker-excel", title: "Sales Tracker", topic: "Sales", format: "excel", benefits: ["Instant setup"] },
90
+ ],
91
+ glossaryTerms: [
92
+ { slug: "mrr", term: "MRR", shortDefinition: "Monthly Recurring Revenue" },
93
+ ],
94
+ };
95
+ \`\`\`
96
+
97
+ #### File 2: Universal Dynamic Catch-All Route (\`app/[...slug]/page.tsx\`)
98
+ \`\`\`tsx
99
+ import { notFound } from "next/navigation";
100
+ import { matrixEngine, SEO_CONFIG, PSEO_DATASET } from "@/lib/seo";
101
+
102
+ export async function generateMetadata({ params }: { params: { slug: string[] } }) {
103
+ const path = "/" + params.slug.join("/");
104
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
105
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
106
+ const page = pages.find((p) => p.urlPath === path);
107
+ if (!page) return {};
108
+ return { title: page.title, description: page.description, alternates: { canonical: page.canonicalUrl }, robots: page.robots };
109
+ }
110
+
111
+ export default async function ProgrammaticPage({ params }: { params: { slug: string[] } }) {
112
+ const path = "/" + params.slug.join("/");
113
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
114
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
115
+ const page = pages.find((p) => p.urlPath === path);
116
+ if (!page) notFound();
117
+
118
+ return (
119
+ <article className="max-w-4xl mx-auto py-12 px-6">
120
+ <script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(page.schemaGraph) }} />
121
+ <h1 className="text-4xl font-extrabold">{page.h1}</h1>
122
+ <p className="mt-4 text-xl text-gray-600">{page.description}</p>
123
+ {page.disclaimerText && <aside className="mt-8 p-4 bg-gray-50 border rounded text-xs text-gray-500">{page.disclaimerText}</aside>}
124
+ </article>
125
+ );
126
+ }
127
+ \`\`\`
128
+
129
+ #### File 3: Dynamic XML Sitemap (\`app/sitemap.ts\`)
130
+ \`\`\`typescript
131
+ import { MetadataRoute } from "next";
132
+ import { matrixEngine, SEO_CONFIG, PSEO_DATASET } from "@/lib/seo";
133
+
134
+ export default function sitemap(): MetadataRoute.Sitemap {
135
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
136
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
137
+ return pages.filter((p) => p.robots.includes("index")).map((p) => ({
138
+ url: p.canonicalUrl,
139
+ lastModified: new Date(),
140
+ changeFrequency: "weekly",
141
+ priority: 0.8,
142
+ }));
143
+ }
144
+ \`\`\`
145
+
146
+ #### File 4: Dynamic AI Search Markdown Feed (\`app/llms.txt/route.ts\`)
147
+ \`\`\`typescript
148
+ import { NextResponse } from "next/server";
149
+ import { matrixEngine, SEO_CONFIG, PSEO_DATASET } from "@/lib/seo";
150
+
151
+ export async function GET() {
152
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
153
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
154
+ const markdown = [
155
+ \`# \${SEO_CONFIG.brandName} Solutions Index\`,
156
+ \`> Structured knowledge feed for LLMs and AI search engines (ChatGPT, Perplexity).\`,
157
+ \`\`,
158
+ \`## Solutions & Matrices\`,
159
+ ...pages.map((p) => \`- [\${p.h1}](\${p.canonicalUrl}): \${p.description}\`),
160
+ ].join("\\n");
161
+ return new NextResponse(markdown, { headers: { "Content-Type": "text/plain; charset=utf-8" } });
162
+ }
163
+ \`\`\`
164
+
165
+ ---
166
+
167
+ ### 🏛️ 5. MATRIX ARCHITECTURE: 10 ROOT PILLARS & 50+ SPECIALIZED SUB-MATRICES
38
168
 
39
169
  1. **10 Canonical Root Pillars:**
40
170
  - Comparisons: \`/vs/{competitor}\`
@@ -59,7 +189,7 @@ When discovering or listing product modules, features, or services to build the
59
189
 
60
190
  ---
61
191
 
62
- ### 🧹 4. URL SLUG INTEGRITY & SCHEMA.ORG
192
+ ### 🧹 6. URL SLUG INTEGRITY & SCHEMA.ORG
63
193
 
64
194
  - Use \`cleanSeoSlug(text, { language })\` to strip accents, dates, and stop words.
65
195
  - Use \`ExtendedSchemaGraphBuilder\` to output valid JSON-LD graphs (\`SoftwareApplication\`, \`LocalBusiness\`, \`HowTo\`, \`FAQPage\`, \`BreadcrumbList\`, \`Organization\`).