# bobsite1122-boop/imd-app-pk architecture

> Architecture diagram of the GitHub repository bobsite1122-boop/imd-app-pk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bobsite1122-boop/imd-app-pk
- Repository: https://github.com/bobsite1122-boop/imd-app-pk

## Overview

This is a Next.js marketing and content-management site for iMD App subscriptions. Visitors browse subscription plans, FAQs, installation guidance, and learning resources; administrators edit the content that powers those pages. The graph separates public content, admin workflows, CMS persistence, and SEO/contact support. Source-index references establish many page-to-module links, while sampled CMS code confirms validation and Supabase access. Admin editor-to-update-endpoint wiring is not shown, so those links are omitted.

Main entry points: [`lib/seo/json-ld.ts`](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/seo/json-ld.ts) (Structured Data), [`lib/cms/reader.ts`](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/cms/reader.ts) (CMS Reader), [`lib/cms/write.ts`](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/cms/write.ts) (CMS Writer), [`lib/seo/metadata.ts`](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/seo/metadata.ts) (Page Metadata)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public Site"]
  node_home["Home Page<br/>[page.tsx]"]
  node_planspage["Plan Details<br/>[page.tsx]"]
  node_faqpage["FAQ Page<br/>[page.tsx]"]
  node_installpage["Install Guide<br/>[page.tsx]"]
  node_resourcespage["Resource Catalog<br/>[page.tsx]"]
end

subgraph group_admin["Admin CMS"]
  node_adminlogin["Admin Login<br/>[page.tsx]"]
  node_auth["Credential Auth<br/>[auth.ts]"]
  node_adminpages["CMS Editor Pages"]
  node_editors["Content Editors"]
  node_updateapis["Content Update APIs<br/>[route.ts]"]
  node_seedapi["Seed API<br/>[route.ts]"]
  node_aieditapi["AI Edit API<br/>[route.ts]"]
end

subgraph group_cms["Content Data"]
  node_validation["Content Schemas<br/>[schemas.ts]"]
  node_reader["CMS Reader<br/>[reader.ts]"]
  node_writer["CMS Writer<br/>[write.ts]"]
  node_supabase[("Supabase CMS Store<br/>[server.ts]")]
end

subgraph group_support["SEO &amp; Contact"]
  node_planlogic["Plan Enrichment<br/>[plans.ts]"]
  node_contact["Contact Settings<br/>[contact.ts]"]
  node_faqcontent["FAQ Answers<br/>[faq-answers.tsx]"]
  node_metadata["Page Metadata<br/>[metadata.ts]"]
  node_structureddata["Structured Data<br/>[json-ld.ts]"]
  node_seoplans["Plan SEO<br/>[plans.ts]"]
end

node_visitor(("Site Visitor"))
node_adminuser(("Administrator"))

node_visitor -->|"browses"| node_home
node_visitor -->|"views plans"| node_planspage
node_visitor -->|"reads answers"| node_faqpage
node_visitor -->|"gets instructions"| node_installpage
node_visitor -->|"browses resources"| node_resourcespage
node_home -->|"loads plans"| node_planlogic
node_planlogic -->|"reads pricing"| node_reader
node_planlogic -->|"builds contact links"| node_contact
node_faqpage -->|"loads FAQ answers"| node_faqcontent
node_faqcontent -->|"uses contact links"| node_contact
node_resourcespage -->|"builds metadata"| node_metadata
node_resourcespage -->|"builds JSON-LD"| node_structureddata
node_faqpage -->|"builds metadata"| node_metadata
node_faqpage -->|"builds JSON-LD"| node_structureddata
node_installpage -->|"builds metadata"| node_metadata
node_installpage -->|"builds JSON-LD"| node_structureddata
node_home -->|"builds metadata"| node_metadata
node_home -->|"builds JSON-LD"| node_structureddata
node_planspage -->|"loads plan data"| node_planlogic
node_planspage -->|"builds metadata"| node_metadata
node_planspage -->|"builds JSON-LD"| node_structureddata
node_structureddata -->|"parses plan prices"| node_seoplans
node_adminuser -->|"signs in"| node_adminlogin
node_adminlogin -.->|"authenticates"| node_auth
node_adminpages -->|"renders editors"| node_editors
node_adminpages -->|"loads CMS content"| node_reader
node_updateapis -->|"checks session"| node_auth
node_updateapis -->|"validates content"| node_validation
node_updateapis -->|"writes content"| node_writer
node_seedapi -->|"checks session"| node_auth
node_seedapi -->|"seeds content"| node_writer
node_aieditapi -->|"checks session"| node_auth
node_aieditapi -->|"validates content"| node_validation
node_aieditapi -->|"reads content"| node_reader
node_aieditapi -->|"writes content"| node_writer
node_reader -->|"validates content"| node_validation
node_reader -->|"reads records"| node_supabase
node_writer -->|"validates content"| node_validation
node_writer -->|"upserts records"| node_supabase

click node_home "https://github.com/bobsite1122-boop/imd-app-pk/blob/main/app/(site)/page.tsx"
click node_planspage "https://github.com/bobsite1122-boop/imd-app-pk/blob/main/app/(site)/plans/%5Bslug%5D/page.tsx"
click node_faqpage "https://github.com/bobsite1122-boop/imd-app-pk/blob/main/app/(site)/faqs/page.tsx"
click node_installpage "https://github.com/bobsite1122-boop/imd-app-pk/blob/main/app/(site)/install/page.tsx"
click node_resourcespage "https://github.com/bobsite1122-boop/imd-app-pk/blob/main/app/(site)/databases/page.tsx"
click node_planlogic "https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/plans.ts"
click node_contact "https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/contact.ts"
click node_faqcontent "https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/faq-answers.tsx"
click node_metadata "https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/seo/metadata.ts"
click node_structureddata "https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/seo/json-ld.ts"
click node_seoplans "https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/seo/plans.ts"
click node_adminlogin "https://github.com/bobsite1122-boop/imd-app-pk/blob/main/app/admin/login/page.tsx"
click node_auth "https://github.com/bobsite1122-boop/imd-app-pk/blob/main/auth.ts"
click node_adminpages "https://github.com/bobsite1122-boop/imd-app-pk/tree/main/app/admin/(protected)"
click node_editors "https://github.com/bobsite1122-boop/imd-app-pk/tree/main/components/admin"
click node_updateapis "https://github.com/bobsite1122-boop/imd-app-pk/blob/main/app/api/update-install/route.ts"
click node_seedapi "https://github.com/bobsite1122-boop/imd-app-pk/blob/main/app/api/admin/seed/route.ts"
click node_aieditapi "https://github.com/bobsite1122-boop/imd-app-pk/blob/main/app/api/admin/ai-edit/route.ts"
click node_validation "https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/cms/schemas.ts"
click node_reader "https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/cms/reader.ts"
click node_writer "https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/cms/write.ts"
click node_supabase "https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/supabase/server.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_home,node_planspage,node_faqpage,node_installpage,node_resourcespage toneBlue
class node_adminlogin,node_auth,node_adminpages,node_editors,node_updateapis,node_seedapi,node_aieditapi toneAmber
class node_validation,node_reader,node_writer,node_supabase toneMint
class node_planlogic,node_contact,node_faqcontent,node_metadata,node_structureddata,node_seoplans toneRose
class node_visitor,node_adminuser toneIndigo
```

## Components

### Public Site

- [Home Page](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/app/(site)/page.tsx): `app/(site)/page.tsx`
- [Plan Details](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/app/(site)/plans/%5Bslug%5D/page.tsx): `app/(site)/plans/[slug]/page.tsx`
- [FAQ Page](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/app/(site)/faqs/page.tsx): `app/(site)/faqs/page.tsx`
- [Install Guide](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/app/(site)/install/page.tsx): `app/(site)/install/page.tsx`
- [Resource Catalog](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/app/(site)/databases/page.tsx): `app/(site)/databases/page.tsx`

### Admin CMS

- [Admin Login](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/app/admin/login/page.tsx): `app/admin/login/page.tsx`
- [Credential Auth](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/auth.ts): `auth.ts`
- [CMS Editor Pages](https://github.com/bobsite1122-boop/imd-app-pk/tree/main/app/admin/(protected)): `app/admin/(protected)`
- [Content Editors](https://github.com/bobsite1122-boop/imd-app-pk/tree/main/components/admin): `components/admin`
- [Content Update APIs](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/app/api/update-install/route.ts): `app/api/update-install/route.ts`
- [Seed API](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/app/api/admin/seed/route.ts): `app/api/admin/seed/route.ts`
- [AI Edit API](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/app/api/admin/ai-edit/route.ts): `app/api/admin/ai-edit/route.ts`

### Content Data

- [Content Schemas](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/cms/schemas.ts): `lib/cms/schemas.ts`
- [CMS Reader](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/cms/reader.ts): `lib/cms/reader.ts`
- [CMS Writer](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/cms/write.ts): `lib/cms/write.ts`
- [Supabase CMS Store](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/supabase/server.ts): `lib/supabase/server.ts`

### SEO & Contact

- [Plan Enrichment](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/plans.ts): `lib/plans.ts`
- [Contact Settings](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/contact.ts): `lib/contact.ts`
- [FAQ Answers](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/faq-answers.tsx): `lib/faq-answers.tsx`
- [Page Metadata](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/seo/metadata.ts): `lib/seo/metadata.ts`
- [Structured Data](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/seo/json-ld.ts): `lib/seo/json-ld.ts`
- [Plan SEO](https://github.com/bobsite1122-boop/imd-app-pk/blob/main/lib/seo/plans.ts): `lib/seo/plans.ts`

### Other components

- **Site Visitor**
- **Administrator**

## Connections

- Site Visitor → Home Page: browses (evidence: `app/(site)/page.tsx`)
- Site Visitor → Plan Details: views plans (evidence: `app/(site)/plans/[slug]/page.tsx`)
- Site Visitor → FAQ Page: reads answers (evidence: `app/(site)/faqs/page.tsx`)
- Site Visitor → Install Guide: gets instructions (evidence: `app/(site)/install/page.tsx`)
- Site Visitor → Resource Catalog: browses resources (evidence: `app/(site)/databases/page.tsx`)
- Home Page → Plan Enrichment: loads plans (evidence: `app/(site)/page.tsx`)
- Plan Enrichment → CMS Reader: reads pricing (evidence: `lib/plans.ts`)
- Plan Enrichment → Contact Settings: builds contact links (evidence: `lib/plans.ts`)
- FAQ Page → FAQ Answers: loads FAQ answers (evidence: `app/(site)/faqs/page.tsx`)
- FAQ Answers → Contact Settings: uses contact links (evidence: `lib/faq-answers.tsx`)
- Resource Catalog → Page Metadata: builds metadata (evidence: `app/(site)/databases/page.tsx`)
- Resource Catalog → Structured Data: builds JSON-LD (evidence: `app/(site)/databases/page.tsx`)
- FAQ Page → Page Metadata: builds metadata (evidence: `app/(site)/faqs/page.tsx`)
- FAQ Page → Structured Data: builds JSON-LD (evidence: `app/(site)/faqs/page.tsx`)
- Install Guide → Page Metadata: builds metadata (evidence: `app/(site)/install/page.tsx`)
- Install Guide → Structured Data: builds JSON-LD (evidence: `app/(site)/install/page.tsx`)
- Home Page → Page Metadata: builds metadata (evidence: `app/(site)/page.tsx`)
- Home Page → Structured Data: builds JSON-LD (evidence: `app/(site)/page.tsx`)
- Plan Details → Plan Enrichment: loads plan data (evidence: `app/(site)/plans/[slug]/page.tsx`)
- Plan Details → Page Metadata: builds metadata (evidence: `app/(site)/plans/[slug]/page.tsx`)
- Plan Details → Structured Data: builds JSON-LD (evidence: `app/(site)/plans/[slug]/page.tsx`)
- Structured Data → Plan SEO: parses plan prices (evidence: `lib/seo/json-ld.ts`)
- Administrator → Admin Login: signs in (evidence: `app/admin/login/page.tsx`)
- Admin Login → Credential Auth: authenticates
- CMS Editor Pages → Content Editors: renders editors (evidence: `app/admin/(protected)/resources/page.tsx`)
- CMS Editor Pages → CMS Reader: loads CMS content (evidence: `app/admin/(protected)/resources/page.tsx`)
- Content Update APIs → Credential Auth: checks session (evidence: `app/api/update-install/route.ts`)
- Content Update APIs → Content Schemas: validates content (evidence: `app/api/update-install/route.ts`)
- Content Update APIs → CMS Writer: writes content (evidence: `app/api/update-install/route.ts`)
- Seed API → Credential Auth: checks session (evidence: `app/api/admin/seed/route.ts`)
- Seed API → CMS Writer: seeds content (evidence: `app/api/admin/seed/route.ts`)
- AI Edit API → Credential Auth: checks session (evidence: `app/api/admin/ai-edit/route.ts`)
- AI Edit API → Content Schemas: validates content (evidence: `app/api/admin/ai-edit/route.ts`)
- AI Edit API → CMS Reader: reads content (evidence: `app/api/admin/ai-edit/route.ts`)
- AI Edit API → CMS Writer: writes content (evidence: `app/api/admin/ai-edit/route.ts`)
- CMS Reader → Content Schemas: validates content (evidence: `lib/cms/reader.ts`)
- CMS Reader → Supabase CMS Store: reads records (evidence: `lib/cms/reader.ts`)
- CMS Writer → Content Schemas: validates content (evidence: `lib/cms/write.ts`)
- CMS Writer → Supabase CMS Store: upserts records (evidence: `lib/cms/write.ts`)
