# myronferz2309/petconnect23 architecture

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

- Interactive diagram: https://gitdiagram.com/myronferz2309/petconnect23
- Repository: https://github.com/myronferz2309/petconnect23

## Overview

PetConnect is a mobile pet-adoption marketplace. Users discover or search listings, inspect pet profiles, save favorites, and submit adoption applications; owners review requests and communicate with applicants. Separate branches provide preference-based matching and AI pet-care plans. The README documents Firebase-backed synchronization and a local demo/offline fallback. The graph uses the sampled screen references and service imports; several screen and context implementations were not excerpted, so uncertain call relationships are omitted.

Main entry points: [`src/context/PetContext.tsx`](https://github.com/myronferz2309/petconnect23/blob/main/src/context/PetContext.tsx) (Pet app state), [`src/components/PetCard.tsx`](https://github.com/myronferz2309/petconnect23/blob/main/src/components/PetCard.tsx) (Pet cards), [`src/app/(tabs)/index.tsx`](https://github.com/myronferz2309/petconnect23/blob/main/src/app/(tabs)/index.tsx) (Pet feed), [`src/services/authService.ts`](https://github.com/myronferz2309/petconnect23/blob/main/src/services/authService.ts) (Authentication service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Pet discovery"]
  node_home["Pet feed<br/>[index.tsx]"]
  node_search["Pet search<br/>[search.tsx]"]
  node_petdetail["Pet profile<br/>[&#91;id&#93;.tsx]"]
  node_petcard["Pet cards<br/>[PetCard.tsx]"]
  node_petimage["Pet images<br/>[PetImage.tsx]"]
  node_imagehelper["Image fallback<br/>[imageHelper.ts]"]
  node_saved["Saved pets<br/>[saved-pets.tsx]"]
  node_addpet["Create listing<br/>[add-pet.tsx]"]
end

subgraph group_adoption["Adoption workflow"]
  node_applications["My applications"]
  node_apply["Apply to adopt<br/>[&#91;id&#93;.tsx]"]
  node_success["Application result<br/>[success.tsx]"]
  node_chat["Application chat"]
  node_profile["Account profile<br/>[profile.tsx]"]
  node_authmodal["Sign-in dialog<br/>[AuthModal.tsx]"]
end

subgraph group_assistance["AI assistance"]
  node_matching["AI pet matching<br/>[ai-match.tsx]"]
  node_matchservice["Match scoring"]
  node_knn["KNN recommendations"]
  node_care["Pet-care assistant<br/>[pet-care-ai.tsx]"]
  node_careservice["Care-plan service"]
end

subgraph group_platform["App and services"]
  node_context["Pet app state<br/>[PetContext.tsx]"]
  node_demo["Demo pet data<br/>[initialPets.ts]"]
  node_storageadapter["Local persistence<br/>[storageAdapter.ts]"]
  node_firestore["Cloud data service"]
  node_authservice["Authentication service<br/>[authService.ts]"]
  node_firebase["Firebase setup<br/>[firebase.ts]"]
  node_cloud[("Firebase backend")]
  node_storage["Media storage<br/>[storageService.ts]"]
end

node_user(("Pet adopter"))
node_supabase[("Supabase Storage")]

node_user -->|"browses"| node_home
node_home -->|"reads state"| node_context
node_home -->|"renders"| node_petcard
node_search -->|"reads state"| node_context
node_search -->|"renders"| node_petcard
node_petdetail -->|"reads state"| node_context
node_saved -->|"reads state"| node_context
node_saved -->|"renders"| node_petcard
node_petcard -->|"renders"| node_petimage
node_petimage -->|"normalizes images"| node_imagehelper
node_addpet -->|"updates listings"| node_context
node_addpet -->|"uploads media"| node_storage
node_user -->|"filters pets"| node_search
node_user -->|"submits request"| node_apply
node_apply -->|"submits application"| node_context
node_applications -->|"reads applications"| node_context
node_applications -->|"opens chat"| node_chat
node_success -->|"reads state"| node_context
node_profile -->|"updates account"| node_context
node_authmodal -->|"uses state"| node_context
node_matching -->|"reads pets"| node_context
node_matching -->|"requests matches"| node_matchservice
node_matchservice -->|"delegates scoring"| node_knn
node_care -->|"reads pet data"| node_context
node_care -->|"requests care plan"| node_careservice
node_context -->|"loads defaults"| node_demo
node_context -->|"loads local data"| node_storageadapter
node_context -->|"updates profile"| node_authservice
node_context -->|"syncs cloud data"| node_firestore
node_firestore -->|"reads and writes"| node_cloud
node_authservice -->|"checks configuration"| node_firebase
node_authservice -->|"authenticates users"| node_cloud
node_storage -->|"uses fallback images"| node_imagehelper
node_storage -->|"uploads files"| node_supabase

click node_home "https://github.com/myronferz2309/petconnect23/blob/main/src/app/(tabs)/index.tsx"
click node_search "https://github.com/myronferz2309/petconnect23/blob/main/src/app/(tabs)/search.tsx"
click node_petdetail "https://github.com/myronferz2309/petconnect23/blob/main/src/app/pet/%5Bid%5D.tsx"
click node_petcard "https://github.com/myronferz2309/petconnect23/blob/main/src/components/PetCard.tsx"
click node_petimage "https://github.com/myronferz2309/petconnect23/blob/main/src/components/PetImage.tsx"
click node_imagehelper "https://github.com/myronferz2309/petconnect23/blob/main/src/utils/imageHelper.ts"
click node_saved "https://github.com/myronferz2309/petconnect23/blob/main/src/app/saved-pets.tsx"
click node_addpet "https://github.com/myronferz2309/petconnect23/blob/main/src/app/(tabs)/add-pet.tsx"
click node_applications "https://github.com/myronferz2309/petconnect23/blob/main/src/app/my-applications.tsx"
click node_apply "https://github.com/myronferz2309/petconnect23/blob/main/src/app/apply/%5Bid%5D.tsx"
click node_success "https://github.com/myronferz2309/petconnect23/blob/main/src/app/success.tsx"
click node_chat "https://github.com/myronferz2309/petconnect23/blob/main/src/components/ApplicationChatModal.tsx"
click node_profile "https://github.com/myronferz2309/petconnect23/blob/main/src/app/(tabs)/profile.tsx"
click node_authmodal "https://github.com/myronferz2309/petconnect23/blob/main/src/components/AuthModal.tsx"
click node_matching "https://github.com/myronferz2309/petconnect23/blob/main/src/app/ai-match.tsx"
click node_matchservice "https://github.com/myronferz2309/petconnect23/blob/main/src/services/aiMatchingService.ts"
click node_knn "https://github.com/myronferz2309/petconnect23/blob/main/src/services/knnRecommendationService.ts"
click node_care "https://github.com/myronferz2309/petconnect23/blob/main/src/app/pet-care-ai.tsx"
click node_careservice "https://github.com/myronferz2309/petconnect23/blob/main/src/services/petCareAiService.ts"
click node_context "https://github.com/myronferz2309/petconnect23/blob/main/src/context/PetContext.tsx"
click node_demo "https://github.com/myronferz2309/petconnect23/blob/main/src/data/initialPets.ts"
click node_storageadapter "https://github.com/myronferz2309/petconnect23/blob/main/src/services/storageAdapter.ts"
click node_firestore "https://github.com/myronferz2309/petconnect23/blob/main/src/services/firestoreService.ts"
click node_authservice "https://github.com/myronferz2309/petconnect23/blob/main/src/services/authService.ts"
click node_firebase "https://github.com/myronferz2309/petconnect23/blob/main/src/services/firebase.ts"
click node_storage "https://github.com/myronferz2309/petconnect23/blob/main/src/services/storageService.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_search,node_petdetail,node_petcard,node_petimage,node_imagehelper,node_saved,node_addpet toneBlue
class node_applications,node_apply,node_success,node_chat,node_profile,node_authmodal,node_supabase toneAmber
class node_matching,node_matchservice,node_knn,node_care,node_careservice toneMint
class node_context,node_demo,node_storageadapter,node_firestore,node_authservice,node_firebase,node_cloud,node_storage toneRose
class node_user toneIndigo
```

## Components

### Pet discovery

- [Pet feed](https://github.com/myronferz2309/petconnect23/blob/main/src/app/(tabs)/index.tsx): `src/app/(tabs)/index.tsx`
- [Pet search](https://github.com/myronferz2309/petconnect23/blob/main/src/app/(tabs)/search.tsx): `src/app/(tabs)/search.tsx`
- [Pet profile](https://github.com/myronferz2309/petconnect23/blob/main/src/app/pet/%5Bid%5D.tsx): `src/app/pet/[id].tsx`
- [Pet cards](https://github.com/myronferz2309/petconnect23/blob/main/src/components/PetCard.tsx): `src/components/PetCard.tsx`
- [Pet images](https://github.com/myronferz2309/petconnect23/blob/main/src/components/PetImage.tsx): `src/components/PetImage.tsx`
- [Image fallback](https://github.com/myronferz2309/petconnect23/blob/main/src/utils/imageHelper.ts): `src/utils/imageHelper.ts`
- [Saved pets](https://github.com/myronferz2309/petconnect23/blob/main/src/app/saved-pets.tsx): `src/app/saved-pets.tsx`
- [Create listing](https://github.com/myronferz2309/petconnect23/blob/main/src/app/(tabs)/add-pet.tsx): `src/app/(tabs)/add-pet.tsx`

### Adoption workflow

- [My applications](https://github.com/myronferz2309/petconnect23/blob/main/src/app/my-applications.tsx): `src/app/my-applications.tsx`
- [Apply to adopt](https://github.com/myronferz2309/petconnect23/blob/main/src/app/apply/%5Bid%5D.tsx): `src/app/apply/[id].tsx`
- [Application result](https://github.com/myronferz2309/petconnect23/blob/main/src/app/success.tsx): `src/app/success.tsx`
- [Application chat](https://github.com/myronferz2309/petconnect23/blob/main/src/components/ApplicationChatModal.tsx): `src/components/ApplicationChatModal.tsx`
- [Account profile](https://github.com/myronferz2309/petconnect23/blob/main/src/app/(tabs)/profile.tsx): `src/app/(tabs)/profile.tsx`
- [Sign-in dialog](https://github.com/myronferz2309/petconnect23/blob/main/src/components/AuthModal.tsx): `src/components/AuthModal.tsx`

### AI assistance

- [AI pet matching](https://github.com/myronferz2309/petconnect23/blob/main/src/app/ai-match.tsx): `src/app/ai-match.tsx`
- [Match scoring](https://github.com/myronferz2309/petconnect23/blob/main/src/services/aiMatchingService.ts): `src/services/aiMatchingService.ts`
- [KNN recommendations](https://github.com/myronferz2309/petconnect23/blob/main/src/services/knnRecommendationService.ts): `src/services/knnRecommendationService.ts`
- [Pet-care assistant](https://github.com/myronferz2309/petconnect23/blob/main/src/app/pet-care-ai.tsx): `src/app/pet-care-ai.tsx`
- [Care-plan service](https://github.com/myronferz2309/petconnect23/blob/main/src/services/petCareAiService.ts): `src/services/petCareAiService.ts`

### App and services

- [Pet app state](https://github.com/myronferz2309/petconnect23/blob/main/src/context/PetContext.tsx): `src/context/PetContext.tsx`
- [Demo pet data](https://github.com/myronferz2309/petconnect23/blob/main/src/data/initialPets.ts): `src/data/initialPets.ts`
- [Local persistence](https://github.com/myronferz2309/petconnect23/blob/main/src/services/storageAdapter.ts): `src/services/storageAdapter.ts`
- [Cloud data service](https://github.com/myronferz2309/petconnect23/blob/main/src/services/firestoreService.ts): `src/services/firestoreService.ts`
- [Authentication service](https://github.com/myronferz2309/petconnect23/blob/main/src/services/authService.ts): `src/services/authService.ts`
- [Firebase setup](https://github.com/myronferz2309/petconnect23/blob/main/src/services/firebase.ts): `src/services/firebase.ts`
- **Firebase backend**
- [Media storage](https://github.com/myronferz2309/petconnect23/blob/main/src/services/storageService.ts): `src/services/storageService.ts`

### Other components

- **Pet adopter**
- **Supabase Storage**

## Connections

- Pet adopter → Pet feed: browses
- Pet feed → Pet app state: reads state (evidence: `src/app/(tabs)/index.tsx`)
- Pet feed → Pet cards: renders (evidence: `src/app/(tabs)/index.tsx`)
- Pet search → Pet app state: reads state (evidence: `src/app/(tabs)/search.tsx`)
- Pet search → Pet cards: renders (evidence: `src/app/(tabs)/search.tsx`)
- Pet profile → Pet app state: reads state (evidence: `src/app/pet/[id].tsx`)
- Saved pets → Pet app state: reads state (evidence: `src/app/saved-pets.tsx`)
- Saved pets → Pet cards: renders (evidence: `src/app/saved-pets.tsx`)
- Pet cards → Pet images: renders (evidence: `src/components/PetCard.tsx`)
- Pet images → Image fallback: normalizes images (evidence: `src/components/PetImage.tsx`)
- Create listing → Pet app state: updates listings (evidence: `src/app/(tabs)/add-pet.tsx`)
- Create listing → Media storage: uploads media (evidence: `src/app/(tabs)/add-pet.tsx`)
- Pet adopter → Pet search: filters pets
- Pet adopter → Apply to adopt: submits request
- Apply to adopt → Pet app state: submits application (evidence: `src/app/apply/[id].tsx`)
- My applications → Pet app state: reads applications (evidence: `src/app/my-applications.tsx`)
- My applications → Application chat: opens chat (evidence: `src/app/my-applications.tsx`)
- Application result → Pet app state: reads state (evidence: `src/app/success.tsx`)
- Account profile → Pet app state: updates account (evidence: `src/app/(tabs)/profile.tsx`)
- Sign-in dialog → Pet app state: uses state (evidence: `src/components/AuthModal.tsx`)
- AI pet matching → Pet app state: reads pets (evidence: `src/app/ai-match.tsx`)
- AI pet matching → Match scoring: requests matches (evidence: `src/app/ai-match.tsx`)
- Match scoring → KNN recommendations: delegates scoring (evidence: `src/services/aiMatchingService.ts`)
- Pet-care assistant → Pet app state: reads pet data (evidence: `src/app/pet-care-ai.tsx`)
- Pet-care assistant → Care-plan service: requests care plan (evidence: `src/app/pet-care-ai.tsx`)
- Pet app state → Demo pet data: loads defaults (evidence: `src/context/PetContext.tsx`)
- Pet app state → Local persistence: loads local data (evidence: `src/context/PetContext.tsx`)
- Pet app state → Authentication service: updates profile (evidence: `src/context/PetContext.tsx`)
- Pet app state → Cloud data service: syncs cloud data (evidence: `src/context/PetContext.tsx`)
- Cloud data service → Firebase backend: reads and writes (evidence: `src/services/firestoreService.ts`)
- Authentication service → Firebase setup: checks configuration (evidence: `src/services/authService.ts`)
- Authentication service → Firebase backend: authenticates users (evidence: `src/services/authService.ts`)
- Media storage → Image fallback: uses fallback images (evidence: `src/services/storageService.ts`)
- Media storage → Supabase Storage: uploads files (evidence: `src/services/storageService.ts`)
