# githaiga701/buffalo-plains-adventures architecture

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

- Interactive diagram: https://gitdiagram.com/githaiga701/buffalo-plains-adventures
- Repository: https://github.com/githaiga701/buffalo-plains-adventures

## Overview

Buffalo Plains Adventures is a Kenya safari discovery and booking website. Travellers enter through the React app, explore destination and package content, view details, and can proceed toward booking; the repository also contains PayPal and M-Pesa payment flows with callback routes. The graph follows documented routing and sampled calls. Some booking-page and payment-widget implementation was not sampled, so links beyond the shown payment hook and API handlers are omitted rather than inferred.

Main entry points: [`src/App.tsx`](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/App.tsx) (React App Router), [`src/lib/paypal.ts`](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/lib/paypal.ts) (PayPal Integration), [`src/pages/Index.tsx`](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/pages/Index.tsx) (Home Experience), [`src/hooks/usePayment.ts`](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/hooks/usePayment.ts) (Payment State and Requests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_react_app["React App Router<br/>[App.tsx]"]
end

subgraph group_discovery["Safari Discovery"]
  node_home["Home Experience<br/>[Index.tsx]"]
  node_hero["Safari Hero<br/>[HeroSection.tsx]"]
  node_destinations["Destination Browsing<br/>[Destinations.tsx]"]
  node_destination_content["Destination Highlights"]
  node_curated_sections["Safari Features"]
  node_catalog_data["Travel Catalog<br/>[data.ts]"]
  node_packages["Package Listings<br/>[Packages.tsx]"]
  node_package_detail["Package Details<br/>[PackageDetail.tsx]"]
end

subgraph group_booking["Booking and Payments"]
  node_booking_page["Booking Page<br/>[Booking.tsx]"]
  node_payment_options["Payment Options<br/>[PaymentOptions.tsx]"]
  node_mpesa_form["M-Pesa Form"]
  node_paypal_button["PayPal Checkout"]
  node_payment_hook["Payment State and Requests<br/>[usePayment.ts]"]
  node_mpesa_start["M-Pesa STK Route<br/>[route.ts]"]
  node_mpesa_callback["M-Pesa Callback<br/>[route.ts]"]
  node_paypal_create["PayPal Create Route<br/>[route.ts]"]
  node_paypal_capture["PayPal Capture Route<br/>[route.ts]"]
  node_paypal_callback["PayPal Callback<br/>[route.ts]"]
end

subgraph group_internals["Payment Internals"]
  node_mpesa_service["M-Pesa Integration<br/>[mpesa.ts]"]
  node_paypal_service["PayPal Integration<br/>[paypal.ts]"]
  node_validation["Payment Validation<br/>[validation.ts]"]
  node_webhook_security["Webhook Security"]
  node_payment_types["Payment Types<br/>[payment.ts]"]
  node_logger["Payment Logging<br/>[logging.ts]"]
end

node_traveller(("Traveller"))

node_traveller -->|"opens"| node_react_app
node_react_app -->|"routes to"| node_home
node_react_app -->|"routes to"| node_destinations
node_react_app -->|"routes to"| node_packages
node_react_app -->|"routes to"| node_package_detail
node_react_app -->|"routes to"| node_booking_page
node_home -->|"renders"| node_hero
node_home -->|"renders"| node_destination_content
node_home -->|"renders"| node_curated_sections
node_destinations -->|"reads"| node_catalog_data
node_package_detail -->|"reads"| node_catalog_data
node_payment_options -.->|"offers"| node_mpesa_form
node_payment_options -.->|"offers"| node_paypal_button
node_mpesa_form -.->|"uses"| node_payment_hook
node_paypal_button -.->|"uses"| node_payment_hook
node_payment_hook -->|"POSTs to"| node_mpesa_start
node_payment_hook -->|"POSTs to"| node_paypal_create
node_mpesa_start -->|"invokes"| node_mpesa_service
node_mpesa_callback -->|"parses callback"| node_mpesa_service
node_paypal_create -->|"creates order"| node_paypal_service
node_paypal_capture -->|"captures order"| node_paypal_service
node_paypal_callback -->|"verifies signature"| node_paypal_service
node_mpesa_start -->|"validates request"| node_validation
node_paypal_create -->|"validates request"| node_validation
node_paypal_capture -->|"validates request"| node_validation
node_mpesa_callback -->|"checks callback"| node_webhook_security
node_paypal_callback -->|"checks callback"| node_webhook_security
node_mpesa_service -->|"uses types"| node_payment_types
node_paypal_service -->|"uses types"| node_payment_types
node_mpesa_service -->|"logs"| node_logger
node_paypal_service -->|"logs"| node_logger
node_webhook_security -->|"logs"| node_logger

click node_react_app "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/App.tsx"
click node_home "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/pages/Index.tsx"
click node_hero "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/components/HeroSection.tsx"
click node_destinations "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/pages/Destinations.tsx"
click node_destination_content "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/components/DestinationsPreview.tsx"
click node_curated_sections "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/components/ResortsAndRestaurants.tsx"
click node_catalog_data "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/lib/data.ts"
click node_packages "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/pages/Packages.tsx"
click node_package_detail "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/pages/PackageDetail.tsx"
click node_booking_page "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/pages/Booking.tsx"
click node_payment_options "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/components/PaymentOptions.tsx"
click node_mpesa_form "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/components/MpesaPaymentForm.tsx"
click node_paypal_button "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/components/PayPalCheckoutButton.tsx"
click node_payment_hook "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/hooks/usePayment.ts"
click node_mpesa_start "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/NEXT_JS_API_ROUTES_BACKUP/app/api/mpesa/stkpush/route.ts"
click node_mpesa_callback "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/NEXT_JS_API_ROUTES_BACKUP/app/api/mpesa/webhook/route.ts"
click node_paypal_create "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/NEXT_JS_API_ROUTES_BACKUP/app/api/paypal/create-order/route.ts"
click node_paypal_capture "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/NEXT_JS_API_ROUTES_BACKUP/app/api/paypal/capture-order/route.ts"
click node_paypal_callback "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/NEXT_JS_API_ROUTES_BACKUP/app/api/paypal/webhook/route.ts"
click node_mpesa_service "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/lib/mpesa.ts"
click node_paypal_service "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/lib/paypal.ts"
click node_validation "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/lib/validation.ts"
click node_webhook_security "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/lib/webhook-security.ts"
click node_payment_types "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/lib/types/payment.ts"
click node_logger "https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/lib/logging.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_react_app toneBlue
class node_home,node_hero,node_destinations,node_destination_content,node_curated_sections,node_catalog_data,node_packages,node_package_detail toneAmber
class node_booking_page,node_payment_options,node_mpesa_form,node_paypal_button,node_payment_hook,node_mpesa_start,node_mpesa_callback,node_paypal_create,node_paypal_capture,node_paypal_callback toneMint
class node_mpesa_service,node_paypal_service,node_validation,node_webhook_security,node_payment_types,node_logger toneRose
class node_traveller toneIndigo
```

## Components

### Application

- [React App Router](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/App.tsx): `src/App.tsx`

### Safari Discovery

- [Home Experience](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/pages/Index.tsx): `src/pages/Index.tsx`
- [Safari Hero](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/components/HeroSection.tsx): `src/components/HeroSection.tsx`
- [Destination Browsing](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/pages/Destinations.tsx): `src/pages/Destinations.tsx`
- [Destination Highlights](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/components/DestinationsPreview.tsx): `src/components/DestinationsPreview.tsx`
- [Safari Features](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/components/ResortsAndRestaurants.tsx): `src/components/ResortsAndRestaurants.tsx`
- [Travel Catalog](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/lib/data.ts): `src/lib/data.ts`
- [Package Listings](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/pages/Packages.tsx): `src/pages/Packages.tsx`
- [Package Details](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/pages/PackageDetail.tsx): `src/pages/PackageDetail.tsx`

### Booking and Payments

- [Booking Page](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/pages/Booking.tsx): `src/pages/Booking.tsx`
- [Payment Options](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/components/PaymentOptions.tsx): `src/components/PaymentOptions.tsx`
- [M-Pesa Form](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/components/MpesaPaymentForm.tsx): `src/components/MpesaPaymentForm.tsx`
- [PayPal Checkout](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/components/PayPalCheckoutButton.tsx): `src/components/PayPalCheckoutButton.tsx`
- [Payment State and Requests](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/hooks/usePayment.ts): `src/hooks/usePayment.ts`
- [M-Pesa STK Route](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/NEXT_JS_API_ROUTES_BACKUP/app/api/mpesa/stkpush/route.ts): `NEXT_JS_API_ROUTES_BACKUP/app/api/mpesa/stkpush/route.ts`
- [M-Pesa Callback](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/NEXT_JS_API_ROUTES_BACKUP/app/api/mpesa/webhook/route.ts): `NEXT_JS_API_ROUTES_BACKUP/app/api/mpesa/webhook/route.ts`
- [PayPal Create Route](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/NEXT_JS_API_ROUTES_BACKUP/app/api/paypal/create-order/route.ts): `NEXT_JS_API_ROUTES_BACKUP/app/api/paypal/create-order/route.ts`
- [PayPal Capture Route](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/NEXT_JS_API_ROUTES_BACKUP/app/api/paypal/capture-order/route.ts): `NEXT_JS_API_ROUTES_BACKUP/app/api/paypal/capture-order/route.ts`
- [PayPal Callback](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/NEXT_JS_API_ROUTES_BACKUP/app/api/paypal/webhook/route.ts): `NEXT_JS_API_ROUTES_BACKUP/app/api/paypal/webhook/route.ts`

### Payment Internals

- [M-Pesa Integration](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/lib/mpesa.ts): `src/lib/mpesa.ts`
- [PayPal Integration](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/lib/paypal.ts): `src/lib/paypal.ts`
- [Payment Validation](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/lib/validation.ts): `src/lib/validation.ts`
- [Webhook Security](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/lib/webhook-security.ts): `src/lib/webhook-security.ts`
- [Payment Types](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/lib/types/payment.ts): `src/lib/types/payment.ts`
- [Payment Logging](https://github.com/githaiga701/buffalo-plains-adventures/blob/main/src/lib/logging.ts): `src/lib/logging.ts`

### Other components

- **Traveller**

## Connections

- Traveller → React App Router: opens (evidence: `README.md`)
- React App Router → Home Experience: routes to (evidence: `src/App.tsx`)
- React App Router → Destination Browsing: routes to (evidence: `src/App.tsx`)
- React App Router → Package Listings: routes to (evidence: `src/App.tsx`)
- React App Router → Package Details: routes to (evidence: `src/App.tsx`)
- React App Router → Booking Page: routes to (evidence: `src/App.tsx`)
- Home Experience → Safari Hero: renders (evidence: `src/pages/Index.tsx`)
- Home Experience → Destination Highlights: renders (evidence: `src/pages/Index.tsx`)
- Home Experience → Safari Features: renders (evidence: `src/pages/Index.tsx`)
- Destination Browsing → Travel Catalog: reads (evidence: `src/pages/Destinations.tsx`)
- Package Details → Travel Catalog: reads (evidence: `src/pages/PackageDetail.tsx`)
- Payment Options → M-Pesa Form: offers
- Payment Options → PayPal Checkout: offers
- M-Pesa Form → Payment State and Requests: uses
- PayPal Checkout → Payment State and Requests: uses
- Payment State and Requests → M-Pesa STK Route: POSTs to (evidence: `src/hooks/usePayment.ts`)
- Payment State and Requests → PayPal Create Route: POSTs to (evidence: `src/hooks/usePayment.ts`)
- M-Pesa STK Route → M-Pesa Integration: invokes (evidence: `NEXT_JS_API_ROUTES_BACKUP/app/api/mpesa/stkpush/route.ts`)
- M-Pesa Callback → M-Pesa Integration: parses callback (evidence: `NEXT_JS_API_ROUTES_BACKUP/app/api/mpesa/webhook/route.ts`)
- PayPal Create Route → PayPal Integration: creates order (evidence: `NEXT_JS_API_ROUTES_BACKUP/app/api/paypal/create-order/route.ts`)
- PayPal Capture Route → PayPal Integration: captures order (evidence: `NEXT_JS_API_ROUTES_BACKUP/app/api/paypal/capture-order/route.ts`)
- PayPal Callback → PayPal Integration: verifies signature (evidence: `NEXT_JS_API_ROUTES_BACKUP/app/api/paypal/webhook/route.ts`)
- M-Pesa STK Route → Payment Validation: validates request (evidence: `NEXT_JS_API_ROUTES_BACKUP/app/api/mpesa/stkpush/route.ts`)
- PayPal Create Route → Payment Validation: validates request (evidence: `NEXT_JS_API_ROUTES_BACKUP/app/api/paypal/create-order/route.ts`)
- PayPal Capture Route → Payment Validation: validates request (evidence: `NEXT_JS_API_ROUTES_BACKUP/app/api/paypal/capture-order/route.ts`)
- M-Pesa Callback → Webhook Security: checks callback (evidence: `NEXT_JS_API_ROUTES_BACKUP/app/api/mpesa/webhook/route.ts`)
- PayPal Callback → Webhook Security: checks callback (evidence: `NEXT_JS_API_ROUTES_BACKUP/app/api/paypal/webhook/route.ts`)
- M-Pesa Integration → Payment Types: uses types (evidence: `src/lib/mpesa.ts`)
- PayPal Integration → Payment Types: uses types (evidence: `src/lib/paypal.ts`)
- M-Pesa Integration → Payment Logging: logs (evidence: `src/lib/mpesa.ts`)
- PayPal Integration → Payment Logging: logs (evidence: `src/lib/paypal.ts`)
- Webhook Security → Payment Logging: logs (evidence: `src/lib/webhook-security.ts`)
