How rmohitzz21/ux_shop_new works
1. Project type and runtime
- This is a server-rendered PHP e-commerce storefront with a separate admin console and a versioned JSON-style API layer under api/.
- The app appears to run on a PHP + MySQL/MariaDB stack, with database schema files in marketplace_schema.sql and uxmerchandise.sql.
2. Presentation layer
- Public-facing pages live at the repo root: index.php, shopAll.php, category.php, product.php, cart.php, checkout.php, wishlist.php, signin.php, signup.php, account.php, orders.php, order-confirmation.php, etc.
- Shared UI/layout code is centralized in includes/header.php and includes/footer.php, with global styling in style.css and client-side behavior in script.js.
- This suggests a classic PHP page model where pages render server-side and then call APIs for interactive actions.
3. API as the main application boundary
- Most business operations are exposed through api/, which is the main boundary between the browser and server logic.
- The API is organized by domain: auth, cart, wishlist, address, catalog, product, order, user, contact, plus admin/*.
- This separation indicates that pages likely consume these endpoints via fetch/AJAX rather than embedding all business logic directly in the page scripts.
4. Authentication and session management
- Authentication flows are concentrated in api/auth/*, including login, signup, logout, session lookup, CSRF token issuance, and password reset flows.
- The presence of includes/auth-preload.php implies a shared server-side guard or session bootstrap used by protected pages.
- Admin authentication is distinct from customer authentication via api/auth/admin-login.php and admin-side utilities in api/admin/_admin.php.
5. Customer commerce data flow
- Core shopping flows are: browse catalog → view product detail → add to cart → checkout → create order.
- The catalog/product split is visible in api/catalog/list.php, api/catalog/detail.php, api/product/get_details.php, and api/product/search.php.
- Cart operations are isolated in api/cart/*, while order creation and retrieval are in api/order/*.
- User-specific state is managed separately for addresses and profiles via api/address/* and api/user/update_profile.php.
6. Wishlist and account personalization
- Wishlist is a first-class subsystem under api/wishlist/*, with its own table helper in api/wishlist/_table.php.
- Account data is also split into profile and address management, which suggests the app stores user identity, shipping info, and saved preferences separately from cart/order state.
7. Checkout and payment integration
- Payment-related code is present in includes/OrderPaymentService.php and includes/RazorpayClient.php, indicating a payment gateway integration.
- The older apiold/payment/* folder explicitly includes Razorpay create-order, verify, and webhook handlers, so payment processing has previously been webhook-driven and is likely still structurally similar.
- The checkout path therefore spans frontend checkout UI, order creation APIs, payment gateway interaction, and post-payment verification/update logic.
8. Admin subsystem
- Admin functionality is separated under admin/ pages and api/admin/* endpoints.
- Admin pages include dashboard, login, add/edit product, and a dashboard script, while admin APIs cover product CRUD, categories, bundles, orders, users, and statistics.
- This is a distinct management plane: admins manage catalog content and operational data, while customers only interact with storefront APIs.
9. Supporting services and cross-cutting concerns
- includes/EmailService.php and includes/mail.php indicate outbound email support, used by authentication and likely order/contact workflows.
- includes/Logger.php and logs/app_errors.log show explicit application logging.
- includes/config.php, includes/env.php, and .env.example suggest environment-based configuration for secrets, DB credentials, and service endpoints.
- includes/helpers.php and includes/marketplace.php likely hold shared domain utilities and database access helpers.
10. Legacy boundary
- The apiold/ tree is a parallel legacy API implementation covering auth, cart, order, product, user, admin, email, and payment.
- Its presence suggests an ongoing migration or compatibility layer; for architecture diagrams, it should be shown as deprecated/legacy and separated from the active api/ namespace.
11. Static assets and generated content
- Product and screenshot images live under img/, including img/products and img/ss/*, implying server-hosted media assets for catalog content and documentation/UI assets.
- Root 404.php and 500.php provide custom error pages, reinforcing that this is a traditional web app served directly by PHP.
12. Overall architecture shape
- The system is best modeled as: browser/UI pages at the top, domain APIs in the middle, shared PHP services in includes/, and MySQL database + external services at the bottom.
- External dependencies that materially affect architecture are email delivery and Razorpay payment processing.
- The clearest subsystem boundaries are: storefront pages, customer API, admin API, auth/session, order/payment, and legacy apiold/.
Main entry points: marketplace_schema.sql MySQL schema · login.php Customer auth · list.php Catalog API · mail.php Email service
Components 20
Storefront UI
Public PHP pages rendered server-side for shopping and account flows
- Storefront pages · Public browsing, account, cart, and checkout entry pages
index.php - Auth pages · Signin, signup, password reset, and account access pages
signin.php - Catalog pages · Category, product, search, bundles, and shop listing pages
shopAll.php - Checkout flow · Cart, checkout, order confirmation, and order history pages
cart.php
Customer API
Active JSON-style endpoints used by the storefront
- Customer auth · Login, signup, session, CSRF, and password reset endpoints
api/auth/login.php - Catalog API · Browse and product detail/search endpoints for storefront pages
api/catalog/list.php - Commerce API · Cart, order, address, wishlist, profile, and contact endpoints
api/cart/add.php - Customer profile · Profile updates and user-scoped account data
api/user/update_profile.php
Admin Plane
Back-office pages and admin endpoints for catalog and operations
- Admin pages · Admin dashboard and product management screens
admin/admin-dashboard.php - Admin APIs · Admin authentication plus product, category, bundle, order, user, and stats endpoints
api/admin/product/list.php
Shared PHP
Reusable bootstrap, services, and cross-cutting utilities
- Store bootstrap · Shared request bootstrap and auth preloading for protected pages
api/_bootstrap.php - Layout shell · Shared header, footer, and client-side app script
includes/header.php - Config & env · Environment loading and application configuration
includes/config.php - Core services · Mail, logging, marketplace helpers, and payment gateway adapters
includes/OrderPaymentService.php
Legacy API
Deprecated parallel API tree kept for compatibility or migration
- Legacy auth · Deprecated auth and session endpoints from the old API tree
apiold/auth/login.php - Legacy commerce · Deprecated cart, order, product, user, contact, email, and payment endpoints
apiold/cart/add.php
Data & Integrations
Persistent storage and external services that shape the application
- MySQL schema · Application schema and data model definitions
marketplace_schema.sql - Media assets · Product images and screenshot assets served by the app
img/products - Email service · Outbound email delivery used by auth and transactional flows
includes/mail.php - Razorpay · Payment gateway integration for checkout and verification
includes/RazorpayClient.php
Connections 19
- Storefront pages → Store bootstrap: bootstraps · Public pages initialize through shared server bootstrap
- Storefront pages → Layout shell: renders · Storefront pages reuse common header and footer shell
- Auth pages → Customer auth: uses · Authentication pages drive customer auth endpoints
- Catalog pages → Catalog API: loads catalog · Listing and product pages fetch catalog data
- Checkout flow → Commerce API: orders · Cart and checkout pages call commerce endpoints
- Checkout flow → Razorpay: pays via · Checkout integrates with payment gateway flows
- Admin pages → Admin APIs: administers · Admin screens are backed by admin APIs
- Admin pages → Layout shell: shares ui · Admin pages also rely on the shared UI shell
- Customer auth → Config & env: configured by · Auth endpoints depend on environment and config loading
- Catalog API → MySQL schema: reads schema · Catalog queries are backed by the application database
- Commerce API → MySQL schema: reads/writes · Commerce state is persisted in the core database
- Customer profile → MySQL schema: stores profile · User profile updates persist to the database
- Admin APIs → MySQL schema: manages data · Admin operations manage product, order, and user records
- Core services → Email service: sends mail · Shared services handle outgoing email notifications
- Core services → Razorpay: processes payment · Shared services wrap Razorpay checkout and verification
- Customer auth → Email service: notifies · Password reset and signup flows can trigger email delivery
- Legacy commerce → Razorpay: legacy payments · Legacy API contains older Razorpay order and webhook handling
- Legacy commerce → Email service: legacy email · Legacy tree also includes email-related behavior
- Media assets → Catalog API: illustrates · Catalog pages are backed by hosted product media