# redfacesa/petangels architecture

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

- Interactive diagram: https://gitdiagram.com/redfacesa/petangels
- Repository: https://github.com/redfacesa/petangels

## Overview

Pet Angels SA is a social-commerce app for pet owners, shops, and shelters. Users enter through routed web pages, then discover community content, listings, animals, care, and shelter-map features; signed-in users can create content, message, and manage profiles. Purchases, donations, and related fees open RedFace Pay or Paystack, while a webhook records payment receipts in Supabase. The graph combines documented capabilities with sampled routing and data-layer evidence; several feature pages and their internal call paths were not sampled, so those links are not inferred.

Main entry points: [`src/App.tsx`](https://github.com/redfacesa/petangels/blob/main/src/App.tsx) (Routes and providers), [`src/lib/redface-pay.ts`](https://github.com/redfacesa/petangels/blob/main/src/lib/redface-pay.ts) (Payment handling), [`src/lib/db.ts`](https://github.com/redfacesa/petangels/blob/main/src/lib/db.ts) (Domain data access), [`src/pages/ProfilePage.tsx`](https://github.com/redfacesa/petangels/blob/main/src/pages/ProfilePage.tsx) (Profiles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_app["Routes and providers<br/>[App.tsx]"]
  node_shell["App shell<br/>[AppShell.tsx]"]
  node_auth_pages["Sign-in and signup<br/>[SignupPage.tsx]"]
  node_create["Content creation<br/>[CreatePage.tsx]"]
end

subgraph group_community["Community and rescue"]
  node_home["Home and discovery<br/>[HomePage.tsx]"]
  node_discover["Social discovery<br/>[DiscoverPage.tsx]"]
  node_profiles["Profiles<br/>[ProfilePage.tsx]"]
  node_posts["Posts and journal<br/>[PostPage.tsx]"]
  node_messaging["Inbox and messages<br/>[MessagesPage.tsx]"]
  node_rescue["Rescue and adoption<br/>[RescuePage.tsx]"]
  node_animals["Animal listings<br/>[AnimalPage.tsx]"]
end

subgraph group_commerce["Commerce and care"]
  node_marketplace["Marketplace"]
  node_cart["Cart and checkout<br/>[CartPage.tsx]"]
  node_donations["Donations<br/>[DonatePage.tsx]"]
  node_care_map["Care and shelter map<br/>[CarePage.tsx]"]
end

subgraph group_platform["Platform services"]
  node_catalog["Catalog state<br/>[CatalogContext.tsx]"]
  node_auth["Authentication state<br/>[AuthContext.tsx]"]
  node_data["Domain data access<br/>[db.ts]"]
  node_media["Image storage access<br/>[media.ts]"]
  node_payments["Payment handling<br/>[redface-pay.ts]"]
  node_webhook["Payment webhook<br/>[index.ts]"]
end

node_visitor(("People"))
node_supabase[("Supabase")]
node_redface["RedFace Pay"]
node_paystack["Paystack"]

node_visitor -->|"opens"| node_app
node_app -->|"provides auth"| node_auth
node_app -->|"provides catalog"| node_catalog
node_app -->|"renders routes"| node_shell
node_app -->|"routes to"| node_auth_pages
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_discover
node_app -->|"routes to"| node_profiles
node_app -->|"routes to"| node_posts
node_app -->|"routes to"| node_messaging
node_app -->|"routes to"| node_rescue
node_app -->|"routes to"| node_animals
node_app -->|"routes to"| node_marketplace
node_app -.->|"routes to"| node_cart
node_app -->|"routes to"| node_donations
node_app -->|"routes to"| node_care_map
node_app -.->|"routes to"| node_create
node_catalog -->|"reads user"| node_auth
node_catalog -->|"loads catalog"| node_data
node_auth -->|"authenticates"| node_supabase
node_data -->|"reads and writes"| node_supabase
node_media -->|"stores images"| node_supabase
node_discover -->|"loads content"| node_data
node_create -->|"saves content"| node_data
node_create -->|"uploads images"| node_media
node_profiles -->|"loads profile data"| node_data
node_profiles -->|"uploads avatar"| node_media
node_profiles -->|"starts payments"| node_payments
node_cart -.->|"starts checkout"| node_payments
node_donations -.->|"starts donations"| node_payments
node_payments -->|"opens merchant checkout"| node_redface
node_payments -->|"opens platform checkout"| node_paystack
node_redface -->|"sends payment event"| node_webhook
node_paystack -->|"sends payment event"| node_webhook
node_webhook -->|"records receipt"| node_supabase

click node_app "https://github.com/redfacesa/petangels/blob/main/src/App.tsx"
click node_shell "https://github.com/redfacesa/petangels/blob/main/src/components/AppShell.tsx"
click node_auth_pages "https://github.com/redfacesa/petangels/blob/main/src/pages/SignupPage.tsx"
click node_home "https://github.com/redfacesa/petangels/blob/main/src/pages/HomePage.tsx"
click node_discover "https://github.com/redfacesa/petangels/blob/main/src/pages/DiscoverPage.tsx"
click node_profiles "https://github.com/redfacesa/petangels/blob/main/src/pages/ProfilePage.tsx"
click node_posts "https://github.com/redfacesa/petangels/blob/main/src/pages/PostPage.tsx"
click node_messaging "https://github.com/redfacesa/petangels/blob/main/src/pages/MessagesPage.tsx"
click node_rescue "https://github.com/redfacesa/petangels/blob/main/src/pages/RescuePage.tsx"
click node_animals "https://github.com/redfacesa/petangels/blob/main/src/pages/AnimalPage.tsx"
click node_marketplace "https://github.com/redfacesa/petangels/blob/main/src/pages/MarketplacePage.tsx"
click node_cart "https://github.com/redfacesa/petangels/blob/main/src/pages/CartPage.tsx"
click node_donations "https://github.com/redfacesa/petangels/blob/main/src/pages/DonatePage.tsx"
click node_care_map "https://github.com/redfacesa/petangels/blob/main/src/pages/CarePage.tsx"
click node_create "https://github.com/redfacesa/petangels/blob/main/src/pages/CreatePage.tsx"
click node_catalog "https://github.com/redfacesa/petangels/blob/main/src/contexts/CatalogContext.tsx"
click node_auth "https://github.com/redfacesa/petangels/blob/main/src/contexts/AuthContext.tsx"
click node_data "https://github.com/redfacesa/petangels/blob/main/src/lib/db.ts"
click node_media "https://github.com/redfacesa/petangels/blob/main/src/lib/media.ts"
click node_payments "https://github.com/redfacesa/petangels/blob/main/src/lib/redface-pay.ts"
click node_webhook "https://github.com/redfacesa/petangels/blob/main/supabase/functions/pay-webhook/index.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_app,node_shell,node_auth_pages,node_create toneBlue
class node_home,node_discover,node_profiles,node_posts,node_messaging,node_rescue,node_animals,node_supabase toneAmber
class node_marketplace,node_cart,node_donations,node_care_map toneMint
class node_catalog,node_auth,node_data,node_media,node_payments,node_webhook toneRose
class node_visitor,node_redface,node_paystack toneIndigo
```

## Components

### App experience

- [Routes and providers](https://github.com/redfacesa/petangels/blob/main/src/App.tsx): `src/App.tsx`
- [App shell](https://github.com/redfacesa/petangels/blob/main/src/components/AppShell.tsx): `src/components/AppShell.tsx`
- [Sign-in and signup](https://github.com/redfacesa/petangels/blob/main/src/pages/SignupPage.tsx): `src/pages/SignupPage.tsx`
- [Content creation](https://github.com/redfacesa/petangels/blob/main/src/pages/CreatePage.tsx): `src/pages/CreatePage.tsx`

### Community and rescue

- [Home and discovery](https://github.com/redfacesa/petangels/blob/main/src/pages/HomePage.tsx): `src/pages/HomePage.tsx`
- [Social discovery](https://github.com/redfacesa/petangels/blob/main/src/pages/DiscoverPage.tsx): `src/pages/DiscoverPage.tsx`
- [Profiles](https://github.com/redfacesa/petangels/blob/main/src/pages/ProfilePage.tsx): `src/pages/ProfilePage.tsx`
- [Posts and journal](https://github.com/redfacesa/petangels/blob/main/src/pages/PostPage.tsx): `src/pages/PostPage.tsx`
- [Inbox and messages](https://github.com/redfacesa/petangels/blob/main/src/pages/MessagesPage.tsx): `src/pages/MessagesPage.tsx`
- [Rescue and adoption](https://github.com/redfacesa/petangels/blob/main/src/pages/RescuePage.tsx): `src/pages/RescuePage.tsx`
- [Animal listings](https://github.com/redfacesa/petangels/blob/main/src/pages/AnimalPage.tsx): `src/pages/AnimalPage.tsx`

### Commerce and care

- [Marketplace](https://github.com/redfacesa/petangels/blob/main/src/pages/MarketplacePage.tsx): `src/pages/MarketplacePage.tsx`
- [Cart and checkout](https://github.com/redfacesa/petangels/blob/main/src/pages/CartPage.tsx): `src/pages/CartPage.tsx`
- [Donations](https://github.com/redfacesa/petangels/blob/main/src/pages/DonatePage.tsx): `src/pages/DonatePage.tsx`
- [Care and shelter map](https://github.com/redfacesa/petangels/blob/main/src/pages/CarePage.tsx): `src/pages/CarePage.tsx`

### Platform services

- [Catalog state](https://github.com/redfacesa/petangels/blob/main/src/contexts/CatalogContext.tsx): `src/contexts/CatalogContext.tsx`
- [Authentication state](https://github.com/redfacesa/petangels/blob/main/src/contexts/AuthContext.tsx): `src/contexts/AuthContext.tsx`
- [Domain data access](https://github.com/redfacesa/petangels/blob/main/src/lib/db.ts): `src/lib/db.ts`
- [Image storage access](https://github.com/redfacesa/petangels/blob/main/src/lib/media.ts): `src/lib/media.ts`
- [Payment handling](https://github.com/redfacesa/petangels/blob/main/src/lib/redface-pay.ts): `src/lib/redface-pay.ts`
- [Payment webhook](https://github.com/redfacesa/petangels/blob/main/supabase/functions/pay-webhook/index.ts): `supabase/functions/pay-webhook/index.ts`

### Other components

- **People**
- **Supabase**
- **RedFace Pay**
- **Paystack**

## Connections

- People → Routes and providers: opens (evidence: `src/App.tsx`)
- Routes and providers → Authentication state: provides auth (evidence: `src/App.tsx`)
- Routes and providers → Catalog state: provides catalog (evidence: `src/App.tsx`)
- Routes and providers → App shell: renders routes (evidence: `src/App.tsx`)
- Routes and providers → Sign-in and signup: routes to (evidence: `src/App.tsx`)
- Routes and providers → Home and discovery: routes to (evidence: `src/App.tsx`)
- Routes and providers → Social discovery: routes to (evidence: `src/App.tsx`)
- Routes and providers → Profiles: routes to (evidence: `src/App.tsx`)
- Routes and providers → Posts and journal: routes to (evidence: `src/App.tsx`)
- Routes and providers → Inbox and messages: routes to (evidence: `src/App.tsx`)
- Routes and providers → Rescue and adoption: routes to (evidence: `src/App.tsx`)
- Routes and providers → Animal listings: routes to (evidence: `src/App.tsx`)
- Routes and providers → Marketplace: routes to (evidence: `src/App.tsx`)
- Routes and providers → Cart and checkout: routes to (evidence: `src/App.tsx`)
- Routes and providers → Donations: routes to (evidence: `src/App.tsx`)
- Routes and providers → Care and shelter map: routes to (evidence: `src/App.tsx`)
- Routes and providers → Content creation: routes to (evidence: `src/App.tsx`)
- Catalog state → Authentication state: reads user (evidence: `src/contexts/CatalogContext.tsx`)
- Catalog state → Domain data access: loads catalog (evidence: `src/contexts/CatalogContext.tsx`)
- Authentication state → Supabase: authenticates (evidence: `src/contexts/AuthContext.tsx`)
- Domain data access → Supabase: reads and writes (evidence: `README.md`)
- Image storage access → Supabase: stores images (evidence: `README.md`)
- Social discovery → Domain data access: loads content (evidence: `src/pages/DiscoverPage.tsx`)
- Content creation → Domain data access: saves content (evidence: `src/pages/CreatePage.tsx`)
- Content creation → Image storage access: uploads images (evidence: `src/pages/CreatePage.tsx`)
- Profiles → Domain data access: loads profile data (evidence: `src/pages/ProfilePage.tsx`)
- Profiles → Image storage access: uploads avatar (evidence: `src/pages/ProfilePage.tsx`)
- Profiles → Payment handling: starts payments (evidence: `src/pages/ProfilePage.tsx`)
- Cart and checkout → Payment handling: starts checkout
- Donations → Payment handling: starts donations
- Payment handling → RedFace Pay: opens merchant checkout (evidence: `README.md`)
- Payment handling → Paystack: opens platform checkout (evidence: `README.md`)
- RedFace Pay → Payment webhook: sends payment event (evidence: `README.md`)
- Paystack → Payment webhook: sends payment event (evidence: `README.md`)
- Payment webhook → Supabase: records receipt (evidence: `README.md`)
