# chermad/exercice architecture

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

- Interactive diagram: https://gitdiagram.com/chermad/exercice
- Repository: https://github.com/chermad/exercice

## Overview

This is a small Next.js exercise site, not a single linear business workflow: users navigate among a PDF landing page, a portfolio page, an exercise page, and a public-notes page. The notes workflow combines sign-in, live Firestore display, and note edits; separate API routes also read and write products. Exercise 2’s implementation and the Firebase Functions runtime were not sampled, so their behavior and connections are left unspecified.

Main entry points: [`lib/firebase.js`](https://github.com/chermad/exercice/blob/main/lib/firebase.js) (Firebase client), [`app/components/Navbar.jsx`](https://github.com/chermad/exercice/blob/main/app/components/Navbar.jsx) (Navigation bar), [`app/components/Notes.js`](https://github.com/chermad/exercice/blob/main/app/components/Notes.js) (Notes interface), [`app/components/AccueilClient.jsx`](https://github.com/chermad/exercice/blob/main/app/components/AccueilClient.jsx) (PDF landing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_site["Site and exercises"]
  node_home["PDF landing<br/>[AccueilClient.jsx]"]
  node_pdf["PDF viewer<br/>[PdfViewer.jsx]"]
  node_portfolio["Portfolio exercise<br/>[page.jsx]"]
  node_exercise2["Exercise 2<br/>[page.jsx]"]
  node_notespage["Notes exercise page<br/>[page.jsx]"]
  node_navbar["Navigation bar<br/>[Navbar.jsx]"]
end

subgraph group_identity["Identity"]
  node_authform["Email auth form<br/>[AuthForm.jsx]"]
  node_authcontext["Auth state<br/>[AuthContext.js]"]
end

subgraph group_notes["Public notes"]
  node_notesui["Notes interface<br/>[Notes.js]"]
  node_notefunctions["Note operations<br/>[notesFunctions.js]"]
end

subgraph group_data["Data services"]
  node_productsapi["Products API<br/>[route.js]"]
  node_testapi["Firestore test API<br/>[route.js]"]
  node_firebase["Firebase client<br/>[firebase.js]"]
end

node_visitor(("Visitor"))
node_firestore[("Firestore")]
node_firebaseauth["Firebase Auth"]
node_strapi["Strapi service"]

node_visitor -->|"opens"| node_home
node_home -->|"loads"| node_pdf
node_visitor -->|"opens"| node_portfolio
node_portfolio -->|"requests services"| node_strapi
node_visitor -->|"opens"| node_exercise2
node_visitor -->|"opens"| node_notespage
node_notespage -->|"renders"| node_notesui
node_visitor -->|"uses"| node_navbar
node_navbar -->|"renders"| node_authform
node_authform -->|"uses"| node_authcontext
node_authcontext -->|"uses auth"| node_firebase
node_navbar -->|"uses auth"| node_firebase
node_notesui -->|"calls"| node_notefunctions
node_notefunctions -->|"uses database"| node_firebase
node_notesui -->|"listens to notes"| node_firebase
node_productsapi -->|"uses database"| node_firebase
node_testapi -->|"uses database"| node_firebase
node_firebase -->|"initializes"| node_firestore
node_firebase -->|"initializes"| node_firebaseauth

click node_home "https://github.com/chermad/exercice/blob/main/app/components/AccueilClient.jsx"
click node_pdf "https://github.com/chermad/exercice/blob/main/app/components/PdfViewer.jsx"
click node_portfolio "https://github.com/chermad/exercice/blob/main/app/excercice-1/page.jsx"
click node_exercise2 "https://github.com/chermad/exercice/blob/main/app/excercice-2/page.jsx"
click node_notespage "https://github.com/chermad/exercice/blob/main/app/excercice-3/page.jsx"
click node_navbar "https://github.com/chermad/exercice/blob/main/app/components/Navbar.jsx"
click node_authform "https://github.com/chermad/exercice/blob/main/app/components/AuthForm.jsx"
click node_authcontext "https://github.com/chermad/exercice/blob/main/lib/context/AuthContext.js"
click node_notesui "https://github.com/chermad/exercice/blob/main/app/components/Notes.js"
click node_notefunctions "https://github.com/chermad/exercice/blob/main/lib/notesFunctions.js"
click node_productsapi "https://github.com/chermad/exercice/blob/main/app/api/products/route.js"
click node_testapi "https://github.com/chermad/exercice/blob/main/app/api/testFirestore/route.js"
click node_firebase "https://github.com/chermad/exercice/blob/main/lib/firebase.js"

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_home,node_pdf,node_portfolio,node_exercise2,node_notespage,node_navbar toneBlue
class node_authform,node_authcontext,node_firestore toneAmber
class node_notesui,node_notefunctions,node_strapi toneMint
class node_productsapi,node_testapi,node_firebase toneRose
class node_visitor,node_firebaseauth toneIndigo
```

## Components

### Site and exercises

- [PDF landing](https://github.com/chermad/exercice/blob/main/app/components/AccueilClient.jsx): `app/components/AccueilClient.jsx`
- [PDF viewer](https://github.com/chermad/exercice/blob/main/app/components/PdfViewer.jsx): `app/components/PdfViewer.jsx`
- [Portfolio exercise](https://github.com/chermad/exercice/blob/main/app/excercice-1/page.jsx): `app/excercice-1/page.jsx`
- [Exercise 2](https://github.com/chermad/exercice/blob/main/app/excercice-2/page.jsx): `app/excercice-2/page.jsx`
- [Notes exercise page](https://github.com/chermad/exercice/blob/main/app/excercice-3/page.jsx): `app/excercice-3/page.jsx`
- [Navigation bar](https://github.com/chermad/exercice/blob/main/app/components/Navbar.jsx): `app/components/Navbar.jsx`

### Identity

- [Email auth form](https://github.com/chermad/exercice/blob/main/app/components/AuthForm.jsx): `app/components/AuthForm.jsx`
- [Auth state](https://github.com/chermad/exercice/blob/main/lib/context/AuthContext.js): `lib/context/AuthContext.js`

### Public notes

- [Notes interface](https://github.com/chermad/exercice/blob/main/app/components/Notes.js): `app/components/Notes.js`
- [Note operations](https://github.com/chermad/exercice/blob/main/lib/notesFunctions.js): `lib/notesFunctions.js`

### Data services

- [Products API](https://github.com/chermad/exercice/blob/main/app/api/products/route.js): `app/api/products/route.js`
- [Firestore test API](https://github.com/chermad/exercice/blob/main/app/api/testFirestore/route.js): `app/api/testFirestore/route.js`
- [Firebase client](https://github.com/chermad/exercice/blob/main/lib/firebase.js): `lib/firebase.js`

### Other components

- **Visitor**
- **Firestore**
- **Firebase Auth**
- **Strapi service**

## Connections

- Visitor → PDF landing: opens
- PDF landing → PDF viewer: loads (evidence: `app/components/AccueilClient.jsx`)
- Visitor → Portfolio exercise: opens
- Portfolio exercise → Strapi service: requests services (evidence: `app/excercice-1/page.jsx`)
- Visitor → Exercise 2: opens
- Visitor → Notes exercise page: opens
- Notes exercise page → Notes interface: renders (evidence: `app/excercice-3/page.jsx`)
- Visitor → Navigation bar: uses (evidence: `app/components/Navbar.jsx`)
- Navigation bar → Email auth form: renders (evidence: `app/components/Navbar.jsx`)
- Email auth form → Auth state: uses (evidence: `app/components/AuthForm.jsx`)
- Auth state → Firebase client: uses auth (evidence: `lib/context/AuthContext.js`)
- Navigation bar → Firebase client: uses auth (evidence: `app/components/Navbar.jsx`)
- Notes interface → Note operations: calls (evidence: `app/components/Notes.js`)
- Note operations → Firebase client: uses database (evidence: `lib/notesFunctions.js`)
- Notes interface → Firebase client: listens to notes (evidence: `app/components/Notes.js`)
- Products API → Firebase client: uses database (evidence: `app/api/products/route.js`)
- Firestore test API → Firebase client: uses database (evidence: `app/api/testFirestore/route.js`)
- Firebase client → Firestore: initializes (evidence: `lib/firebase.js`)
- Firebase client → Firebase Auth: initializes (evidence: `lib/firebase.js`)
