How oussama-filali/liberta_mobile works
Project Type & Purpose
• This is a full-stack online shop (“boutique en ligne”) named Liberta_Mobile.
• Frontend: React Single-Page App under frontendcd/
• Backend: Custom PHP REST API under backend/api/
• Persistence: MySQL database (schema in liberta_mobile (4).sql)
• Deployment: Docker-Compose, Apache config, PHP Dockerfile
File Structure
• Top-level
– Docker-Compose.yml (orchestrates services)
– Apache/default.config (virtual-host settings)
– php/Dockerfile (builds PHP+Apache container)
– .env in backend/ (DB creds) & passeworld.txt (passwords)
• backend/api/
– config/database.php → establishes DB connection
– middleware/cors.php → enables cross-origin requests
– routes/index.php → maps endpoints to controllers
– controller/ProduitController.php → business logic
– models/{User,Produit}.php → data representations
– endpoints: auth (login/register), produits (list/filter), commande (creer), facture (generer), promotions
– assets/images → file storage for product images
• frontendcd/
– Standard create-react-app layout: public/ + src/
– Pages: Forfaits, Packs, Panier, Telephones
– Components: Header, App
– Uses fetch/Axios for API calls
README
• Simple description: “Liberta_Mobile boutique en ligne”
a. Main Components
• User’s Browser (React SPA)
• Frontend Static Server (Node.js dev server or Apache)
• PHP+Apache Container (REST API)
• MySQL Container (database)
• File Storage (container volume for images)
• Docker-Compose Network
b. Relationships & Data Flows
1. Browser → HTTP(S) GET → Frontend Server → serves index.html + JS bundle
2. React App → AJAX (HTTP/JSON) → PHP API (CORS enabled)
3. PHP API → MySQL (TCP/MySQL protocol) → queries results
4. PHP API ↔ Filesystem volume → read/write product images
5. Docker-Compose network connects all containers by name
c. Architectural Patterns & Principles
• Layered architecture: Presentation (React), Business Logic (PHP controllers), Data Access (models, DB)
• RESTful API design
• MVC-style separation in backend
• Single-Page Application pattern
• Containerization for environment consistency
d. Key Technologies
• React, JavaScript, Node.js (frontend)
• PHP, Apache, Composer (backend)
• MySQL (database)
• Docker, Docker-Compose (orchestration)