# johnpbell7/birth-hood architecture

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

- Interactive diagram: https://gitdiagram.com/johnpbell7/birth-hood
- Repository: https://github.com/johnpbell7/birth-hood

## Overview

birth-hood is a public website for birth and parenting support, with service information, editorial content, a client resource hub and a digital shop. Visitors browse services or resources, then enquire through the contact form, follow booking links, or purchase downloads. Shop checkout uses Sanity product data and Stripe; a Stripe webhook sends download links by email, which can be served through the download route. Sanity also supplies editable pages and content. The map reflects the documented capabilities and sampled routes; unsampled page-to-query wiring is shown only where supported by the README or route structure.

Main entry points: [`lib/sanity-queries.ts`](https://github.com/johnpbell7/birth-hood/blob/main/lib/sanity-queries.ts) (Sanity Queries), [`app/api/stripe-webhook/route.ts`](https://github.com/johnpbell7/birth-hood/blob/main/app/api/stripe-webhook/route.ts) (Order Fulfilment), [`app/api/download/route.ts`](https://github.com/johnpbell7/birth-hood/blob/main/app/api/download/route.ts) (Download Handler), [`app/api/checkout/route.ts`](https://github.com/johnpbell7/birth-hood/blob/main/app/api/checkout/route.ts) (Checkout Handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public Website"]
  node_home["Home And Service Pages<br/>[page.tsx]"]
  node_service_pages["Service Pages<br/>[page.tsx]"]
  node_editorial["Blog And Stories<br/>[page.tsx]"]
  node_reviews_page["Reviews<br/>[page.tsx]"]
  node_booking["Booking Page<br/>[page.tsx]"]
end

subgraph group_content["Content Platform"]
  node_sanity_studio["Sanity Studio<br/>[page.tsx]"]
  node_cms_pages["CMS Pages<br/>[page.tsx]"]
  node_page_renderer["Page Renderer<br/>[PageRenderer.tsx]"]
  node_sanity_queries["Sanity Queries<br/>[sanity-queries.ts]"]
  node_sanity_client["Sanity Client<br/>[sanity.ts]"]
end

subgraph group_commerce["Digital Shop"]
  node_shop["Shop Interface<br/>[ShopClient.tsx]"]
  node_checkout_api["Checkout Handler<br/>[route.ts]"]
  node_webhook["Order Fulfilment<br/>[route.ts]"]
  node_download_api["Download Handler<br/>[route.ts]"]
  node_download_token["Download Tokens<br/>[download-token.ts]"]
end

subgraph group_engagement["Enquiries And Hub"]
  node_contact_form["Contact Form<br/>[ContactForm.tsx]"]
  node_contact_api["Contact Handler<br/>[route.ts]"]
  node_hub["Client Hub<br/>[HubClient.tsx]"]
end

node_visitor(("Visitor"))
node_sanity[("Sanity CMS")]
node_resend["Resend Email"]
node_stripe["Stripe"]
node_file_cdn["File CDN"]

node_visitor -->|"browses"| node_home
node_visitor -->|"browses"| node_service_pages
node_visitor -->|"reads"| node_editorial
node_visitor -->|"reads"| node_reviews_page
node_visitor -->|"books"| node_booking
node_visitor -->|"submits"| node_contact_form
node_visitor -->|"shops"| node_shop
node_visitor -->|"opens"| node_hub
node_sanity_studio -->|"edits content"| node_sanity
node_cms_pages -->|"renders blocks"| node_page_renderer
node_cms_pages -->|"loads page"| node_sanity_queries
node_sanity_queries -->|"queries via"| node_sanity_client
node_sanity_client -->|"reads"| node_sanity
node_editorial -->|"loads posts"| node_sanity_queries
node_reviews_page -->|"loads reviews"| node_sanity_queries
node_contact_form -->|"posts enquiry"| node_contact_api
node_contact_api -->|"sends emails"| node_resend
node_shop -->|"starts checkout"| node_checkout_api
node_checkout_api -->|"loads products"| node_sanity_queries
node_checkout_api -->|"creates session"| node_stripe
node_stripe -->|"dispatches event"| node_webhook
node_webhook -->|"loads purchased files"| node_sanity_queries
node_webhook -->|"signs links"| node_download_token
node_webhook -->|"emails downloads"| node_resend
node_visitor -->|"opens link"| node_download_api
node_download_api -->|"verifies token"| node_download_token
node_download_api -->|"loads file record"| node_sanity_queries
node_download_api -->|"streams file"| node_file_cdn
node_hub -->|"loads resources"| node_sanity_queries

click node_home "https://github.com/johnpbell7/birth-hood/blob/main/app/page.tsx"
click node_service_pages "https://github.com/johnpbell7/birth-hood/blob/main/app/hypnobirthing/page.tsx"
click node_editorial "https://github.com/johnpbell7/birth-hood/blob/main/app/blog/page.tsx"
click node_reviews_page "https://github.com/johnpbell7/birth-hood/blob/main/app/reviews/page.tsx"
click node_booking "https://github.com/johnpbell7/birth-hood/blob/main/app/booking/page.tsx"
click node_sanity_studio "https://github.com/johnpbell7/birth-hood/blob/main/app/(studio)/studio/%5B%5B...tool%5D%5D/page.tsx"
click node_cms_pages "https://github.com/johnpbell7/birth-hood/blob/main/app/%5Bslug%5D/page.tsx"
click node_page_renderer "https://github.com/johnpbell7/birth-hood/blob/main/components/sections/PageRenderer.tsx"
click node_sanity_queries "https://github.com/johnpbell7/birth-hood/blob/main/lib/sanity-queries.ts"
click node_sanity_client "https://github.com/johnpbell7/birth-hood/blob/main/lib/sanity.ts"
click node_contact_form "https://github.com/johnpbell7/birth-hood/blob/main/app/contact/ContactForm.tsx"
click node_contact_api "https://github.com/johnpbell7/birth-hood/blob/main/app/api/contact/route.ts"
click node_hub "https://github.com/johnpbell7/birth-hood/blob/main/app/hub/HubClient.tsx"
click node_shop "https://github.com/johnpbell7/birth-hood/blob/main/components/ShopClient.tsx"
click node_checkout_api "https://github.com/johnpbell7/birth-hood/blob/main/app/api/checkout/route.ts"
click node_webhook "https://github.com/johnpbell7/birth-hood/blob/main/app/api/stripe-webhook/route.ts"
click node_download_api "https://github.com/johnpbell7/birth-hood/blob/main/app/api/download/route.ts"
click node_download_token "https://github.com/johnpbell7/birth-hood/blob/main/lib/download-token.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_service_pages,node_editorial,node_reviews_page,node_booking toneBlue
class node_sanity_studio,node_cms_pages,node_page_renderer,node_sanity_queries,node_sanity_client,node_sanity toneAmber
class node_shop,node_checkout_api,node_webhook,node_download_api,node_download_token toneMint
class node_contact_form,node_contact_api,node_hub toneRose
class node_visitor,node_resend,node_stripe,node_file_cdn toneIndigo
```

## Components

### Public Website

- [Home And Service Pages](https://github.com/johnpbell7/birth-hood/blob/main/app/page.tsx): `app/page.tsx`
- [Service Pages](https://github.com/johnpbell7/birth-hood/blob/main/app/hypnobirthing/page.tsx): `app/hypnobirthing/page.tsx`
- [Blog And Stories](https://github.com/johnpbell7/birth-hood/blob/main/app/blog/page.tsx): `app/blog/page.tsx`
- [Reviews](https://github.com/johnpbell7/birth-hood/blob/main/app/reviews/page.tsx): `app/reviews/page.tsx`
- [Booking Page](https://github.com/johnpbell7/birth-hood/blob/main/app/booking/page.tsx): `app/booking/page.tsx`

### Content Platform

- [Sanity Studio](https://github.com/johnpbell7/birth-hood/blob/main/app/(studio)/studio/%5B%5B...tool%5D%5D/page.tsx): `app/(studio)/studio/[[...tool]]/page.tsx`
- [CMS Pages](https://github.com/johnpbell7/birth-hood/blob/main/app/%5Bslug%5D/page.tsx): `app/[slug]/page.tsx`
- [Page Renderer](https://github.com/johnpbell7/birth-hood/blob/main/components/sections/PageRenderer.tsx): `components/sections/PageRenderer.tsx`
- [Sanity Queries](https://github.com/johnpbell7/birth-hood/blob/main/lib/sanity-queries.ts): `lib/sanity-queries.ts`
- [Sanity Client](https://github.com/johnpbell7/birth-hood/blob/main/lib/sanity.ts): `lib/sanity.ts`

### Digital Shop

- [Shop Interface](https://github.com/johnpbell7/birth-hood/blob/main/components/ShopClient.tsx): `components/ShopClient.tsx`
- [Checkout Handler](https://github.com/johnpbell7/birth-hood/blob/main/app/api/checkout/route.ts): `app/api/checkout/route.ts`
- [Order Fulfilment](https://github.com/johnpbell7/birth-hood/blob/main/app/api/stripe-webhook/route.ts): `app/api/stripe-webhook/route.ts`
- [Download Handler](https://github.com/johnpbell7/birth-hood/blob/main/app/api/download/route.ts): `app/api/download/route.ts`
- [Download Tokens](https://github.com/johnpbell7/birth-hood/blob/main/lib/download-token.ts): `lib/download-token.ts`

### Enquiries And Hub

- [Contact Form](https://github.com/johnpbell7/birth-hood/blob/main/app/contact/ContactForm.tsx): `app/contact/ContactForm.tsx`
- [Contact Handler](https://github.com/johnpbell7/birth-hood/blob/main/app/api/contact/route.ts): `app/api/contact/route.ts`
- [Client Hub](https://github.com/johnpbell7/birth-hood/blob/main/app/hub/HubClient.tsx): `app/hub/HubClient.tsx`

### Other components

- **Visitor**
- **Sanity CMS**
- **Resend Email**
- **Stripe**
- **File CDN**

## Connections

- Visitor → Home And Service Pages: browses
- Visitor → Service Pages: browses
- Visitor → Blog And Stories: reads
- Visitor → Reviews: reads
- Visitor → Booking Page: books
- Visitor → Contact Form: submits
- Visitor → Shop Interface: shops
- Visitor → Client Hub: opens
- Sanity Studio → Sanity CMS: edits content
- CMS Pages → Page Renderer: renders blocks
- CMS Pages → Sanity Queries: loads page
- Sanity Queries → Sanity Client: queries via
- Sanity Client → Sanity CMS: reads
- Blog And Stories → Sanity Queries: loads posts
- Reviews → Sanity Queries: loads reviews
- Contact Form → Contact Handler: posts enquiry
- Contact Handler → Resend Email: sends emails
- Shop Interface → Checkout Handler: starts checkout
- Checkout Handler → Sanity Queries: loads products
- Checkout Handler → Stripe: creates session
- Stripe → Order Fulfilment: dispatches event
- Order Fulfilment → Sanity Queries: loads purchased files
- Order Fulfilment → Download Tokens: signs links
- Order Fulfilment → Resend Email: emails downloads
- Visitor → Download Handler: opens link
- Download Handler → Download Tokens: verifies token
- Download Handler → Sanity Queries: loads file record
- Download Handler → File CDN: streams file
- Client Hub → Sanity Queries: loads resources
