# alex-valauney/projet-carcajou architecture

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

- Interactive diagram: https://gitdiagram.com/alex-valauney/projet-carcajou
- Repository: https://github.com/alex-valauney/projet-carcajou

## Overview

Carcajou is a multi-platform point-of-sale and inventory system for perishable goods. Its user-facing flow spans sign-in, product and stock administration, receiving stock, recording sales, and reviewing history; the web client also supports offline operation and deferred synchronization. The documented Flutter client and PHP/MySQL backend are included, but the tree has no Dart application sources and the sampled excerpts do not show the mobile app's business workflow or the full web-to-API call paths. Those connections are therefore documented as unverified rather than inferred.

Main entry points: [`backend-php/api/index.php`](https://github.com/alex-valauney/projet-carcajou/blob/main/backend-php/api/index.php) (REST routing and auth gate), [`backend-php/api/config.php`](https://github.com/alex-valauney/projet-carcajou/blob/main/backend-php/api/config.php) (MySQL database), [`projet-carcajou/src/lib/db.ts`](https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/lib/db.ts) (IndexedDB local data), [`projet-carcajou/src/lib/syncService.ts`](https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/lib/syncService.ts) (Offline synchronization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web administration"]
  node_login["Sign-in<br/>[page.tsx]"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_products["Product and stock management<br/>[page.tsx]"]
  node_profiles["Profile management<br/>[page.tsx]"]
  node_other["Other management<br/>[page.tsx]"]
  node_receiving["Stock receiving<br/>[page.tsx]"]
  node_sales["Point of sale<br/>[page.tsx]"]
  node_history["Activity history"]
  node_permissions["Role permissions<br/>[permissions.ts]"]
end

subgraph group_api["API and security"]
  node_api_entry["REST routing and auth gate<br/>[index.php]"]
  node_auth["Authentication and profiles<br/>[auth.php]"]
  node_jwt["JWT signing and validation<br/>[jwt_helper.php]"]
  node_api_reads["Read endpoints<br/>[requeteGET.php]"]
  node_api_writes["Write endpoints<br/>[requetePOST.php]"]
  node_api_updates["Update endpoints<br/>[requetePATCH.php]"]
  node_api_deletes["Delete endpoints<br/>[requeteDELETE.php]"]
  node_mysql[("MySQL database<br/>[config.php]")]
end

subgraph group_persistence["Offline and persistence"]
  node_localdb[("IndexedDB local data<br/>[db.ts]")]
  node_sync["Offline synchronization<br/>[syncService.ts]"]
end

subgraph group_mobile["Mobile POS"]
  node_mobile_app["Flutter cashier client"]
end

node_staff(("Staff user"))
node_web_user(("Web operator"))
node_backend_client(("API client"))

node_staff -.->|"signs in"| node_login
node_login -.->|"requests login"| node_api_entry
node_api_entry -->|"routes auth"| node_auth
node_auth -->|"signs token"| node_jwt
node_api_entry -.->|"validates token"| node_jwt
node_web_user -.->|"uses"| node_dashboard
node_web_user -.->|"manages stock"| node_products
node_web_user -.->|"manages profiles"| node_profiles
node_web_user -.->|"manages data"| node_other
node_web_user -.->|"records arrivals"| node_receiving
node_web_user -.->|"records sales"| node_sales
node_web_user -.->|"reviews activity"| node_history
node_dashboard -.->|"checks access"| node_permissions
node_products -.->|"uses offline data"| node_localdb
node_receiving -.->|"uses offline data"| node_localdb
node_sales -.->|"uses offline data"| node_localdb
node_sync -->|"reads and writes"| node_localdb
node_sync -->|"sends REST requests"| node_backend_client
node_backend_client -.->|"calls routes"| node_api_entry
node_api_entry -->|"dispatches GET"| node_api_reads
node_api_entry -->|"dispatches POST"| node_api_writes
node_api_entry -->|"dispatches PATCH"| node_api_updates
node_api_entry -->|"dispatches DELETE"| node_api_deletes
node_api_reads -.->|"queries database"| node_mysql
node_api_writes -.->|"writes database"| node_mysql
node_api_updates -.->|"updates database"| node_mysql
node_api_deletes -.->|"deletes records"| node_mysql
node_staff -.->|"uses cashier app"| node_mobile_app
node_mobile_app -.->|"uses REST API"| node_backend_client

click node_login "https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/app/(pages)/(login)/connexion/page.tsx"
click node_dashboard "https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/app/(pages)/(protected)/accueil/page.tsx"
click node_products "https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/app/(pages)/(protected)/gestionStocks/page.tsx"
click node_profiles "https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/app/(pages)/(protected)/gestionProfils/page.tsx"
click node_other "https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/app/(pages)/(protected)/gestionAutre/page.tsx"
click node_receiving "https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/app/(pages)/(protected)/reception/page.tsx"
click node_sales "https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/app/(pages)/(protected)/vente/page.tsx"
click node_history "https://github.com/alex-valauney/projet-carcajou/tree/main/projet-carcajou/src/app/(pages)/(protected)"
click node_permissions "https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/lib/permissions.ts"
click node_localdb "https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/lib/db.ts"
click node_sync "https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/lib/syncService.ts"
click node_api_entry "https://github.com/alex-valauney/projet-carcajou/blob/main/backend-php/api/index.php"
click node_auth "https://github.com/alex-valauney/projet-carcajou/blob/main/backend-php/api/controllers/auth.php"
click node_jwt "https://github.com/alex-valauney/projet-carcajou/blob/main/backend-php/api/controllers/jwt_helper.php"
click node_api_reads "https://github.com/alex-valauney/projet-carcajou/blob/main/backend-php/api/controllers/requeteGET.php"
click node_api_writes "https://github.com/alex-valauney/projet-carcajou/blob/main/backend-php/api/controllers/requetePOST.php"
click node_api_updates "https://github.com/alex-valauney/projet-carcajou/blob/main/backend-php/api/controllers/requetePATCH.php"
click node_api_deletes "https://github.com/alex-valauney/projet-carcajou/blob/main/backend-php/api/controllers/requeteDELETE.php"
click node_mysql "https://github.com/alex-valauney/projet-carcajou/blob/main/backend-php/api/config.php"
click node_mobile_app "https://github.com/alex-valauney/projet-carcajou/tree/main/carcajou_mobile"

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_login,node_dashboard,node_products,node_profiles,node_other,node_receiving,node_sales,node_history,node_permissions,node_staff,node_backend_client toneBlue
class node_api_entry,node_auth,node_jwt,node_api_reads,node_api_writes,node_api_updates,node_api_deletes,node_mysql toneAmber
class node_localdb,node_sync toneMint
class node_mobile_app toneRose
class node_web_user toneIndigo
```

## Components

### Web administration

- [Sign-in](https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/app/(pages)/(login)/connexion/page.tsx): `projet-carcajou/src/app/(pages)/(login)/connexion/page.tsx`
- [Dashboard](https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/app/(pages)/(protected)/accueil/page.tsx): `projet-carcajou/src/app/(pages)/(protected)/accueil/page.tsx`
- [Product and stock management](https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/app/(pages)/(protected)/gestionStocks/page.tsx): `projet-carcajou/src/app/(pages)/(protected)/gestionStocks/page.tsx`
- [Profile management](https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/app/(pages)/(protected)/gestionProfils/page.tsx): `projet-carcajou/src/app/(pages)/(protected)/gestionProfils/page.tsx`
- [Other management](https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/app/(pages)/(protected)/gestionAutre/page.tsx): `projet-carcajou/src/app/(pages)/(protected)/gestionAutre/page.tsx`
- [Stock receiving](https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/app/(pages)/(protected)/reception/page.tsx): `projet-carcajou/src/app/(pages)/(protected)/reception/page.tsx`
- [Point of sale](https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/app/(pages)/(protected)/vente/page.tsx): `projet-carcajou/src/app/(pages)/(protected)/vente/page.tsx`
- [Activity history](https://github.com/alex-valauney/projet-carcajou/tree/main/projet-carcajou/src/app/(pages)/(protected)): `projet-carcajou/src/app/(pages)/(protected)`
- [Role permissions](https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/lib/permissions.ts): `projet-carcajou/src/lib/permissions.ts`

### API and security

- [REST routing and auth gate](https://github.com/alex-valauney/projet-carcajou/blob/main/backend-php/api/index.php): `backend-php/api/index.php`
- [Authentication and profiles](https://github.com/alex-valauney/projet-carcajou/blob/main/backend-php/api/controllers/auth.php): `backend-php/api/controllers/auth.php`
- [JWT signing and validation](https://github.com/alex-valauney/projet-carcajou/blob/main/backend-php/api/controllers/jwt_helper.php): `backend-php/api/controllers/jwt_helper.php`
- [Read endpoints](https://github.com/alex-valauney/projet-carcajou/blob/main/backend-php/api/controllers/requeteGET.php): `backend-php/api/controllers/requeteGET.php`
- [Write endpoints](https://github.com/alex-valauney/projet-carcajou/blob/main/backend-php/api/controllers/requetePOST.php): `backend-php/api/controllers/requetePOST.php`
- [Update endpoints](https://github.com/alex-valauney/projet-carcajou/blob/main/backend-php/api/controllers/requetePATCH.php): `backend-php/api/controllers/requetePATCH.php`
- [Delete endpoints](https://github.com/alex-valauney/projet-carcajou/blob/main/backend-php/api/controllers/requeteDELETE.php): `backend-php/api/controllers/requeteDELETE.php`
- [MySQL database](https://github.com/alex-valauney/projet-carcajou/blob/main/backend-php/api/config.php): `backend-php/api/config.php`

### Offline and persistence

- [IndexedDB local data](https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/lib/db.ts): `projet-carcajou/src/lib/db.ts`
- [Offline synchronization](https://github.com/alex-valauney/projet-carcajou/blob/main/projet-carcajou/src/lib/syncService.ts): `projet-carcajou/src/lib/syncService.ts`

### Mobile POS

- [Flutter cashier client](https://github.com/alex-valauney/projet-carcajou/tree/main/carcajou_mobile): `carcajou_mobile`

### Other components

- **Staff user**
- **Web operator**
- **API client**

## Connections

- Staff user → Sign-in: signs in (evidence: `README.md`)
- Sign-in → REST routing and auth gate: requests login (evidence: `README.md`)
- REST routing and auth gate → Authentication and profiles: routes auth (evidence: `backend-php/api/index.php`)
- Authentication and profiles → JWT signing and validation: signs token (evidence: `backend-php/api/controllers/auth.php`)
- REST routing and auth gate → JWT signing and validation: validates token (evidence: `README.md`)
- Web operator → Dashboard: uses (evidence: `README.md`)
- Web operator → Product and stock management: manages stock (evidence: `README.md`)
- Web operator → Profile management: manages profiles (evidence: `README.md`)
- Web operator → Other management: manages data (evidence: `README.md`)
- Web operator → Stock receiving: records arrivals (evidence: `README.md`)
- Web operator → Point of sale: records sales (evidence: `README.md`)
- Web operator → Activity history: reviews activity (evidence: `README.md`)
- Dashboard → Role permissions: checks access
- Product and stock management → IndexedDB local data: uses offline data (evidence: `README.md`)
- Stock receiving → IndexedDB local data: uses offline data (evidence: `README.md`)
- Point of sale → IndexedDB local data: uses offline data (evidence: `README.md`)
- Offline synchronization → IndexedDB local data: reads and writes (evidence: `projet-carcajou/src/lib/syncService.ts`)
- Offline synchronization → API client: sends REST requests (evidence: `projet-carcajou/src/lib/syncService.ts`)
- API client → REST routing and auth gate: calls routes (evidence: `README.md`)
- REST routing and auth gate → Read endpoints: dispatches GET (evidence: `backend-php/api/index.php`)
- REST routing and auth gate → Write endpoints: dispatches POST (evidence: `backend-php/api/index.php`)
- REST routing and auth gate → Update endpoints: dispatches PATCH (evidence: `backend-php/api/index.php`)
- REST routing and auth gate → Delete endpoints: dispatches DELETE (evidence: `backend-php/api/index.php`)
- Read endpoints → MySQL database: queries database (evidence: `README.md`)
- Write endpoints → MySQL database: writes database (evidence: `README.md`)
- Update endpoints → MySQL database: updates database (evidence: `README.md`)
- Delete endpoints → MySQL database: deletes records (evidence: `README.md`)
- Staff user → Flutter cashier client: uses cashier app (evidence: `README.md`)
- Flutter cashier client → API client: uses REST API (evidence: `README.md`)
