# grupo-bsl-challenge-fiap/vitalia-mobile-sprint3 architecture

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

- Interactive diagram: https://gitdiagram.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3
- Repository: https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3

## Overview

Vitalia is a mobile app for pet guardians to create an account, authenticate, manage pets and personal details, and view pet alerts. Its main flow runs from navigation and screens through data hooks and services to an HTTP API; session restoration also checks locally stored credentials. The README documents further profile, species/breed, and pet-management capabilities. Some links for those capabilities rely on README or SOURCE INDEX references because their source excerpts were not provided.

Main entry points: [`src/api/api.ts`](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/api/api.ts) (HTTP client), [`src/contexts/AuthContext.tsx`](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/contexts/AuthContext.tsx) (Auth context), [`src/hooks/useCreateAccount.ts`](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/hooks/useCreateAccount.ts) (Account creation), [`src/screens/AccountCreationConfirmationScreen/index.tsx`](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/screens/AccountCreationConfirmationScreen/index.tsx) (Account confirmation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["App navigation"]
  node_app["App entry<br/>[App.tsx]"]
  node_routes["Route access<br/>[AppNavigator.tsx]"]
  node_tabs["Main tabs<br/>[TabNavigator.tsx]"]
end

subgraph group_identity["Identity and session"]
  node_login["Login screen<br/>[index.tsx]"]
  node_confirmation["Account confirmation<br/>[index.tsx]"]
  node_authstate["Auth context<br/>[AuthContext.tsx]"]
  node_createaccount["Account creation"]
  node_authservice["Auth service<br/>[authService.ts]"]
  node_tokenstore["Token storage<br/>[tokenStorage.ts]"]
  node_profile["Profile management"]
  node_userservice["User service<br/>[userService.ts]"]
end

subgraph group_petcare["Pet care"]
  node_petlist["Pet list<br/>[index.tsx]"]
  node_petscreen["Pet screens"]
  node_petqueries["Pet queries"]
  node_petservice["Pet service<br/>[petService.ts]"]
  node_speciesqueries["Species and breeds"]
  node_speciesservice["Species service<br/>[speciesService.ts]"]
  node_notifications["Notifications screen<br/>[index.tsx]"]
  node_alertquery["Alert query<br/>[useAlerts.ts]"]
  node_alertservice["Alert service<br/>[alertService.ts]"]
end

subgraph group_data["Data access"]
  node_http["HTTP client<br/>[api.ts]"]
  node_querycache["Query cache<br/>[queryClient.ts]"]
end

node_guardian(("Pet guardian"))
node_backend["Vitalia REST API"]
node_securestore[("SecureStore")]
node_asyncstorage[("AsyncStorage")]

node_guardian -->|"uses"| node_routes
node_app -->|"renders"| node_routes
node_app -->|"provides"| node_querycache
node_app -->|"provides"| node_authstate
node_routes -->|"checks session"| node_authstate
node_routes -->|"routes to"| node_tabs
node_tabs -->|"routes to"| node_petlist
node_tabs -->|"routes to"| node_notifications
node_guardian -->|"signs in"| node_login
node_login -->|"uses"| node_authstate
node_guardian -->|"confirms signup"| node_confirmation
node_confirmation -->|"submits"| node_createaccount
node_confirmation -->|"loads draft"| node_asyncstorage
node_confirmation -->|"restores session"| node_authstate
node_createaccount -->|"registers and logs in"| node_authservice
node_createaccount -->|"creates pet"| node_petservice
node_createaccount -->|"invalidates cache"| node_querycache
node_createaccount -->|"clears draft"| node_asyncstorage
node_authstate -->|"loads user"| node_authservice
node_authstate -->|"reads or removes token"| node_tokenstore
node_authservice -->|"calls"| node_http
node_authservice -->|"saves token"| node_tokenstore
node_http -->|"adds bearer token"| node_tokenstore
node_tokenstore -->|"persists token"| node_securestore
node_http -->|"sends requests"| node_backend
node_petlist -->|"loads pets"| node_petqueries
node_petscreen -.->|"uses pet operations"| node_petqueries
node_petqueries -->|"calls"| node_petservice
node_petservice -->|"calls"| node_http
node_guardian -->|"manages pets"| node_petscreen
node_speciesqueries -->|"loads species and breeds"| node_speciesservice
node_speciesservice -->|"calls"| node_http
node_guardian -->|"selects pet breed"| node_speciesqueries
node_notifications -->|"loads alerts"| node_alertquery
node_alertquery -->|"calls"| node_alertservice
node_alertservice -->|"calls"| node_http
node_guardian -->|"views alerts"| node_notifications
node_guardian -->|"edits profile"| node_profile
node_profile -->|"updates user"| node_userservice
node_userservice -->|"calls"| node_http
node_profile -->|"invalidates profile cache"| node_querycache

click node_app "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/App.tsx"
click node_routes "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/navigation/AppNavigator.tsx"
click node_tabs "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/navigation/TabNavigator.tsx"
click node_login "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/screens/LoginScreen/index.tsx"
click node_confirmation "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/screens/AccountCreationConfirmationScreen/index.tsx"
click node_authstate "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/contexts/AuthContext.tsx"
click node_createaccount "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/hooks/useCreateAccount.ts"
click node_authservice "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/services/authService.ts"
click node_tokenstore "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/storage/tokenStorage.ts"
click node_petlist "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/screens/AllPetsScreen/index.tsx"
click node_petscreen "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/tree/main/src/screens"
click node_petqueries "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/tree/main/src/hooks"
click node_petservice "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/services/petService.ts"
click node_speciesqueries "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/tree/main/src/hooks"
click node_speciesservice "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/services/speciesService.ts"
click node_notifications "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/screens/NotificationsScreen/index.tsx"
click node_alertquery "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/hooks/useAlerts.ts"
click node_alertservice "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/services/alertService.ts"
click node_profile "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/tree/main/src/hooks"
click node_userservice "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/services/userService.ts"
click node_http "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/api/api.ts"
click node_querycache "https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/api/queryClient.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_routes,node_tabs toneBlue
class node_login,node_confirmation,node_authstate,node_createaccount,node_authservice,node_tokenstore,node_profile,node_userservice,node_securestore,node_asyncstorage toneAmber
class node_petlist,node_petscreen,node_petqueries,node_petservice,node_speciesqueries,node_speciesservice,node_notifications,node_alertquery,node_alertservice,node_backend toneMint
class node_http,node_querycache toneRose
class node_guardian toneIndigo
```

## Components

### App navigation

- [App entry](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/App.tsx): `App.tsx`
- [Route access](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/navigation/AppNavigator.tsx): `src/navigation/AppNavigator.tsx`
- [Main tabs](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/navigation/TabNavigator.tsx): `src/navigation/TabNavigator.tsx`

### Identity and session

- [Login screen](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/screens/LoginScreen/index.tsx): `src/screens/LoginScreen/index.tsx`
- [Account confirmation](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/screens/AccountCreationConfirmationScreen/index.tsx): `src/screens/AccountCreationConfirmationScreen/index.tsx`
- [Auth context](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/contexts/AuthContext.tsx): `src/contexts/AuthContext.tsx`
- [Account creation](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/hooks/useCreateAccount.ts): `src/hooks/useCreateAccount.ts`
- [Auth service](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/services/authService.ts): `src/services/authService.ts`
- [Token storage](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/storage/tokenStorage.ts): `src/storage/tokenStorage.ts`
- [Profile management](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/tree/main/src/hooks): `src/hooks`
- [User service](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/services/userService.ts): `src/services/userService.ts`

### Pet care

- [Pet list](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/screens/AllPetsScreen/index.tsx): `src/screens/AllPetsScreen/index.tsx`
- [Pet screens](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/tree/main/src/screens): `src/screens`
- [Pet queries](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/tree/main/src/hooks): `src/hooks`
- [Pet service](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/services/petService.ts): `src/services/petService.ts`
- [Species and breeds](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/tree/main/src/hooks): `src/hooks`
- [Species service](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/services/speciesService.ts): `src/services/speciesService.ts`
- [Notifications screen](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/screens/NotificationsScreen/index.tsx): `src/screens/NotificationsScreen/index.tsx`
- [Alert query](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/hooks/useAlerts.ts): `src/hooks/useAlerts.ts`
- [Alert service](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/services/alertService.ts): `src/services/alertService.ts`

### Data access

- [HTTP client](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/api/api.ts): `src/api/api.ts`
- [Query cache](https://github.com/grupo-bsl-challenge-fiap/vitalia-mobile-sprint3/blob/main/src/api/queryClient.ts): `src/api/queryClient.ts`

### Other components

- **Pet guardian**
- **Vitalia REST API**
- **SecureStore**
- **AsyncStorage**

## Connections

- Pet guardian → Route access: uses
- App entry → Route access: renders (evidence: `App.tsx`)
- App entry → Query cache: provides (evidence: `App.tsx`)
- App entry → Auth context: provides (evidence: `App.tsx`)
- Route access → Auth context: checks session (evidence: `src/navigation/AppNavigator.tsx`)
- Route access → Main tabs: routes to (evidence: `src/navigation/AppNavigator.tsx`)
- Main tabs → Pet list: routes to (evidence: `src/navigation/TabNavigator.tsx`)
- Main tabs → Notifications screen: routes to (evidence: `src/navigation/TabNavigator.tsx`)
- Pet guardian → Login screen: signs in
- Login screen → Auth context: uses (evidence: `src/screens/LoginScreen/index.tsx`)
- Pet guardian → Account confirmation: confirms signup
- Account confirmation → Account creation: submits (evidence: `src/screens/AccountCreationConfirmationScreen/index.tsx`)
- Account confirmation → AsyncStorage: loads draft (evidence: `src/screens/AccountCreationConfirmationScreen/index.tsx`)
- Account confirmation → Auth context: restores session (evidence: `src/screens/AccountCreationConfirmationScreen/index.tsx`)
- Account creation → Auth service: registers and logs in (evidence: `src/hooks/useCreateAccount.ts`)
- Account creation → Pet service: creates pet (evidence: `src/hooks/useCreateAccount.ts`)
- Account creation → Query cache: invalidates cache (evidence: `src/hooks/useCreateAccount.ts`)
- Account creation → AsyncStorage: clears draft (evidence: `src/hooks/useCreateAccount.ts`)
- Auth context → Auth service: loads user (evidence: `src/contexts/AuthContext.tsx`)
- Auth context → Token storage: reads or removes token (evidence: `src/contexts/AuthContext.tsx`)
- Auth service → HTTP client: calls (evidence: `src/services/authService.ts`)
- Auth service → Token storage: saves token (evidence: `src/services/authService.ts`)
- HTTP client → Token storage: adds bearer token (evidence: `src/api/api.ts`)
- Token storage → SecureStore: persists token (evidence: `src/storage/tokenStorage.ts`)
- HTTP client → Vitalia REST API: sends requests (evidence: `src/api/api.ts`)
- Pet list → Pet queries: loads pets (evidence: `src/screens/AllPetsScreen/index.tsx`)
- Pet screens → Pet queries: uses pet operations (evidence: `src/screens/NotificationsScreen/index.tsx`)
- Pet queries → Pet service: calls (evidence: `src/hooks/useCreatePet.ts`)
- Pet service → HTTP client: calls (evidence: `src/services/petService.ts`)
- Pet guardian → Pet screens: manages pets
- Species and breeds → Species service: loads species and breeds (evidence: `src/hooks/useBreeds.ts`)
- Species service → HTTP client: calls (evidence: `src/services/speciesService.ts`)
- Pet guardian → Species and breeds: selects pet breed
- Notifications screen → Alert query: loads alerts (evidence: `src/screens/NotificationsScreen/index.tsx`)
- Alert query → Alert service: calls (evidence: `src/hooks/useAlerts.ts`)
- Alert service → HTTP client: calls (evidence: `src/services/alertService.ts`)
- Pet guardian → Notifications screen: views alerts
- Pet guardian → Profile management: edits profile
- Profile management → User service: updates user (evidence: `src/hooks/useUpdateCurrentUser.ts`)
- User service → HTTP client: calls (evidence: `src/services/userService.ts`)
- Profile management → Query cache: invalidates profile cache (evidence: `src/hooks/useUpdateCurrentUser.ts`)
