# ana-coahuila/metafit-application architecture

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

- Interactive diagram: https://gitdiagram.com/ana-coahuila/metafit-application
- Repository: https://github.com/ana-coahuila/metafit-application

## Overview

METAFIT is a React Native fitness and nutrition app. Users register or sign in, then enter tabbed screens for a dashboard, personalized plan, recipes, progress, and profile management. The shared auth context persists tokens and communicates with the authentication API; plan generation and event-based plan adaptation also call backend services. The supplied excerpts confirm navigation, authentication, profile updates, and selected plan requests. Other screen behavior is not detailed, so their internal data flows are omitted.

Main entry points: [`src/navigator/TabNavigator.tsx`](https://github.com/ana-coahuila/metafit-application/blob/main/src/navigator/TabNavigator.tsx) (Feature tabs), [`src/styles`](https://github.com/ana-coahuila/metafit-application/tree/main/src/styles) (Screen styles), [`src/context/AuthContext.tsx`](https://github.com/ana-coahuila/metafit-application/blob/main/src/context/AuthContext.tsx) (Auth state), [`src/auth/login.tsx`](https://github.com/ana-coahuila/metafit-application/blob/main/src/auth/login.tsx) (Login)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App shell"]
  node_app["App entry<br/>[App.tsx]"]
  node_authnav["Auth navigation<br/>[AuthNavigator.tsx]"]
  node_tabs["Feature tabs<br/>[TabNavigator.tsx]"]
end

subgraph group_auth["Identity"]
  node_login["Login<br/>[login.tsx]"]
  node_register["Registration<br/>[register.tsx]"]
  node_authstate["Auth state<br/>[AuthContext.tsx]"]
end

subgraph group_fitness["Fitness features"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_plan["Meal and exercise plan<br/>[Plan.tsx]"]
  node_recipes["Recipes<br/>[Recipe.tsx]"]
  node_progress["Progress<br/>[Progress.tsx]"]
  node_profile["Profile<br/>[Profile.tsx]"]
end

subgraph group_ui["Shared UI"]
  node_button["Button<br/>[Button.tsx]"]
  node_input["Input<br/>[Input.tsx]"]
  node_styles["Screen styles"]
  node_types["Domain types<br/>[types.ts]"]
end

node_user(("App user"))
node_authapi{{"Auth service"}}
node_planapi{{"Plan backend"}}
node_adaptapi{{"Adaptation service"}}

node_user -->|"opens"| node_app
node_app -->|"provides auth"| node_authstate
node_app -->|"renders"| node_authnav
node_authnav -->|"routes to"| node_login
node_authnav -->|"routes to"| node_register
node_authnav -->|"routes to"| node_tabs
node_login -->|"calls login"| node_authstate
node_register -->|"calls register"| node_authstate
node_authstate -->|"auth requests"| node_authapi
node_tabs -->|"routes to"| node_dashboard
node_tabs -->|"routes to"| node_plan
node_tabs -->|"routes to"| node_recipes
node_tabs -->|"routes to"| node_progress
node_tabs -->|"routes to"| node_profile
node_profile -->|"updates account"| node_authstate
node_plan -->|"generates plan"| node_planapi
node_plan -->|"adapts plan"| node_adaptapi
node_login -->|"renders"| node_input
node_login -->|"renders"| node_button
node_register -->|"renders"| node_input
node_register -->|"renders"| node_button
node_login -->|"uses styles"| node_styles
node_register -->|"uses styles"| node_styles
node_dashboard -->|"uses styles"| node_styles
node_plan -->|"uses styles"| node_styles
node_profile -->|"uses styles"| node_styles
node_progress -->|"uses styles"| node_styles
node_recipes -->|"uses styles"| node_styles
node_authstate -->|"uses user type"| node_types
node_recipes -->|"uses recipe types"| node_types

click node_app "https://github.com/ana-coahuila/metafit-application/blob/main/App.tsx"
click node_authnav "https://github.com/ana-coahuila/metafit-application/blob/main/src/navigator/AuthNavigator.tsx"
click node_tabs "https://github.com/ana-coahuila/metafit-application/blob/main/src/navigator/TabNavigator.tsx"
click node_login "https://github.com/ana-coahuila/metafit-application/blob/main/src/auth/login.tsx"
click node_register "https://github.com/ana-coahuila/metafit-application/blob/main/src/auth/register.tsx"
click node_authstate "https://github.com/ana-coahuila/metafit-application/blob/main/src/context/AuthContext.tsx"
click node_dashboard "https://github.com/ana-coahuila/metafit-application/blob/main/src/screens/Dashboard.tsx"
click node_plan "https://github.com/ana-coahuila/metafit-application/blob/main/src/screens/Plan.tsx"
click node_recipes "https://github.com/ana-coahuila/metafit-application/blob/main/src/screens/Recipe.tsx"
click node_progress "https://github.com/ana-coahuila/metafit-application/blob/main/src/screens/Progress.tsx"
click node_profile "https://github.com/ana-coahuila/metafit-application/blob/main/src/screens/Profile.tsx"
click node_button "https://github.com/ana-coahuila/metafit-application/blob/main/src/components/Button.tsx"
click node_input "https://github.com/ana-coahuila/metafit-application/blob/main/src/components/Input.tsx"
click node_styles "https://github.com/ana-coahuila/metafit-application/tree/main/src/styles"
click node_types "https://github.com/ana-coahuila/metafit-application/blob/main/src/types/types.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_authnav,node_tabs,node_user toneBlue
class node_login,node_register,node_authstate toneAmber
class node_dashboard,node_plan,node_recipes,node_progress,node_profile toneMint
class node_button,node_input,node_styles,node_types toneRose
class node_authapi,node_planapi,node_adaptapi toneIndigo
```

## Components

### App shell

- [App entry](https://github.com/ana-coahuila/metafit-application/blob/main/App.tsx): `App.tsx`
- [Auth navigation](https://github.com/ana-coahuila/metafit-application/blob/main/src/navigator/AuthNavigator.tsx): `src/navigator/AuthNavigator.tsx`
- [Feature tabs](https://github.com/ana-coahuila/metafit-application/blob/main/src/navigator/TabNavigator.tsx): `src/navigator/TabNavigator.tsx`

### Identity

- [Login](https://github.com/ana-coahuila/metafit-application/blob/main/src/auth/login.tsx): `src/auth/login.tsx`
- [Registration](https://github.com/ana-coahuila/metafit-application/blob/main/src/auth/register.tsx): `src/auth/register.tsx`
- [Auth state](https://github.com/ana-coahuila/metafit-application/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`

### Fitness features

- [Dashboard](https://github.com/ana-coahuila/metafit-application/blob/main/src/screens/Dashboard.tsx): `src/screens/Dashboard.tsx`
- [Meal and exercise plan](https://github.com/ana-coahuila/metafit-application/blob/main/src/screens/Plan.tsx): `src/screens/Plan.tsx`
- [Recipes](https://github.com/ana-coahuila/metafit-application/blob/main/src/screens/Recipe.tsx): `src/screens/Recipe.tsx`
- [Progress](https://github.com/ana-coahuila/metafit-application/blob/main/src/screens/Progress.tsx): `src/screens/Progress.tsx`
- [Profile](https://github.com/ana-coahuila/metafit-application/blob/main/src/screens/Profile.tsx): `src/screens/Profile.tsx`

### Shared UI

- [Button](https://github.com/ana-coahuila/metafit-application/blob/main/src/components/Button.tsx): `src/components/Button.tsx`
- [Input](https://github.com/ana-coahuila/metafit-application/blob/main/src/components/Input.tsx): `src/components/Input.tsx`
- [Screen styles](https://github.com/ana-coahuila/metafit-application/tree/main/src/styles): `src/styles`
- [Domain types](https://github.com/ana-coahuila/metafit-application/blob/main/src/types/types.ts): `src/types/types.ts`

### Other components

- **App user**
- **Auth service**
- **Plan backend**
- **Adaptation service**

## Connections

- App user → App entry: opens
- App entry → Auth state: provides auth (evidence: `App.tsx`)
- App entry → Auth navigation: renders (evidence: `App.tsx`)
- Auth navigation → Login: routes to (evidence: `src/navigator/AuthNavigator.tsx`)
- Auth navigation → Registration: routes to (evidence: `src/navigator/AuthNavigator.tsx`)
- Auth navigation → Feature tabs: routes to (evidence: `src/navigator/AuthNavigator.tsx`)
- Login → Auth state: calls login (evidence: `src/auth/login.tsx`)
- Registration → Auth state: calls register (evidence: `src/auth/register.tsx`)
- Auth state → Auth service: auth requests (evidence: `src/context/AuthContext.tsx`)
- Feature tabs → Dashboard: routes to (evidence: `src/navigator/TabNavigator.tsx`)
- Feature tabs → Meal and exercise plan: routes to (evidence: `src/navigator/TabNavigator.tsx`)
- Feature tabs → Recipes: routes to (evidence: `src/navigator/TabNavigator.tsx`)
- Feature tabs → Progress: routes to (evidence: `src/navigator/TabNavigator.tsx`)
- Feature tabs → Profile: routes to (evidence: `src/navigator/TabNavigator.tsx`)
- Profile → Auth state: updates account (evidence: `src/screens/Profile.tsx`)
- Meal and exercise plan → Plan backend: generates plan (evidence: `src/screens/Plan.tsx`)
- Meal and exercise plan → Adaptation service: adapts plan (evidence: `src/screens/Plan.tsx`)
- Login → Input: renders (evidence: `src/auth/login.tsx`)
- Login → Button: renders (evidence: `src/auth/login.tsx`)
- Registration → Input: renders (evidence: `src/auth/register.tsx`)
- Registration → Button: renders (evidence: `src/auth/register.tsx`)
- Login → Screen styles: uses styles (evidence: `src/auth/login.tsx`)
- Registration → Screen styles: uses styles (evidence: `src/auth/register.tsx`)
- Dashboard → Screen styles: uses styles (evidence: `src/screens/Dashboard.tsx`)
- Meal and exercise plan → Screen styles: uses styles (evidence: `src/screens/Plan.tsx`)
- Profile → Screen styles: uses styles (evidence: `src/screens/Profile.tsx`)
- Progress → Screen styles: uses styles (evidence: `src/screens/Progress.tsx`)
- Recipes → Screen styles: uses styles (evidence: `src/screens/Recipe.tsx`)
- Auth state → Domain types: uses user type (evidence: `src/context/AuthContext.tsx`)
- Recipes → Domain types: uses recipe types (evidence: `src/screens/Recipe.tsx`)
