# mickaelpol/fitcarnet architecture

> Architecture diagram of the GitHub repository mickaelpol/fitcarnet, 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/mickaelpol/fitcarnet
- Repository: https://github.com/mickaelpol/fitcarnet

## Overview

fitcarnet est une application auto-hébergée de nutrition et de suivi de musculation. Le parcours principal va des objectifs et du stock réel à la composition de repas, puis à leur planification et à la gestion des cuissons; un parcours distinct suit les modèles et séances de musculation. Le graphe conserve aussi les comptes, invitations, sessions et l’intégration Grocy. Plusieurs liens de domaine reposent sur la description du README; les extraits ne montrent pas tous les raccordements internes.

Main entry points: [`api/src/Controller/PlansController.php`](https://github.com/mickaelpol/fitcarnet/blob/master/api/src/Controller/PlansController.php) (Contrôleurs API), [`front/src/composants/usePlanCalcule.ts`](https://github.com/mickaelpol/fitcarnet/blob/master/front/src/composants/usePlanCalcule.ts) (Calcul du plan), [`front/app/(onglets)/repas.tsx`](https://github.com/mickaelpol/fitcarnet/blob/master/front/app/(onglets)/repas.tsx) (Écrans Expo), [`front/src/api/client.ts`](https://github.com/mickaelpol/fitcarnet/blob/master/front/src/api/client.ts) (Client API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_front["Application frontale"]
  node_app["Écrans Expo<br/>[repas.tsx]"]
  node_client["Client API<br/>[client.ts]"]
  node_hooks["Hooks API<br/>[index.ts]"]
end

subgraph group_nutrition["Nutrition et repas"]
  node_plan_hook["Calcul du plan<br/>[usePlanCalcule.ts]"]
  node_solver["Solveur de repas<br/>[solveur.ts]"]
  node_meal_demand["Demandes repas<br/>[demandeRepas.ts]"]
  node_meal_plan["Planification période<br/>[planCalcule.ts]"]
  node_cook["Cuissons<br/>[cuisson.ts]"]
end

subgraph group_musculation["Musculation"]
  node_workout_screen["Écrans séances<br/>[&#91;id&#93;.tsx]"]
  node_workout_edit["Édition séance"]
  node_workout_model["Modèles exercices<br/>[&#91;id&#93;.tsx]"]
end

subgraph group_api["API et comptes"]
  node_api_routes["Contrôleurs API"]
  node_account["Comptes utilisateurs<br/>[Utilisateur.php]"]
  node_session["Sessions et jetons"]
  node_invites["Invitations"]
end

subgraph group_stock["Frigo et intégrations"]
  node_food["Aliments nutritionnels<br/>[Aliment.php]"]
  node_fridge["Abstraction frigo<br/>[Frigo.php]"]
  node_base_fridge[("Stock en base<br/>[FrigoBase.php]")]
  node_grocy["Frigo Grocy<br/>[FrigoGrocy.php]"]
end

node_person(("Utilisateur"))
node_grocy_service["Service Grocy distant"]

node_person -->|"utilise"| node_app
node_app -->|"calcule le plan"| node_plan_hook
node_plan_hook -->|"lit stock et cuissons"| node_hooks
node_plan_hook -->|"résout période"| node_solver
node_plan_hook -->|"calcule cuissons effectives"| node_meal_plan
node_plan_hook -->|"calcule cuisson restante"| node_cook
node_app -->|"prépare les demandes"| node_meal_demand
node_meal_demand -.->|"fournit les cibles"| node_solver
node_app -->|"suit les séances"| node_workout_screen
node_workout_screen -->|"édite et enregistre"| node_workout_edit
node_workout_model -->|"charge et modifie exercice"| node_hooks
node_hooks -->|"appelle API"| node_client
node_client -->|"échange avec API"| node_api_routes
node_api_routes -->|"lit et déduit stock"| node_fridge
node_fridge -->|"délègue source base"| node_base_fridge
node_fridge -->|"délègue source Grocy"| node_grocy
node_grocy -.->|"accède au stock distant"| node_grocy_service
node_base_fridge -->|"lit aliments et stocks"| node_food
node_api_routes -->|"valide aliments"| node_food
node_api_routes -->|"autorise par compte"| node_account
node_api_routes -->|"gère invitations"| node_invites
node_client -->|"renouvelle session"| node_session
node_api_routes -->|"authentifie sessions"| node_session
node_account -->|"possède aliments"| node_food
node_person -->|"configure modèles"| node_workout_model
node_person -->|"gère son frigo"| node_app

click node_app "https://github.com/mickaelpol/fitcarnet/blob/master/front/app/(onglets)/repas.tsx"
click node_client "https://github.com/mickaelpol/fitcarnet/blob/master/front/src/api/client.ts"
click node_hooks "https://github.com/mickaelpol/fitcarnet/blob/master/front/src/api/hooks/index.ts"
click node_plan_hook "https://github.com/mickaelpol/fitcarnet/blob/master/front/src/composants/usePlanCalcule.ts"
click node_solver "https://github.com/mickaelpol/fitcarnet/blob/master/front/src/solveur/solveur.ts"
click node_meal_demand "https://github.com/mickaelpol/fitcarnet/blob/master/front/src/calcul/demandeRepas.ts"
click node_meal_plan "https://github.com/mickaelpol/fitcarnet/blob/master/front/src/calcul/planCalcule.ts"
click node_cook "https://github.com/mickaelpol/fitcarnet/blob/master/front/src/calcul/cuisson.ts"
click node_workout_screen "https://github.com/mickaelpol/fitcarnet/blob/master/front/app/seance/%5Bid%5D.tsx"
click node_workout_edit "https://github.com/mickaelpol/fitcarnet/blob/master/front/src/composants/useSeanceEditable.ts"
click node_workout_model "https://github.com/mickaelpol/fitcarnet/blob/master/front/app/modele/%5Bid%5D.tsx"
click node_api_routes "https://github.com/mickaelpol/fitcarnet/blob/master/api/src/Controller/PlansController.php"
click node_account "https://github.com/mickaelpol/fitcarnet/blob/master/api/src/Entity/Utilisateur.php"
click node_session "https://github.com/mickaelpol/fitcarnet/blob/master/api/src/Service/CookieDeSession.php"
click node_invites "https://github.com/mickaelpol/fitcarnet/blob/master/api/src/Controller/InvitationsController.php"
click node_food "https://github.com/mickaelpol/fitcarnet/blob/master/api/src/Entity/Aliment.php"
click node_fridge "https://github.com/mickaelpol/fitcarnet/blob/master/api/src/Service/Frigo.php"
click node_base_fridge "https://github.com/mickaelpol/fitcarnet/blob/master/api/src/Service/FrigoBase.php"
click node_grocy "https://github.com/mickaelpol/fitcarnet/blob/master/api/src/Service/FrigoGrocy.php"

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_client,node_hooks toneBlue
class node_plan_hook,node_solver,node_meal_demand,node_meal_plan,node_cook toneAmber
class node_workout_screen,node_workout_edit,node_workout_model toneMint
class node_api_routes,node_account,node_session,node_invites toneRose
class node_food,node_fridge,node_base_fridge,node_grocy,node_person,node_grocy_service toneIndigo
```

## Components

### Application frontale

- [Écrans Expo](https://github.com/mickaelpol/fitcarnet/blob/master/front/app/(onglets)/repas.tsx): `front/app/(onglets)/repas.tsx`
- [Client API](https://github.com/mickaelpol/fitcarnet/blob/master/front/src/api/client.ts): `front/src/api/client.ts`
- [Hooks API](https://github.com/mickaelpol/fitcarnet/blob/master/front/src/api/hooks/index.ts): `front/src/api/hooks/index.ts`

### Nutrition et repas

- [Calcul du plan](https://github.com/mickaelpol/fitcarnet/blob/master/front/src/composants/usePlanCalcule.ts): `front/src/composants/usePlanCalcule.ts`
- [Solveur de repas](https://github.com/mickaelpol/fitcarnet/blob/master/front/src/solveur/solveur.ts): `front/src/solveur/solveur.ts`
- [Demandes repas](https://github.com/mickaelpol/fitcarnet/blob/master/front/src/calcul/demandeRepas.ts): `front/src/calcul/demandeRepas.ts`
- [Planification période](https://github.com/mickaelpol/fitcarnet/blob/master/front/src/calcul/planCalcule.ts): `front/src/calcul/planCalcule.ts`
- [Cuissons](https://github.com/mickaelpol/fitcarnet/blob/master/front/src/calcul/cuisson.ts): `front/src/calcul/cuisson.ts`

### Musculation

- [Écrans séances](https://github.com/mickaelpol/fitcarnet/blob/master/front/app/seance/%5Bid%5D.tsx): `front/app/seance/[id].tsx`
- [Édition séance](https://github.com/mickaelpol/fitcarnet/blob/master/front/src/composants/useSeanceEditable.ts): `front/src/composants/useSeanceEditable.ts`
- [Modèles exercices](https://github.com/mickaelpol/fitcarnet/blob/master/front/app/modele/%5Bid%5D.tsx): `front/app/modele/[id].tsx`

### API et comptes

- [Contrôleurs API](https://github.com/mickaelpol/fitcarnet/blob/master/api/src/Controller/PlansController.php): `api/src/Controller/PlansController.php`
- [Comptes utilisateurs](https://github.com/mickaelpol/fitcarnet/blob/master/api/src/Entity/Utilisateur.php): `api/src/Entity/Utilisateur.php`
- [Sessions et jetons](https://github.com/mickaelpol/fitcarnet/blob/master/api/src/Service/CookieDeSession.php): `api/src/Service/CookieDeSession.php`
- [Invitations](https://github.com/mickaelpol/fitcarnet/blob/master/api/src/Controller/InvitationsController.php): `api/src/Controller/InvitationsController.php`

### Frigo et intégrations

- [Aliments nutritionnels](https://github.com/mickaelpol/fitcarnet/blob/master/api/src/Entity/Aliment.php): `api/src/Entity/Aliment.php`
- [Abstraction frigo](https://github.com/mickaelpol/fitcarnet/blob/master/api/src/Service/Frigo.php): `api/src/Service/Frigo.php`
- [Stock en base](https://github.com/mickaelpol/fitcarnet/blob/master/api/src/Service/FrigoBase.php): `api/src/Service/FrigoBase.php`
- [Frigo Grocy](https://github.com/mickaelpol/fitcarnet/blob/master/api/src/Service/FrigoGrocy.php): `api/src/Service/FrigoGrocy.php`

### Other components

- **Utilisateur**
- **Service Grocy distant**

## Connections

- Utilisateur → Écrans Expo: utilise
- Écrans Expo → Calcul du plan: calcule le plan (evidence: `front/src/composants/usePlanCalcule.ts`)
- Calcul du plan → Hooks API: lit stock et cuissons (evidence: `front/src/composants/usePlanCalcule.ts`)
- Calcul du plan → Solveur de repas: résout période (evidence: `front/src/composants/usePlanCalcule.ts`)
- Calcul du plan → Planification période: calcule cuissons effectives (evidence: `front/src/composants/usePlanCalcule.ts`)
- Calcul du plan → Cuissons: calcule cuisson restante (evidence: `front/src/composants/usePlanCalcule.ts`)
- Écrans Expo → Demandes repas: prépare les demandes
- Demandes repas → Solveur de repas: fournit les cibles
- Écrans Expo → Écrans séances: suit les séances
- Écrans séances → Édition séance: édite et enregistre (evidence: `front/src/composants/useSeanceEditable.ts`)
- Modèles exercices → Hooks API: charge et modifie exercice
- Hooks API → Client API: appelle API
- Client API → Contrôleurs API: échange avec API
- Contrôleurs API → Abstraction frigo: lit et déduit stock (evidence: `api/src/Controller/PlansController.php`)
- Abstraction frigo → Stock en base: délègue source base (evidence: `api/src/Service/Frigo.php`)
- Abstraction frigo → Frigo Grocy: délègue source Grocy (evidence: `api/src/Service/Frigo.php`)
- Frigo Grocy → Service Grocy distant: accède au stock distant
- Stock en base → Aliments nutritionnels: lit aliments et stocks (evidence: `api/src/Service/FrigoBase.php`)
- Contrôleurs API → Aliments nutritionnels: valide aliments
- Contrôleurs API → Comptes utilisateurs: autorise par compte (evidence: `api/src/Controller/PlansController.php`)
- Contrôleurs API → Invitations: gère invitations
- Client API → Sessions et jetons: renouvelle session (evidence: `front/src/api/client.ts`)
- Contrôleurs API → Sessions et jetons: authentifie sessions
- Comptes utilisateurs → Aliments nutritionnels: possède aliments (evidence: `api/src/Entity/Aliment.php`)
- Utilisateur → Modèles exercices: configure modèles
- Utilisateur → Écrans Expo: gère son frigo
