# takwaessalemselmi-glitch/khotwa-web architecture

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

- Interactive diagram: https://gitdiagram.com/takwaessalemselmi-glitch/khotwa-web
- Repository: https://github.com/takwaessalemselmi-glitch/khotwa-web

## Overview

Khotwa is a Tunisian student-orientation website for Bac, Prépa, and Licence students. The main journey is to choose a level, take relevant guidance tests or calculate a Bac FG score, then use opportunities and document checklists; an account can save results and track deadlines and progress. The graph includes the main content areas and the shared quiz, authentication, and API layers. Source excerpts show client-side calls and the API setup; unsampled page wiring and database contents are not inferred.

Main entry points: [`js/auth.js`](https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/auth.js) (Authentication), [`js/api.js`](https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/api.js) (API client), [`js/niveau.js`](https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/niveau.js) (Level journey), [`js/index.js`](https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/index.js) (Home and MBTI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_guidance["Orientation and guidance"]
  node_home["Home and MBTI<br/>[index.js]"]
  node_level["Level journey<br/>[niveau.js]"]
  node_fg["FG calculator<br/>[fg.js]"]
  node_quiz["Quiz engine<br/>[quiz.js]"]
end

subgraph group_content["Student resources"]
  node_opportunities["Opportunities<br/>[actualites.js]"]
  node_tips["Student tips<br/>[astuces.js]"]
  node_documents["Paperwork checklists<br/>[papiers.js]"]
end

subgraph group_account["Accounts and tracking"]
  node_signup["Registration and login<br/>[inscription.js]"]
  node_auth["Authentication<br/>[auth.js]"]
  node_dashboard["Student dashboard<br/>[dashboard.js]"]
end

subgraph group_runtime["Data access"]
  node_browser[("Browser storage")]
  node_api["API client<br/>[api.js]"]
  node_server["JSON server"]
  node_data[("Application data<br/>[db.json]")]
end

node_student(("Student"))

node_student -->|"opens"| node_home
node_home -->|"runs tests"| node_quiz
node_home -->|"syncs profile"| node_auth
node_home -->|"loads content"| node_api
node_level -->|"syncs profile"| node_auth
node_level -->|"loads quiz"| node_api
node_level -->|"renders calculator"| node_fg
node_level -->|"runs tests"| node_quiz
node_signup -->|"creates account"| node_auth
node_signup -->|"collects score"| node_fg
node_auth -->|"requests account data"| node_api
node_auth -->|"stores session"| node_browser
node_dashboard -->|"syncs and updates"| node_auth
node_dashboard -->|"loads dashboard data"| node_api
node_opportunities -->|"syncs profile"| node_auth
node_opportunities -->|"loads and saves favorites"| node_api
node_tips -->|"reads and updates profile"| node_auth
node_tips -->|"loads tips"| node_api
node_documents -->|"syncs profile"| node_auth
node_documents -->|"loads and saves progress"| node_api
node_fg -->|"loads formulas"| node_api
node_api -->|"sends HTTP requests"| node_server
node_server -->|"watches data file"| node_data

click node_home "https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/index.js"
click node_level "https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/niveau.js"
click node_fg "https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/fg.js"
click node_quiz "https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/quiz.js"
click node_opportunities "https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/actualites.js"
click node_tips "https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/astuces.js"
click node_documents "https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/papiers.js"
click node_signup "https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/inscription.js"
click node_auth "https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/auth.js"
click node_dashboard "https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/dashboard.js"
click node_api "https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/api.js"
click node_data "https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/db.json"

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_level,node_fg,node_quiz toneBlue
class node_opportunities,node_tips,node_documents toneAmber
class node_signup,node_auth,node_dashboard toneMint
class node_browser,node_api,node_server,node_data toneRose
class node_student toneIndigo
```

## Components

### Orientation and guidance

- [Home and MBTI](https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/index.js): `js/index.js`
- [Level journey](https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/niveau.js): `js/niveau.js`
- [FG calculator](https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/fg.js): `js/fg.js`
- [Quiz engine](https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/quiz.js): `js/quiz.js`

### Student resources

- [Opportunities](https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/actualites.js): `js/actualites.js`
- [Student tips](https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/astuces.js): `js/astuces.js`
- [Paperwork checklists](https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/papiers.js): `js/papiers.js`

### Accounts and tracking

- [Registration and login](https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/inscription.js): `js/inscription.js`
- [Authentication](https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/auth.js): `js/auth.js`
- [Student dashboard](https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/dashboard.js): `js/dashboard.js`

### Data access

- **Browser storage**
- [API client](https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/js/api.js): `js/api.js`
- **JSON server**
- [Application data](https://github.com/takwaessalemselmi-glitch/khotwa-web/blob/main/db.json): `db.json`

### Other components

- **Student**

## Connections

- Student → Home and MBTI: opens (evidence: `README.md`)
- Home and MBTI → Quiz engine: runs tests (evidence: `js/index.js`)
- Home and MBTI → Authentication: syncs profile (evidence: `js/index.js`)
- Home and MBTI → API client: loads content (evidence: `js/index.js`)
- Level journey → Authentication: syncs profile (evidence: `js/niveau.js`)
- Level journey → API client: loads quiz (evidence: `js/niveau.js`)
- Level journey → FG calculator: renders calculator (evidence: `js/niveau.js`)
- Level journey → Quiz engine: runs tests (evidence: `js/niveau.js`)
- Registration and login → Authentication: creates account (evidence: `js/inscription.js`)
- Registration and login → FG calculator: collects score (evidence: `js/inscription.js`)
- Authentication → API client: requests account data (evidence: `js/auth.js`)
- Authentication → Browser storage: stores session (evidence: `js/auth.js`)
- Student dashboard → Authentication: syncs and updates (evidence: `js/dashboard.js`)
- Student dashboard → API client: loads dashboard data (evidence: `js/dashboard.js`)
- Opportunities → Authentication: syncs profile (evidence: `js/actualites.js`)
- Opportunities → API client: loads and saves favorites (evidence: `js/actualites.js`)
- Student tips → Authentication: reads and updates profile (evidence: `js/astuces.js`)
- Student tips → API client: loads tips (evidence: `js/astuces.js`)
- Paperwork checklists → Authentication: syncs profile (evidence: `js/papiers.js`)
- Paperwork checklists → API client: loads and saves progress (evidence: `js/papiers.js`)
- FG calculator → API client: loads formulas (evidence: `js/fg.js`)
- API client → JSON server: sends HTTP requests (evidence: `js/api.js`)
- JSON server → Application data: watches data file
