# oussema-tarhouni/kjhg architecture

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

- Interactive diagram: https://gitdiagram.com/oussema-tarhouni/kjhg
- Repository: https://github.com/oussema-tarhouni/kjhg

## Overview

EOS Fitness & Pilates is a PHP/MySQL gym membership site. Visitors browse the public landing and plans, then register or log in; authenticated members reach the dashboard, while administrators use a gated panel to manage gym data. The sampled front controller and API excerpts establish routing into the local API and its MySQL-backed handlers. The README documents the PHP/MySQL deployment; dashboard and admin capabilities are represented where visible in the tree, but unsampled connections are omitted.

Main entry points: [`index.php`](https://github.com/oussema-tarhouni/kjhg/blob/main/index.php) (HTTP Router), [`lib/local_api.php`](https://github.com/oussema-tarhouni/kjhg/blob/main/lib/local_api.php) (Local API Handlers), [`lib/http.php`](https://github.com/oussema-tarhouni/kjhg/blob/main/lib/http.php) (Auth Guard and API Layer), [`api/proxy.php`](https://github.com/oussema-tarhouni/kjhg/blob/main/api/proxy.php) (JSON API Proxy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Site and Pages"]
  node_front["HTTP Router<br/>[index.php]"]
  node_landing["Public Landing<br/>[landing.php]"]
  node_plans["Plan Selection<br/>[plan.php]"]
  node_dashboard["Member Dashboard<br/>[dashboard.php]"]
  node_legal["Legal Pages<br/>[terms.php]"]
end

subgraph group_account["Member Access"]
  node_signup["Registration View<br/>[signup.php]"]
  node_login["Login View<br/>[login.php]"]
  node_otp["OTP View<br/>[otp.php]"]
  node_pending["Pending View<br/>[pending.php]"]
  node_reset["Password Recovery<br/>[reset_password.php]"]
end

subgraph group_services["API and Operations"]
  node_http["Auth Guard and API Layer<br/>[http.php]"]
  node_proxy["JSON API Proxy<br/>[proxy.php]"]
  node_local["Local API Handlers<br/>[local_api.php]"]
  node_database[("MySQL Database")]
end

subgraph group_admin["Administration"]
  node_admin_api["Admin API<br/>[admin_api.php]"]
  node_admin_gate["Admin Login Gate<br/>[admin_gate.php]"]
  node_admin_panel["Admin Panel<br/>[admin.php]"]
  node_approvals["Member Approvals<br/>[approvals.php]"]
end

node_visitor(("Visitor or Member"))

node_visitor -->|"requests pages"| node_front
node_front -->|"routes home"| node_landing
node_front -->|"routes plans"| node_plans
node_front -->|"routes dashboard"| node_dashboard
node_front -->|"routes legal"| node_legal
node_front -->|"routes gate"| node_admin_gate
node_front -->|"loads API layer"| node_http
node_front -->|"dispatches API"| node_proxy
node_front -->|"routes panel"| node_admin_panel
node_front -->|"routes approvals"| node_approvals
node_http -->|"loads handlers"| node_local
node_proxy -->|"calls api_request"| node_local
node_local -->|"dispatches admin routes"| node_admin_api
node_admin_gate -.->|"unlocks admin access"| node_admin_api
node_local -->|"queries and updates"| node_database

click node_front "https://github.com/oussema-tarhouni/kjhg/blob/main/index.php"
click node_landing "https://github.com/oussema-tarhouni/kjhg/blob/main/views/landing.php"
click node_plans "https://github.com/oussema-tarhouni/kjhg/blob/main/pages/plan.php"
click node_dashboard "https://github.com/oussema-tarhouni/kjhg/blob/main/views/dashboard.php"
click node_legal "https://github.com/oussema-tarhouni/kjhg/blob/main/pages/terms.php"
click node_signup "https://github.com/oussema-tarhouni/kjhg/blob/main/views/signup.php"
click node_login "https://github.com/oussema-tarhouni/kjhg/blob/main/views/login.php"
click node_otp "https://github.com/oussema-tarhouni/kjhg/blob/main/views/otp.php"
click node_pending "https://github.com/oussema-tarhouni/kjhg/blob/main/views/pending.php"
click node_reset "https://github.com/oussema-tarhouni/kjhg/blob/main/pages/reset_password.php"
click node_http "https://github.com/oussema-tarhouni/kjhg/blob/main/lib/http.php"
click node_proxy "https://github.com/oussema-tarhouni/kjhg/blob/main/api/proxy.php"
click node_local "https://github.com/oussema-tarhouni/kjhg/blob/main/lib/local_api.php"
click node_admin_api "https://github.com/oussema-tarhouni/kjhg/blob/main/lib/admin_api.php"
click node_admin_gate "https://github.com/oussema-tarhouni/kjhg/blob/main/pages/admin_gate.php"
click node_admin_panel "https://github.com/oussema-tarhouni/kjhg/blob/main/pages/admin.php"
click node_approvals "https://github.com/oussema-tarhouni/kjhg/blob/main/pages/approvals.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_front,node_landing,node_plans,node_dashboard,node_legal toneBlue
class node_signup,node_login,node_otp,node_pending,node_reset toneAmber
class node_http,node_proxy,node_local,node_database toneMint
class node_admin_api,node_admin_gate,node_admin_panel,node_approvals toneRose
class node_visitor toneIndigo
```

## Components

### Site and Pages

- [HTTP Router](https://github.com/oussema-tarhouni/kjhg/blob/main/index.php): `index.php`
- [Public Landing](https://github.com/oussema-tarhouni/kjhg/blob/main/views/landing.php): `views/landing.php`
- [Plan Selection](https://github.com/oussema-tarhouni/kjhg/blob/main/pages/plan.php): `pages/plan.php`
- [Member Dashboard](https://github.com/oussema-tarhouni/kjhg/blob/main/views/dashboard.php): `views/dashboard.php`
- [Legal Pages](https://github.com/oussema-tarhouni/kjhg/blob/main/pages/terms.php): `pages/terms.php`

### Member Access

- [Registration View](https://github.com/oussema-tarhouni/kjhg/blob/main/views/signup.php): `views/signup.php`
- [Login View](https://github.com/oussema-tarhouni/kjhg/blob/main/views/login.php): `views/login.php`
- [OTP View](https://github.com/oussema-tarhouni/kjhg/blob/main/views/otp.php): `views/otp.php`
- [Pending View](https://github.com/oussema-tarhouni/kjhg/blob/main/views/pending.php): `views/pending.php`
- [Password Recovery](https://github.com/oussema-tarhouni/kjhg/blob/main/pages/reset_password.php): `pages/reset_password.php`

### API and Operations

- [Auth Guard and API Layer](https://github.com/oussema-tarhouni/kjhg/blob/main/lib/http.php): `lib/http.php`
- [JSON API Proxy](https://github.com/oussema-tarhouni/kjhg/blob/main/api/proxy.php): `api/proxy.php`
- [Local API Handlers](https://github.com/oussema-tarhouni/kjhg/blob/main/lib/local_api.php): `lib/local_api.php`
- **MySQL Database**

### Administration

- [Admin API](https://github.com/oussema-tarhouni/kjhg/blob/main/lib/admin_api.php): `lib/admin_api.php`
- [Admin Login Gate](https://github.com/oussema-tarhouni/kjhg/blob/main/pages/admin_gate.php): `pages/admin_gate.php`
- [Admin Panel](https://github.com/oussema-tarhouni/kjhg/blob/main/pages/admin.php): `pages/admin.php`
- [Member Approvals](https://github.com/oussema-tarhouni/kjhg/blob/main/pages/approvals.php): `pages/approvals.php`

### Other components

- **Visitor or Member**

## Connections

- Visitor or Member → HTTP Router: requests pages (evidence: `index.php`)
- HTTP Router → Public Landing: routes home (evidence: `index.php`)
- HTTP Router → Plan Selection: routes plans (evidence: `index.php`)
- HTTP Router → Member Dashboard: routes dashboard (evidence: `index.php`)
- HTTP Router → Legal Pages: routes legal (evidence: `index.php`)
- HTTP Router → Admin Login Gate: routes gate (evidence: `index.php`)
- HTTP Router → Auth Guard and API Layer: loads API layer (evidence: `index.php`)
- HTTP Router → JSON API Proxy: dispatches API (evidence: `index.php`)
- HTTP Router → Admin Panel: routes panel (evidence: `index.php`)
- HTTP Router → Member Approvals: routes approvals (evidence: `index.php`)
- Auth Guard and API Layer → Local API Handlers: loads handlers (evidence: `lib/http.php`)
- JSON API Proxy → Local API Handlers: calls api_request (evidence: `api/proxy.php`)
- Local API Handlers → Admin API: dispatches admin routes (evidence: `lib/local_api.php`)
- Admin Login Gate → Admin API: unlocks admin access
- Local API Handlers → MySQL Database: queries and updates (evidence: `lib/local_api.php`)
