# tinashenyoni/kwaterry-restaurant architecture

> Architecture diagram of the GitHub repository tinashenyoni/kwaterry-restaurant, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tinashenyoni/kwaterry-restaurant
- Repository: https://github.com/tinashenyoni/kwaterry-restaurant

## Overview

KwaTerry is a public restaurant-and-lodge storefront with an owner-managed admin dashboard. Visitors browse live-or-seed content, submit bookings, reviews, and contact messages; the owner signs in to manage content and submissions. The graph preserves the documented public showcase, SEO, gallery, and admin capabilities. Connections for unsampled pages and route families rely on README documentation; source-index imports and sampled handler code support the remaining links.

Main entry points: [`src/lib/supabase.ts`](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/lib/supabase.ts) (Supabase clients), [`src/app/(site)/page.tsx`](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/app/(site)/page.tsx) (Storefront), [`src/components/sections/Gallery.tsx`](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/components/sections/Gallery.tsx) (Gallery and lightbox), [`src/app/admin`](https://github.com/tinashenyoni/kwaterry-restaurant/tree/main/src/app/admin) (Admin dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public storefront"]
  node_storefront["Storefront<br/>[page.tsx]"]
  node_story["Story and experiences"]
  node_menu_lodge["Menu and lodge"]
  node_gallery["Gallery and lightbox<br/>[Gallery.tsx]"]
  node_testimonials["Testimonials"]
  node_site_shell["Site navigation and footer<br/>[Footer.tsx]"]
  node_seo["SEO metadata"]
end

subgraph group_engagement["Visitor requests"]
  node_booking_form["Reservation form"]
  node_contact_form["Contact form<br/>[ContactForm.tsx]"]
  node_review_form["Review form<br/>[ReviewForm.tsx]"]
  node_reservation_api["Reservation intake<br/>[route.ts]"]
  node_contact_api["Contact intake<br/>[route.ts]"]
  node_review_api["Review intake<br/>[route.ts]"]
end

subgraph group_admin["Owner dashboard"]
  node_admin_ui["Admin dashboard"]
  node_admin_auth["Admin sign-in<br/>[route.ts]"]
  node_admin_crud["Content and workflow APIs"]
  node_upload_api["Media upload<br/>[route.ts]"]
end

subgraph group_services["Data and services"]
  node_auth_logic["Session validation<br/>[auth.ts]"]
  node_api_guard["Admin API guard<br/>[api.ts]"]
  node_site_data["Live data with fallback<br/>[use-site-data.ts]"]
  node_seed_data["Seed content<br/>[seed-data.ts]"]
  node_supabase_client["Supabase clients<br/>[supabase.ts]"]
  node_storage_helper["Storage cleanup and paths<br/>[storage.ts]"]
  node_media_resolver["Media URL resolver<br/>[media.ts]"]
end

node_visitor(("Visitor"))
node_supabase[("Supabase database and storage")]

node_visitor -->|"browses"| node_storefront
node_storefront -->|"presents"| node_story
node_storefront -->|"presents"| node_menu_lodge
node_storefront -->|"presents"| node_gallery
node_storefront -->|"presents"| node_testimonials
node_storefront -->|"uses"| node_site_shell
node_storefront -->|"includes"| node_seo
node_menu_lodge -.->|"reads live content"| node_site_data
node_gallery -->|"loads content"| node_site_data
node_gallery -->|"resolves media"| node_media_resolver
node_gallery -->|"uses fallback"| node_seed_data
node_gallery -->|"loads gallery"| node_supabase_client
node_gallery -.->|"opens lightbox"| node_visitor
node_visitor -->|"requests booking"| node_booking_form
node_visitor -->|"sends message"| node_contact_form
node_visitor -->|"submits review"| node_review_form
node_booking_form -.->|"submits booking"| node_reservation_api
node_contact_form -.->|"submits message"| node_contact_api
node_review_form -.->|"submits review"| node_review_api
node_reservation_api -->|"inserts pending booking"| node_supabase_client
node_contact_api -->|"inserts message"| node_supabase_client
node_review_api -->|"inserts pending review"| node_supabase_client
node_supabase_client -->|"reads and writes"| node_supabase
node_visitor -.->|"manages site"| node_admin_ui
node_admin_ui -.->|"signs in"| node_admin_auth
node_admin_ui -.->|"manages content"| node_admin_crud
node_admin_ui -.->|"uploads media"| node_upload_api
node_admin_auth -->|"signs session"| node_auth_logic
node_admin_crud -->|"checks access"| node_api_guard
node_api_guard -->|"validates session"| node_auth_logic
node_admin_crud -->|"manages records"| node_supabase_client
node_admin_crud -->|"serves demo data"| node_seed_data
node_upload_api -->|"checks access"| node_api_guard
node_upload_api -->|"builds object paths"| node_storage_helper
node_upload_api -->|"uploads files"| node_supabase_client
node_storage_helper -->|"removes stored files"| node_supabase_client
node_site_data -->|"loads site data"| node_supabase_client
node_site_data -->|"falls back to"| node_seed_data
node_media_resolver -.->|"uses optional storage"| node_supabase

click node_storefront "https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/app/(site)/page.tsx"
click node_story "https://github.com/tinashenyoni/kwaterry-restaurant/tree/main/src/components/sections"
click node_menu_lodge "https://github.com/tinashenyoni/kwaterry-restaurant/tree/main/src/components/sections"
click node_gallery "https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/components/sections/Gallery.tsx"
click node_testimonials "https://github.com/tinashenyoni/kwaterry-restaurant/tree/main/src/components/sections"
click node_site_shell "https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/components/layout/Footer.tsx"
click node_seo "https://github.com/tinashenyoni/kwaterry-restaurant/tree/main/src/app"
click node_booking_form "https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/components/sections/ReservationForm.tsx"
click node_contact_form "https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/components/sections/ContactForm.tsx"
click node_review_form "https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/components/sections/ReviewForm.tsx"
click node_reservation_api "https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/app/api/reservations/route.ts"
click node_contact_api "https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/app/api/contact/route.ts"
click node_review_api "https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/app/api/reviews/route.ts"
click node_admin_ui "https://github.com/tinashenyoni/kwaterry-restaurant/tree/main/src/app/admin"
click node_admin_auth "https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/app/api/admin/auth/login/route.ts"
click node_admin_crud "https://github.com/tinashenyoni/kwaterry-restaurant/tree/main/src/app/api/admin"
click node_upload_api "https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/app/api/admin/upload/route.ts"
click node_auth_logic "https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/lib/auth.ts"
click node_api_guard "https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/lib/api.ts"
click node_site_data "https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/lib/use-site-data.ts"
click node_seed_data "https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/data/seed-data.ts"
click node_supabase_client "https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/lib/supabase.ts"
click node_storage_helper "https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/lib/storage.ts"
click node_media_resolver "https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/lib/media.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_storefront,node_story,node_menu_lodge,node_gallery,node_testimonials,node_site_shell,node_seo toneBlue
class node_booking_form,node_contact_form,node_review_form,node_reservation_api,node_contact_api,node_review_api,node_supabase toneAmber
class node_admin_ui,node_admin_auth,node_admin_crud,node_upload_api toneMint
class node_auth_logic,node_api_guard,node_site_data,node_seed_data,node_supabase_client,node_storage_helper,node_media_resolver toneRose
class node_visitor toneIndigo
```

## Components

### Public storefront

- [Storefront](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/app/(site)/page.tsx): `src/app/(site)/page.tsx`
- [Story and experiences](https://github.com/tinashenyoni/kwaterry-restaurant/tree/main/src/components/sections): `src/components/sections`
- [Menu and lodge](https://github.com/tinashenyoni/kwaterry-restaurant/tree/main/src/components/sections): `src/components/sections`
- [Gallery and lightbox](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/components/sections/Gallery.tsx): `src/components/sections/Gallery.tsx`
- [Testimonials](https://github.com/tinashenyoni/kwaterry-restaurant/tree/main/src/components/sections): `src/components/sections`
- [Site navigation and footer](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/components/layout/Footer.tsx): `src/components/layout/Footer.tsx`
- [SEO metadata](https://github.com/tinashenyoni/kwaterry-restaurant/tree/main/src/app): `src/app`

### Visitor requests

- [Reservation form](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/components/sections/ReservationForm.tsx): `src/components/sections/ReservationForm.tsx`
- [Contact form](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/components/sections/ContactForm.tsx): `src/components/sections/ContactForm.tsx`
- [Review form](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/components/sections/ReviewForm.tsx): `src/components/sections/ReviewForm.tsx`
- [Reservation intake](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/app/api/reservations/route.ts): `src/app/api/reservations/route.ts`
- [Contact intake](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/app/api/contact/route.ts): `src/app/api/contact/route.ts`
- [Review intake](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/app/api/reviews/route.ts): `src/app/api/reviews/route.ts`

### Owner dashboard

- [Admin dashboard](https://github.com/tinashenyoni/kwaterry-restaurant/tree/main/src/app/admin): `src/app/admin`
- [Admin sign-in](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/app/api/admin/auth/login/route.ts): `src/app/api/admin/auth/login/route.ts`
- [Content and workflow APIs](https://github.com/tinashenyoni/kwaterry-restaurant/tree/main/src/app/api/admin): `src/app/api/admin`
- [Media upload](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/app/api/admin/upload/route.ts): `src/app/api/admin/upload/route.ts`

### Data and services

- [Session validation](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Admin API guard](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/lib/api.ts): `src/lib/api.ts`
- [Live data with fallback](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/lib/use-site-data.ts): `src/lib/use-site-data.ts`
- [Seed content](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/data/seed-data.ts): `src/data/seed-data.ts`
- [Supabase clients](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- [Storage cleanup and paths](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/lib/storage.ts): `src/lib/storage.ts`
- [Media URL resolver](https://github.com/tinashenyoni/kwaterry-restaurant/blob/main/src/lib/media.ts): `src/lib/media.ts`

### Other components

- **Visitor**
- **Supabase database and storage**

## Connections

- Visitor → Storefront: browses (evidence: `README.md`)
- Storefront → Story and experiences: presents (evidence: `README.md`)
- Storefront → Menu and lodge: presents (evidence: `README.md`)
- Storefront → Gallery and lightbox: presents (evidence: `README.md`)
- Storefront → Testimonials: presents (evidence: `README.md`)
- Storefront → Site navigation and footer: uses (evidence: `README.md`)
- Storefront → SEO metadata: includes (evidence: `README.md`)
- Menu and lodge → Live data with fallback: reads live content (evidence: `src/components/sections/Gallery.tsx`)
- Gallery and lightbox → Live data with fallback: loads content (evidence: `src/components/sections/Gallery.tsx`)
- Gallery and lightbox → Media URL resolver: resolves media (evidence: `src/components/sections/Gallery.tsx`)
- Gallery and lightbox → Seed content: uses fallback (evidence: `src/components/sections/Gallery.tsx`)
- Gallery and lightbox → Supabase clients: loads gallery (evidence: `src/components/sections/Gallery.tsx`)
- Gallery and lightbox → Visitor: opens lightbox
- Visitor → Reservation form: requests booking (evidence: `README.md`)
- Visitor → Contact form: sends message (evidence: `README.md`)
- Visitor → Review form: submits review (evidence: `README.md`)
- Reservation form → Reservation intake: submits booking
- Contact form → Contact intake: submits message
- Review form → Review intake: submits review
- Reservation intake → Supabase clients: inserts pending booking (evidence: `src/app/api/reservations/route.ts`)
- Contact intake → Supabase clients: inserts message (evidence: `src/app/api/contact/route.ts`)
- Review intake → Supabase clients: inserts pending review (evidence: `src/app/api/reviews/route.ts`)
- Supabase clients → Supabase database and storage: reads and writes (evidence: `src/lib/supabase.ts`)
- Visitor → Admin dashboard: manages site
- Admin dashboard → Admin sign-in: signs in
- Admin dashboard → Content and workflow APIs: manages content
- Admin dashboard → Media upload: uploads media
- Admin sign-in → Session validation: signs session (evidence: `src/app/api/admin/auth/login/route.ts`)
- Content and workflow APIs → Admin API guard: checks access (evidence: `src/lib/api.ts`)
- Admin API guard → Session validation: validates session (evidence: `src/lib/api.ts`)
- Content and workflow APIs → Supabase clients: manages records (evidence: `src/app/api/admin/gallery/route.ts`)
- Content and workflow APIs → Seed content: serves demo data (evidence: `src/app/api/admin/gallery/route.ts`)
- Media upload → Admin API guard: checks access (evidence: `src/app/api/admin/upload/route.ts`)
- Media upload → Storage cleanup and paths: builds object paths (evidence: `src/app/api/admin/upload/route.ts`)
- Media upload → Supabase clients: uploads files (evidence: `src/app/api/admin/upload/route.ts`)
- Storage cleanup and paths → Supabase clients: removes stored files (evidence: `src/lib/storage.ts`)
- Live data with fallback → Supabase clients: loads site data (evidence: `src/lib/use-site-data.ts`)
- Live data with fallback → Seed content: falls back to (evidence: `README.md`)
- Media URL resolver → Supabase database and storage: uses optional storage (evidence: `README.md`)
