How bkiran2003/spaesthetic works
Project type and purpose
• This is a monolithic PHP-based e-commerce/web-app:
• Static front-end HTML pages (login, signup, price_list, admin dashboard) served under public_html.
• A set of REST-style PHP API endpoints under public_html/api that handle authentication, product/catalog management, cart & orders, payments, settings, etc.
• File upload storage (public_html/uploads).
• A vendor directory holding third-party libraries (composer packages or front-end libs).
• There is likely a MySQL (or similar) database behind db_connect.php, and an external payment gateway.
File structure
• public_html/
• *.html front-end views (index.html, login.html, signup.html, price_list.html, admin_login, admin_dashboard).
• /api/: PHP scripts providing a JSON/HTTP API (auth, admin_auth, get_*, manage_*, cart_handler, order_handler, payment_handler).
• /uploads/: persistent file store for user or product uploads.
• /vendor/: third-party code (libraries for DB access, routing, middleware, front-end frameworks, etc.).
• README.md is empty—so no existing architecture docs.
• config.php holds environment settings.
• db_connect.php is the database connector.
Main components
a. Client Browser (Web UI)
– Static HTML/CSS/JS served from public_html.
– Calls API endpoints via AJAX/Fetch.
b. Web Server Layer
– Nginx/Apache serving static files and dispatching /api requests to PHP interpreter.
c. PHP Application Layer
– public_html/api/*.php scripts orchestrating business logic.
– config.php (env config), db_connect.php (database driver).
d. Database
– MySQL (or equivalent) storing users, products, orders, settings.
e. File Storage
– public_html/uploads for images/documents.
f. Third-Party Libraries
– vendor directory: PHP packages (e.g. composer), front-end frameworks (e.g. jQuery, Bootstrap).
g. External Services
– Payment gateway (stripe/paypal), optional email/SMS services.
Relationships & data flows
• Browser → Web Server (HTTP GET/POST to HTML pages and /api endpoints)
• Web Server ↔ PHP Application
• PHP Application ↔ Database (via db_connect.php)
• PHP Application ↔ File Storage (read/write uploads folder)
• PHP Application ↔ Third-Party Libs (via vendor/*)
• PHP Application ↔ External Payment Gateway (HTTPS API calls)
Architectural patterns & design principles
• Monolithic three-tier design: Presentation (static HTML + client JS), Application (PHP API), Data (DB + file store).
• REST-style endpoints in /api for separation of concerns.
• Configuration abstraction in config.php.
• Vendor directory for dependency management.