How map1605/datn-project works
Project Type and Purpose
• This is a monolithic full-stack e-commerce web application written in PHP, HTML, CSS and JavaScript.
• It supports browsing products, viewing details, managing a cart, checkout, user registration/login and seller channel (“Kênh Người Bán”).
File Structure Analysis
• Top-level entrypoint: index.php
• datn-project/
• assets/ (static images)
• css/ (base styles and per-component CSS)
• js/ (component scripts, page-specific scripts, utilities)
• components/ (PHP/HTML partials: header, footer, product cards, etc.)
• pages/ (PHP/HTML endpoints handling routing and business logic)
• Standalone PHP scripts (e.g., get-image.php) for AJAX or media loading
• No separate “backend” microservice: PHP pages and components implement both routing and data access.
Missing Architecture Info in README
• README contains only a placeholder.
• We infer a classic LAMP-style stack with MySQL (or similar) as the database.
Main System Components
a. Client Browser
b. Web Server (Apache/Nginx + PHP runtime)
c. PHP Application Layer
• Router/Front Controller: index.php and per-page PHP scripts
• View Components: components/*.php & .html
• Business Logic: pages/*.php (cart operations, checkout, searches)
d. Static Assets Server
• CSS (css/base, css/components, main.css)
• JS (js/utils, js/components, js/pages, main.js)
• Images (assets/images)
e. Database
• User, Product, Cart, Order tables
f. External Services (optional)
• Payment gateway for checkout
• Email/SMS service for notifications
Relationships & Data Flow
1. Client issues HTTP(S) request for URL → Web Server
2. Web Server invokes index.php or pages/<action>.php
3. PHP script performs:
– Input validation & session/auth checks
– Database queries/updates
– Includes view components to render HTML
4. Server returns assembled HTML + CSS + JS references
5. Browser downloads static assets and executes JS (page scripts & components scripts)
6. JS may call AJAX endpoints (e.g., get-image.php, update-quantity.php) for dynamic updates
7. Checkout triggers server-side order processing and possibly external payment API
Architectural Patterns & Principles
• Component-based views: reusable header, footer, product card, banner
• Front Controller pattern via index.php and page scripts
• Separation of concerns:
• Presentation (HTML/CSS)
• Behavior (JS)
• Data Access & Business Logic (PHP + SQL)
Technologies & Frameworks
• PHP 7+ for server-side scripting
• Vanilla JavaScript with modular structure (utils, components, pages)
• CSS Modules by folder for maintainability
• Apache/Nginx web server, MySQL or MariaDB database
Detailed Capture of Elements
• AJAX endpoints (get-image.php, update-quantity.php)