# techtee19/kamp-website architecture

> Architecture diagram of the GitHub repository techtee19/kamp-website, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/techtee19/kamp-website
- Repository: https://github.com/techtee19/kamp-website

## Overview

KAMP is a mentoring-program website with public event, membership, donation and contact journeys, backed by Sanity content and PostgreSQL persistence, plus an admin portal for event and member operations. Public event registration checks published event details, stores a registration and sends a ticket confirmation; membership signup stores member information and sends a membership card. The graph includes the documented CMS and admin branches alongside those journeys. Some route-to-form and unsampled admin-page wiring is not visible in the excerpts, so those links are omitted.

Main entry points: [`app/api/register/route.ts`](https://github.com/techtee19/kamp-website/blob/master/app/api/register/route.ts) (Event registration), [`app/api/membership/route.ts`](https://github.com/techtee19/kamp-website/blob/master/app/api/membership/route.ts) (Membership signup), [`sanity/lib/client.ts`](https://github.com/techtee19/kamp-website/blob/master/sanity/lib/client.ts) (Sanity client), [`app/admin/api/events/checkin/route.ts`](https://github.com/techtee19/kamp-website/blob/master/app/admin/api/events/checkin/route.ts) (Event operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public experience"]
  node_site["Public pages<br/>[page.tsx]"]
  node_event_pages["Event pages<br/>[page.tsx]"]
  node_program_pages["Program pages<br/>[page.tsx]"]
  node_gallery_pages["Gallery page<br/>[page.tsx]"]
  node_membership_api["Membership signup<br/>[route.ts]"]
  node_donation_api["Donation checkout<br/>[route.ts]"]
  node_registration_api["Event registration<br/>[route.ts]"]
  node_contact_api["Contact submission<br/>[route.ts]"]
end

subgraph group_content["Content management"]
  node_sanity_queries["Content queries<br/>[queries.ts]"]
  node_sanity_client["Sanity client<br/>[client.ts]"]
  node_sanity_studio["Editorial studio<br/>[page.tsx]"]
end

subgraph group_operations["Admin operations"]
  node_admin_pages["Admin pages<br/>[page.tsx]"]
  node_admin_login["Admin login<br/>[route.ts]"]
  node_admin_event_actions["Event operations<br/>[route.ts]"]
  node_admin_member_actions["Member operations<br/>[route.ts]"]
end

subgraph group_services["Application services"]
  node_admin_data["Admin data helpers<br/>[admin-data.ts]"]
  node_admin_request["Request guard<br/>[admin-request.ts]"]
  node_admin_session["Admin session<br/>[admin-session.ts]"]
  node_request_body["Body parsing<br/>[request-body.ts]"]
  node_validation["Input validation<br/>[validations.ts]"]
  node_rate_limit["Rate limiting<br/>[ratelimit.ts]"]
  node_event_tables["Event tables<br/>[event-tables.ts]"]
  node_member_id["Member identifiers<br/>[member-id.ts]"]
  node_member_card["Member card PDF<br/>[member-card.tsx]"]
  node_ticket["Ticket PDF<br/>[ticket.tsx]"]
  node_email["Email service<br/>[email.ts]"]
  node_paystack["Payment client<br/>[paystack.ts]"]
end

subgraph group_integrations["External systems"]
  node_db[("PostgreSQL<br/>[db.ts]")]
  node_sanity[("Sanity Content Lake")]
  node_resend["Resend email"]
  node_paystack_service["Paystack"]
end

node_visitor(("Site visitor"))
node_admin_user(("Admin user"))

node_visitor -.->|"browses"| node_site
node_site -->|"fetches content"| node_sanity_client
node_event_pages -->|"fetches events"| node_sanity_client
node_program_pages -->|"fetches content"| node_sanity_client
node_sanity_queries -->|"uses client"| node_sanity_client
node_sanity_studio -.->|"edits content"| node_sanity
node_sanity_client -.->|"queries"| node_sanity
node_visitor -.->|"registers"| node_registration_api
node_registration_api -->|"checks event"| node_sanity_client
node_registration_api -->|"uses event query"| node_sanity_queries
node_registration_api -->|"validates input"| node_validation
node_registration_api -->|"reads body"| node_request_body
node_registration_api -->|"limits requests"| node_rate_limit
node_registration_api -->|"manages table"| node_event_tables
node_registration_api -.->|"stores registration"| node_db
node_registration_api -->|"generates ticket"| node_ticket
node_registration_api -->|"sends confirmation"| node_email
node_email -->|"sends email"| node_resend
node_visitor -.->|"joins membership"| node_membership_api
node_membership_api -->|"reads upload"| node_request_body
node_membership_api -->|"validates input"| node_validation
node_membership_api -->|"limits requests"| node_rate_limit
node_membership_api -->|"stores member"| node_db
node_membership_api -->|"creates identifier"| node_member_id
node_membership_api -->|"generates card"| node_member_card
node_membership_api -->|"sends welcome"| node_email
node_visitor -.->|"donates"| node_donation_api
node_donation_api -->|"validates input"| node_validation
node_donation_api -->|"starts payment"| node_paystack
node_paystack -.->|"initiates payment"| node_paystack_service
node_donation_api -.->|"records donation"| node_db
node_visitor -.->|"sends message"| node_contact_api
node_contact_api -->|"validates input"| node_validation
node_contact_api -->|"limits requests"| node_rate_limit
node_contact_api -->|"sends inquiry"| node_email
node_admin_user -.->|"authenticates"| node_admin_login
node_admin_login -->|"reads credentials"| node_request_body
node_admin_login -->|"limits attempts"| node_rate_limit
node_admin_login -->|"creates session"| node_admin_session
node_admin_user -.->|"manages program"| node_admin_pages
node_admin_event_actions -->|"checks session"| node_admin_session
node_admin_event_actions -->|"checks origin"| node_admin_request
node_admin_event_actions -->|"reads body"| node_request_body
node_admin_event_actions -->|"uses helpers"| node_admin_data
node_admin_event_actions -->|"updates check-in"| node_db
node_admin_member_actions -->|"checks session"| node_admin_session
node_admin_member_actions -->|"checks origin"| node_admin_request
node_admin_member_actions -->|"reads body"| node_request_body

click node_site "https://github.com/techtee19/kamp-website/blob/master/app/(site)/page.tsx"
click node_event_pages "https://github.com/techtee19/kamp-website/blob/master/app/(site)/events/page.tsx"
click node_program_pages "https://github.com/techtee19/kamp-website/blob/master/app/(site)/programs/page.tsx"
click node_gallery_pages "https://github.com/techtee19/kamp-website/blob/master/app/(site)/gallery/page.tsx"
click node_membership_api "https://github.com/techtee19/kamp-website/blob/master/app/api/membership/route.ts"
click node_donation_api "https://github.com/techtee19/kamp-website/blob/master/app/api/donate/route.ts"
click node_registration_api "https://github.com/techtee19/kamp-website/blob/master/app/api/register/route.ts"
click node_contact_api "https://github.com/techtee19/kamp-website/blob/master/app/api/contact/route.ts"
click node_sanity_queries "https://github.com/techtee19/kamp-website/blob/master/sanity/lib/queries.ts"
click node_sanity_client "https://github.com/techtee19/kamp-website/blob/master/sanity/lib/client.ts"
click node_sanity_studio "https://github.com/techtee19/kamp-website/blob/master/app/studio/%5B%5B...tool%5D%5D/page.tsx"
click node_admin_pages "https://github.com/techtee19/kamp-website/blob/master/app/admin/(protected)/dashboard/page.tsx"
click node_admin_login "https://github.com/techtee19/kamp-website/blob/master/app/admin/api/login/route.ts"
click node_admin_event_actions "https://github.com/techtee19/kamp-website/blob/master/app/admin/api/events/checkin/route.ts"
click node_admin_member_actions "https://github.com/techtee19/kamp-website/blob/master/app/admin/api/members/resend-card/route.ts"
click node_admin_data "https://github.com/techtee19/kamp-website/blob/master/lib/admin-data.ts"
click node_admin_request "https://github.com/techtee19/kamp-website/blob/master/lib/admin-request.ts"
click node_admin_session "https://github.com/techtee19/kamp-website/blob/master/lib/admin-session.ts"
click node_request_body "https://github.com/techtee19/kamp-website/blob/master/lib/request-body.ts"
click node_validation "https://github.com/techtee19/kamp-website/blob/master/lib/validations.ts"
click node_rate_limit "https://github.com/techtee19/kamp-website/blob/master/lib/ratelimit.ts"
click node_db "https://github.com/techtee19/kamp-website/blob/master/lib/db.ts"
click node_event_tables "https://github.com/techtee19/kamp-website/blob/master/lib/event-tables.ts"
click node_member_id "https://github.com/techtee19/kamp-website/blob/master/lib/member-id.ts"
click node_member_card "https://github.com/techtee19/kamp-website/blob/master/lib/member-card.tsx"
click node_ticket "https://github.com/techtee19/kamp-website/blob/master/lib/ticket.tsx"
click node_email "https://github.com/techtee19/kamp-website/blob/master/lib/email.ts"
click node_paystack "https://github.com/techtee19/kamp-website/blob/master/lib/paystack.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_site,node_event_pages,node_program_pages,node_gallery_pages,node_membership_api,node_donation_api,node_registration_api,node_contact_api,node_admin_user toneBlue
class node_sanity_queries,node_sanity_client,node_sanity_studio toneAmber
class node_admin_pages,node_admin_login,node_admin_event_actions,node_admin_member_actions toneMint
class node_admin_data,node_admin_request,node_admin_session,node_request_body,node_validation,node_rate_limit,node_event_tables,node_member_id,node_member_card,node_ticket,node_email,node_paystack toneRose
class node_db,node_sanity,node_resend,node_paystack_service,node_visitor toneIndigo
```

## Components

### Public experience

- [Public pages](https://github.com/techtee19/kamp-website/blob/master/app/(site)/page.tsx): `app/(site)/page.tsx`
- [Event pages](https://github.com/techtee19/kamp-website/blob/master/app/(site)/events/page.tsx): `app/(site)/events/page.tsx`
- [Program pages](https://github.com/techtee19/kamp-website/blob/master/app/(site)/programs/page.tsx): `app/(site)/programs/page.tsx`
- [Gallery page](https://github.com/techtee19/kamp-website/blob/master/app/(site)/gallery/page.tsx): `app/(site)/gallery/page.tsx`
- [Membership signup](https://github.com/techtee19/kamp-website/blob/master/app/api/membership/route.ts): `app/api/membership/route.ts`
- [Donation checkout](https://github.com/techtee19/kamp-website/blob/master/app/api/donate/route.ts): `app/api/donate/route.ts`
- [Event registration](https://github.com/techtee19/kamp-website/blob/master/app/api/register/route.ts): `app/api/register/route.ts`
- [Contact submission](https://github.com/techtee19/kamp-website/blob/master/app/api/contact/route.ts): `app/api/contact/route.ts`

### Content management

- [Content queries](https://github.com/techtee19/kamp-website/blob/master/sanity/lib/queries.ts): `sanity/lib/queries.ts`
- [Sanity client](https://github.com/techtee19/kamp-website/blob/master/sanity/lib/client.ts): `sanity/lib/client.ts`
- [Editorial studio](https://github.com/techtee19/kamp-website/blob/master/app/studio/%5B%5B...tool%5D%5D/page.tsx): `app/studio/[[...tool]]/page.tsx`

### Admin operations

- [Admin pages](https://github.com/techtee19/kamp-website/blob/master/app/admin/(protected)/dashboard/page.tsx): `app/admin/(protected)/dashboard/page.tsx`
- [Admin login](https://github.com/techtee19/kamp-website/blob/master/app/admin/api/login/route.ts): `app/admin/api/login/route.ts`
- [Event operations](https://github.com/techtee19/kamp-website/blob/master/app/admin/api/events/checkin/route.ts): `app/admin/api/events/checkin/route.ts`
- [Member operations](https://github.com/techtee19/kamp-website/blob/master/app/admin/api/members/resend-card/route.ts): `app/admin/api/members/resend-card/route.ts`

### Application services

- [Admin data helpers](https://github.com/techtee19/kamp-website/blob/master/lib/admin-data.ts): `lib/admin-data.ts`
- [Request guard](https://github.com/techtee19/kamp-website/blob/master/lib/admin-request.ts): `lib/admin-request.ts`
- [Admin session](https://github.com/techtee19/kamp-website/blob/master/lib/admin-session.ts): `lib/admin-session.ts`
- [Body parsing](https://github.com/techtee19/kamp-website/blob/master/lib/request-body.ts): `lib/request-body.ts`
- [Input validation](https://github.com/techtee19/kamp-website/blob/master/lib/validations.ts): `lib/validations.ts`
- [Rate limiting](https://github.com/techtee19/kamp-website/blob/master/lib/ratelimit.ts): `lib/ratelimit.ts`
- [Event tables](https://github.com/techtee19/kamp-website/blob/master/lib/event-tables.ts): `lib/event-tables.ts`
- [Member identifiers](https://github.com/techtee19/kamp-website/blob/master/lib/member-id.ts): `lib/member-id.ts`
- [Member card PDF](https://github.com/techtee19/kamp-website/blob/master/lib/member-card.tsx): `lib/member-card.tsx`
- [Ticket PDF](https://github.com/techtee19/kamp-website/blob/master/lib/ticket.tsx): `lib/ticket.tsx`
- [Email service](https://github.com/techtee19/kamp-website/blob/master/lib/email.ts): `lib/email.ts`
- [Payment client](https://github.com/techtee19/kamp-website/blob/master/lib/paystack.ts): `lib/paystack.ts`

### External systems

- [PostgreSQL](https://github.com/techtee19/kamp-website/blob/master/lib/db.ts): `lib/db.ts`
- **Sanity Content Lake**
- **Resend email**
- **Paystack**

### Other components

- **Site visitor**
- **Admin user**

## Connections

- Site visitor → Public pages: browses
- Public pages → Sanity client: fetches content (evidence: `app/(site)/page.tsx`)
- Event pages → Sanity client: fetches events (evidence: `app/(site)/events/page.tsx`)
- Program pages → Sanity client: fetches content (evidence: `app/(site)/programs/page.tsx`)
- Content queries → Sanity client: uses client (evidence: `sanity/lib/queries.ts`)
- Editorial studio → Sanity Content Lake: edits content
- Sanity client → Sanity Content Lake: queries
- Site visitor → Event registration: registers
- Event registration → Sanity client: checks event (evidence: `app/api/register/route.ts`)
- Event registration → Content queries: uses event query (evidence: `app/api/register/route.ts`)
- Event registration → Input validation: validates input (evidence: `app/api/register/route.ts`)
- Event registration → Body parsing: reads body (evidence: `app/api/register/route.ts`)
- Event registration → Rate limiting: limits requests (evidence: `app/api/register/route.ts`)
- Event registration → Event tables: manages table (evidence: `app/api/register/route.ts`)
- Event registration → PostgreSQL: stores registration
- Event registration → Ticket PDF: generates ticket (evidence: `app/api/register/route.ts`)
- Event registration → Email service: sends confirmation (evidence: `app/api/register/route.ts`)
- Email service → Resend email: sends email (evidence: `lib/email.ts`)
- Site visitor → Membership signup: joins membership
- Membership signup → Body parsing: reads upload (evidence: `app/api/membership/route.ts`)
- Membership signup → Input validation: validates input (evidence: `app/api/membership/route.ts`)
- Membership signup → Rate limiting: limits requests (evidence: `app/api/membership/route.ts`)
- Membership signup → PostgreSQL: stores member (evidence: `app/api/membership/route.ts`)
- Membership signup → Member identifiers: creates identifier (evidence: `app/api/membership/route.ts`)
- Membership signup → Member card PDF: generates card (evidence: `app/api/membership/route.ts`)
- Membership signup → Email service: sends welcome (evidence: `app/api/membership/route.ts`)
- Site visitor → Donation checkout: donates
- Donation checkout → Input validation: validates input (evidence: `app/api/donate/route.ts`)
- Donation checkout → Payment client: starts payment (evidence: `app/api/donate/route.ts`)
- Payment client → Paystack: initiates payment
- Donation checkout → PostgreSQL: records donation (evidence: `app/api/donate/route.ts`)
- Site visitor → Contact submission: sends message
- Contact submission → Input validation: validates input (evidence: `app/api/contact/route.ts`)
- Contact submission → Rate limiting: limits requests (evidence: `app/api/contact/route.ts`)
- Contact submission → Email service: sends inquiry (evidence: `app/api/contact/route.ts`)
- Admin user → Admin login: authenticates
- Admin login → Body parsing: reads credentials (evidence: `app/admin/api/login/route.ts`)
- Admin login → Rate limiting: limits attempts (evidence: `app/admin/api/login/route.ts`)
- Admin login → Admin session: creates session (evidence: `app/admin/api/login/route.ts`)
- Admin user → Admin pages: manages program
- Event operations → Admin session: checks session (evidence: `app/admin/api/events/checkin/route.ts`)
- Event operations → Request guard: checks origin (evidence: `app/admin/api/events/checkin/route.ts`)
- Event operations → Body parsing: reads body (evidence: `app/admin/api/events/checkin/route.ts`)
- Event operations → Admin data helpers: uses helpers (evidence: `app/admin/api/events/checkin/route.ts`)
- Event operations → PostgreSQL: updates check-in (evidence: `app/admin/api/events/checkin/route.ts`)
- Member operations → Admin session: checks session (evidence: `app/admin/api/members/resend-card/route.ts`)
- Member operations → Request guard: checks origin (evidence: `app/admin/api/members/resend-card/route.ts`)
- Member operations → Body parsing: reads body (evidence: `app/admin/api/members/resend-card/route.ts`)
