How sonykar/react-online-shop works
The project is a full-stack online shop application with a clear separation between the frontend (a React-based client) and the backend (a PHP-based API). The backend handles data operations and business logic for entities such as products, collections, cart items, and authentication, while the frontend delivers the user interface and communicates with the backend via HTTP (likely with Axios).
Main Components
• Frontend (React Application)
• Located in the "web" directory.
• Contains components, containers, state management (Redux store), assets, and the routing logic.
• Implements features like authentication, catalog browsing, shopping cart management, and checkout.
• Backend (PHP API)
• Found under the "php" directory.
• Handles database connectivity (connection.php), entity definitions (product, collection, cartItem), and response endpoints for authentication, cart, products, and collections.
• Includes endpoints for actions such as login, signup, adding/removing products, updating collections, merging cart items, sending emails, and subscribing.
• Database
• Represented by the "doublem.sql" file. This likely contains the schema for tables related to users, products, collections, cart items, etc.
• External Services (if any)
• The PHP scripts for sending emails and handling subscriptions may interact with external services.
Relationships and Data Flow
• User Interactions → React Frontend:
• React Frontend → Backend API:
• Endpoints for authentication (login/signup), cart management (add, update, delete cart items), collections, and products.
• Backend API → Database:
• Additional Interactions:
• A connection for sending emails (sendMail.php) and subscribing (subscribe.php) which might involve external systems.
Architectural Patterns and Technologies
• MVC or Layered Architecture:
• On the backend, the code structure in the "php" directory indicates a layered approach: entity models, API response endpoints, and potentially a thin controller layer.
• Separation of Concerns:
• Clearly separate the presentation layer (React components and containers), application logic (Redux actions and reducers), and data access (PHP API and database).
• Technology Stack:
• Frontend: React, Redux, Axios.
• Backend: PHP.
• Database: SQL-based (likely MySQL, based on the SQL file).
• Other: Possibly third-party APIs for email and subscription services.