# alaaeddine20/pet-rescue architecture

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

- Interactive diagram: https://gitdiagram.com/alaaeddine20/pet-rescue
- Repository: https://github.com/alaaeddine20/pet-rescue

## Overview

This is a React Native animal-rescue reporting app with separate citizen and organization experiences. The main workflow is sign-in or onboarding, submitting a located and photographed animal report, then viewing its status; organization members can browse relevant reports and claim pending cases. Authentication/profile state and Supabase-backed services form the key internal layer. The README is empty, and several routes and services were not excerpted, so those relationships are included only where the SOURCE INDEX supports them; the RUNTS external integration remains unverified.

Main entry points: [`src/hooks/useAuthContext.ts`](https://github.com/alaaeddine20/pet-rescue/blob/main/src/hooks/useAuthContext.ts) (Auth hook), [`src/lib/supabase.ts`](https://github.com/alaaeddine20/pet-rescue/blob/main/src/lib/supabase.ts) (Supabase client), [`src/app/(app)/report/new.tsx`](https://github.com/alaaeddine20/pet-rescue/blob/main/src/app/(app)/report/new.tsx) (New report screen), [`src/services/report.ts`](https://github.com/alaaeddine20/pet-rescue/blob/main/src/services/report.ts) (Report service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and onboarding"]
  node_app_shell["App shell<br/>[_layout.tsx]"]
  node_auth_screen["Sign-in screen<br/>[NoAuthScreen.tsx]"]
  node_sign_in["Sign-in form<br/>[SignInForm.tsx]"]
  node_sign_up["Sign-up form<br/>[SignUpForm.tsx]"]
  node_auth_provider["Auth provider<br/>[AuthProvider.tsx]"]
  node_auth_context["Auth context<br/>[AuthContext.ts]"]
  node_auth_hook["Auth hook<br/>[useAuthContext.ts]"]
  node_error_mapper["Auth errors<br/>[authErrorMapper.ts]"]
  node_onboarding["Organization onboarding<br/>[organization.tsx]"]
  node_onboard_hook["Onboarding hook<br/>[useOnboarding.ts]"]
  node_runts_hook["RUNTS lookup hook"]
end

subgraph group_citizen["Citizen reporting"]
  node_citizen_home["Citizen home"]
  node_new_report["New report screen<br/>[new.tsx]"]
  node_location["Current location"]
  node_photo_picker["Photo picker<br/>[PhotoPicker.tsx]"]
  node_report_hook["Citizen reports hook<br/>[useReports.ts]"]
  node_report_list["Report list<br/>[ReportList.tsx]"]
end

subgraph group_response["Organization response"]
  node_org_home["Organization home"]
  node_org_reports["Organization reports hook"]
  node_claim_hook["Claim reports hook<br/>[useClaimReports.ts]"]
end

subgraph group_backend["Identity and data"]
  node_onboard_service["Onboarding service<br/>[onboarding.ts]"]
  node_runts_service["RUNTS service<br/>[runts.ts]"]
  node_report_service["Report service<br/>[report.ts]"]
  node_profile_service["Profile service<br/>[profile.ts]"]
  node_supabase_client["Supabase client<br/>[supabase.ts]"]
end

node_person(("App user"))
node_runts[("RUNTS registry")]
node_supabase[("Supabase")]

node_person -.->|"opens"| node_app_shell
node_app_shell -->|"provides auth"| node_auth_provider
node_app_shell -->|"reads auth"| node_auth_hook
node_person -.->|"signs in"| node_auth_screen
node_auth_screen -->|"renders"| node_sign_in
node_auth_screen -->|"renders"| node_sign_up
node_sign_in -->|"uses auth"| node_auth_hook
node_sign_up -->|"uses auth"| node_auth_hook
node_sign_in -->|"maps errors"| node_error_mapper
node_sign_up -->|"maps errors"| node_error_mapper
node_auth_provider -->|"provides state"| node_auth_context
node_auth_hook -->|"reads context"| node_auth_context
node_auth_provider -->|"loads profile"| node_profile_service
node_auth_provider -->|"auth operations"| node_supabase_client
node_person -.->|"enters details"| node_onboarding
node_onboarding -->|"submits onboarding"| node_onboard_hook
node_onboarding -->|"checks tax code"| node_runts_hook
node_onboard_hook -->|"saves profile"| node_onboard_service
node_runts_hook -->|"looks up entity"| node_runts_service
node_runts_service -->|"queries data"| node_supabase_client
node_runts_service -.->|"registry lookup"| node_runts
node_onboard_service -->|"writes data"| node_supabase_client
node_person -.->|"views reports"| node_citizen_home
node_citizen_home -->|"loads reports"| node_report_hook
node_citizen_home -->|"renders"| node_report_list
node_person -.->|"creates report"| node_new_report
node_new_report -->|"gets user"| node_auth_hook
node_new_report -->|"gets location"| node_location
node_new_report -->|"captures photo"| node_photo_picker
node_new_report -->|"creates report"| node_report_service
node_report_hook -.->|"loads reports"| node_report_service
node_person -.->|"views cases"| node_org_home
node_org_home -->|"loads cases"| node_org_reports
node_org_home -->|"claims case"| node_claim_hook
node_org_reports -->|"fetches cases"| node_report_service
node_claim_hook -->|"claims report"| node_report_service
node_claim_hook -->|"gets responder"| node_auth_hook
node_report_service -->|"reads and writes"| node_supabase_client
node_profile_service -->|"loads profile"| node_supabase_client
node_supabase_client -->|"connects"| node_supabase

click node_app_shell "https://github.com/alaaeddine20/pet-rescue/blob/main/src/app/_layout.tsx"
click node_auth_screen "https://github.com/alaaeddine20/pet-rescue/blob/main/src/app/(auth)/NoAuthScreen.tsx"
click node_sign_in "https://github.com/alaaeddine20/pet-rescue/blob/main/src/components/SignInForm.tsx"
click node_sign_up "https://github.com/alaaeddine20/pet-rescue/blob/main/src/components/SignUpForm.tsx"
click node_auth_provider "https://github.com/alaaeddine20/pet-rescue/blob/main/src/providers/AuthProvider.tsx"
click node_auth_context "https://github.com/alaaeddine20/pet-rescue/blob/main/src/context/AuthContext.ts"
click node_auth_hook "https://github.com/alaaeddine20/pet-rescue/blob/main/src/hooks/useAuthContext.ts"
click node_error_mapper "https://github.com/alaaeddine20/pet-rescue/blob/main/src/mappers/authErrorMapper.ts"
click node_onboarding "https://github.com/alaaeddine20/pet-rescue/blob/main/src/app/onboarding/organization.tsx"
click node_onboard_hook "https://github.com/alaaeddine20/pet-rescue/blob/main/src/hooks/useOnboarding.ts"
click node_onboard_service "https://github.com/alaaeddine20/pet-rescue/blob/main/src/services/onboarding.ts"
click node_runts_hook "https://github.com/alaaeddine20/pet-rescue/blob/main/src/hooks/useRuntsEntityByTaxCode.ts"
click node_runts_service "https://github.com/alaaeddine20/pet-rescue/blob/main/src/services/runts.ts"
click node_citizen_home "https://github.com/alaaeddine20/pet-rescue/blob/main/src/app/(app)/CitizenHomeScreen.tsx"
click node_new_report "https://github.com/alaaeddine20/pet-rescue/blob/main/src/app/(app)/report/new.tsx"
click node_location "https://github.com/alaaeddine20/pet-rescue/blob/main/src/hooks/useCurrentLocation.ts"
click node_photo_picker "https://github.com/alaaeddine20/pet-rescue/blob/main/src/components/PhotoPicker.tsx"
click node_report_hook "https://github.com/alaaeddine20/pet-rescue/blob/main/src/hooks/useReports.ts"
click node_report_list "https://github.com/alaaeddine20/pet-rescue/blob/main/src/components/ReportList.tsx"
click node_org_home "https://github.com/alaaeddine20/pet-rescue/blob/main/src/app/(app)/OrganizationHomeScreen.tsx"
click node_org_reports "https://github.com/alaaeddine20/pet-rescue/blob/main/src/hooks/useOrganizationReports.ts"
click node_claim_hook "https://github.com/alaaeddine20/pet-rescue/blob/main/src/hooks/useClaimReports.ts"
click node_report_service "https://github.com/alaaeddine20/pet-rescue/blob/main/src/services/report.ts"
click node_profile_service "https://github.com/alaaeddine20/pet-rescue/blob/main/src/services/profile.ts"
click node_supabase_client "https://github.com/alaaeddine20/pet-rescue/blob/main/src/lib/supabase.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_shell,node_auth_screen,node_sign_in,node_sign_up,node_auth_provider,node_auth_context,node_auth_hook,node_error_mapper,node_onboarding,node_onboard_hook,node_runts_hook,node_person toneBlue
class node_citizen_home,node_new_report,node_location,node_photo_picker,node_report_hook,node_report_list,node_runts,node_supabase toneAmber
class node_org_home,node_org_reports,node_claim_hook toneMint
class node_onboard_service,node_runts_service,node_report_service,node_profile_service,node_supabase_client toneRose
```

## Components

### Access and onboarding

- [App shell](https://github.com/alaaeddine20/pet-rescue/blob/main/src/app/_layout.tsx): `src/app/_layout.tsx`
- [Sign-in screen](https://github.com/alaaeddine20/pet-rescue/blob/main/src/app/(auth)/NoAuthScreen.tsx): `src/app/(auth)/NoAuthScreen.tsx`
- [Sign-in form](https://github.com/alaaeddine20/pet-rescue/blob/main/src/components/SignInForm.tsx): `src/components/SignInForm.tsx`
- [Sign-up form](https://github.com/alaaeddine20/pet-rescue/blob/main/src/components/SignUpForm.tsx): `src/components/SignUpForm.tsx`
- [Auth provider](https://github.com/alaaeddine20/pet-rescue/blob/main/src/providers/AuthProvider.tsx): `src/providers/AuthProvider.tsx`
- [Auth context](https://github.com/alaaeddine20/pet-rescue/blob/main/src/context/AuthContext.ts): `src/context/AuthContext.ts`
- [Auth hook](https://github.com/alaaeddine20/pet-rescue/blob/main/src/hooks/useAuthContext.ts): `src/hooks/useAuthContext.ts`
- [Auth errors](https://github.com/alaaeddine20/pet-rescue/blob/main/src/mappers/authErrorMapper.ts): `src/mappers/authErrorMapper.ts`
- [Organization onboarding](https://github.com/alaaeddine20/pet-rescue/blob/main/src/app/onboarding/organization.tsx): `src/app/onboarding/organization.tsx`
- [Onboarding hook](https://github.com/alaaeddine20/pet-rescue/blob/main/src/hooks/useOnboarding.ts): `src/hooks/useOnboarding.ts`
- [RUNTS lookup hook](https://github.com/alaaeddine20/pet-rescue/blob/main/src/hooks/useRuntsEntityByTaxCode.ts): `src/hooks/useRuntsEntityByTaxCode.ts`

### Citizen reporting

- [Citizen home](https://github.com/alaaeddine20/pet-rescue/blob/main/src/app/(app)/CitizenHomeScreen.tsx): `src/app/(app)/CitizenHomeScreen.tsx`
- [New report screen](https://github.com/alaaeddine20/pet-rescue/blob/main/src/app/(app)/report/new.tsx): `src/app/(app)/report/new.tsx`
- [Current location](https://github.com/alaaeddine20/pet-rescue/blob/main/src/hooks/useCurrentLocation.ts): `src/hooks/useCurrentLocation.ts`
- [Photo picker](https://github.com/alaaeddine20/pet-rescue/blob/main/src/components/PhotoPicker.tsx): `src/components/PhotoPicker.tsx`
- [Citizen reports hook](https://github.com/alaaeddine20/pet-rescue/blob/main/src/hooks/useReports.ts): `src/hooks/useReports.ts`
- [Report list](https://github.com/alaaeddine20/pet-rescue/blob/main/src/components/ReportList.tsx): `src/components/ReportList.tsx`

### Organization response

- [Organization home](https://github.com/alaaeddine20/pet-rescue/blob/main/src/app/(app)/OrganizationHomeScreen.tsx): `src/app/(app)/OrganizationHomeScreen.tsx`
- [Organization reports hook](https://github.com/alaaeddine20/pet-rescue/blob/main/src/hooks/useOrganizationReports.ts): `src/hooks/useOrganizationReports.ts`
- [Claim reports hook](https://github.com/alaaeddine20/pet-rescue/blob/main/src/hooks/useClaimReports.ts): `src/hooks/useClaimReports.ts`

### Identity and data

- [Onboarding service](https://github.com/alaaeddine20/pet-rescue/blob/main/src/services/onboarding.ts): `src/services/onboarding.ts`
- [RUNTS service](https://github.com/alaaeddine20/pet-rescue/blob/main/src/services/runts.ts): `src/services/runts.ts`
- [Report service](https://github.com/alaaeddine20/pet-rescue/blob/main/src/services/report.ts): `src/services/report.ts`
- [Profile service](https://github.com/alaaeddine20/pet-rescue/blob/main/src/services/profile.ts): `src/services/profile.ts`
- [Supabase client](https://github.com/alaaeddine20/pet-rescue/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`

### Other components

- **App user**
- **RUNTS registry**
- **Supabase**

## Connections

- App user → App shell: opens
- App shell → Auth provider: provides auth (evidence: `src/app/_layout.tsx`)
- App shell → Auth hook: reads auth (evidence: `src/app/_layout.tsx`)
- App user → Sign-in screen: signs in
- Sign-in screen → Sign-in form: renders (evidence: `src/app/(auth)/NoAuthScreen.tsx`)
- Sign-in screen → Sign-up form: renders (evidence: `src/app/(auth)/NoAuthScreen.tsx`)
- Sign-in form → Auth hook: uses auth (evidence: `src/components/SignInForm.tsx`)
- Sign-up form → Auth hook: uses auth (evidence: `src/components/SignUpForm.tsx`)
- Sign-in form → Auth errors: maps errors (evidence: `src/components/SignInForm.tsx`)
- Sign-up form → Auth errors: maps errors (evidence: `src/components/SignUpForm.tsx`)
- Auth provider → Auth context: provides state (evidence: `src/providers/AuthProvider.tsx`)
- Auth hook → Auth context: reads context (evidence: `src/hooks/useAuthContext.ts`)
- Auth provider → Profile service: loads profile (evidence: `src/providers/AuthProvider.tsx`)
- Auth provider → Supabase client: auth operations (evidence: `src/providers/AuthProvider.tsx`)
- App user → Organization onboarding: enters details
- Organization onboarding → Onboarding hook: submits onboarding (evidence: `src/app/onboarding/organization.tsx`)
- Organization onboarding → RUNTS lookup hook: checks tax code (evidence: `src/app/onboarding/organization.tsx`)
- Onboarding hook → Onboarding service: saves profile (evidence: `src/hooks/useOnboarding.ts`)
- RUNTS lookup hook → RUNTS service: looks up entity (evidence: `src/hooks/useRuntsEntityByTaxCode.ts`)
- RUNTS service → Supabase client: queries data (evidence: `src/services/runts.ts`)
- RUNTS service → RUNTS registry: registry lookup
- Onboarding service → Supabase client: writes data (evidence: `src/services/onboarding.ts`)
- App user → Citizen home: views reports
- Citizen home → Citizen reports hook: loads reports (evidence: `src/app/(app)/CitizenHomeScreen.tsx`)
- Citizen home → Report list: renders (evidence: `src/app/(app)/CitizenHomeScreen.tsx`)
- App user → New report screen: creates report
- New report screen → Auth hook: gets user (evidence: `src/app/(app)/report/new.tsx`)
- New report screen → Current location: gets location (evidence: `src/app/(app)/report/new.tsx`)
- New report screen → Photo picker: captures photo (evidence: `src/app/(app)/report/new.tsx`)
- New report screen → Report service: creates report (evidence: `src/app/(app)/report/new.tsx`)
- Citizen reports hook → Report service: loads reports
- App user → Organization home: views cases
- Organization home → Organization reports hook: loads cases (evidence: `src/app/(app)/OrganizationHomeScreen.tsx`)
- Organization home → Claim reports hook: claims case (evidence: `src/app/(app)/OrganizationHomeScreen.tsx`)
- Organization reports hook → Report service: fetches cases (evidence: `src/hooks/useOrganizationReports.ts`)
- Claim reports hook → Report service: claims report (evidence: `src/hooks/useClaimReports.ts`)
- Claim reports hook → Auth hook: gets responder (evidence: `src/hooks/useClaimReports.ts`)
- Report service → Supabase client: reads and writes (evidence: `src/services/report.ts`)
- Profile service → Supabase client: loads profile (evidence: `src/services/profile.ts`)
- Supabase client → Supabase: connects (evidence: `src/lib/supabase.ts`)
