How naoufalelhlou22/medical-appointment works
Project Type & Purpose
• This is a full-stack web application (“Medical Appointment System”) built with a PHP/MySQL backend and a static HTML/CSS/JavaScript frontend.
• It supports three user roles: Patients (book appointments), Doctors (manage slots), and Admins (dashboard oversight).
Key Architectural Layers & Components
A. Client-Side (Frontend)
• Patient UI
– Located under user/appointment.html and related assets
– CSS in assets/css/appointment-page.css, JS validations in assets/js/appointment-validation.js
• Doctor UI
– Static HTML in doctors/login.html, doctors/forget-pass.html
– CSS in assets/css/forget-pass.css, JS in assets/js/sent-fields.js
• Admin Dashboard
– PHP pages under app/dashboard/*.php (add-appointment, view-appointments, analysis, etc.)
– CSS in assets/css/admin-login.css, JS in assets/js/analytics.js
B. Server-Side (Backend)
• Public Endpoints (“handler” folder)
– PHP scripts: handler/fetch_all_appointments.php, handler/set_appointment_data.php, etc.
– Handle CRUD operations, AJAX calls from the frontend
• Core Business Logic (“functions” & “includes”)
– functions/: pure PHP helpers (date conversion, database-table fetch, message formatting)
– includes/: configuration & shared libraries (conn_db.php, send_notification.php, header.php)
• Authentication & Session Management
– app/auth.php for login/session checks
• Dependency Management
– composer.json / vendor/: any third-party PHP packages
C. Data Layer
• MySQL relational database
– Connection configured in includes/conn_db.php
– Tables for users (patients, doctors), appointments, notifications, etc.
D. External Services
• Notification service via includes/send_notification.php (email or SMS gateways)
• (Optional) Logging, Monitoring, Backup routines
Relationships & Data Flows
1. Browser → Web Server
– Users access static HTML/PHP pages.
2. Frontend → Backend APIs
– Form submissions & AJAX calls from JS (assets/js/...) to PHP handlers (handler/*.php).
3. Backend → Database
– Handlers use conn_db.php to execute SQL queries, fetch/update appointment and user tables.
4. Backend → External Notification
– After insert/update, send_notification.php sends emails/SMS to users/doctors.
5. Admin Dashboard ↔ Database ↔ Handlers
– Admin pages (app/dashboard/*.php) call the same handlers or directly include functions to manage data and view analytics.
Architectural Patterns & Design Principles
• Layered Architecture: Presentation (HTML/CSS/JS) → Application Logic (handler + functions) → Data Persistence (MySQL)
• Separation of Concerns:
• “handler/” only for request handling
• “functions/” purely utility functions
• “includes/” shared configuration and templates
• Role-Based Access: app/auth.php enforces doctor/admin sessions
• Stateless Frontend: page reloads or AJAX, no client-heavy frameworks
• Composer for modular PHP dependencies
a. Main Components:
• Doctor Browser
• Admin Browser
• Web Server (Apache/Nginx + PHP)
• Handler Layer (handler/*.php)
• Business Logic Layer (functions/, includes/)
• MySQL Database
• External Notification Service
c. Technologies & Frameworks: