How imarafat64/shopwise works
Project Type and Purpose
• This is a full-stack, monolithic e-commerce application built with Laravel (PHP).
• It supports three user roles—Admin, Seller, Customer—each with its own UI flows.
• Core features include product/catalog management, shopping cart, Stripe payments, coupons, and order tracking.
File Structure and README
• MVC Structure
– app/Http/Controllers (Admin, Seller, Auth, Stripe)
– app/Models (User, Product, Cart, Category, Coupon, Payment, etc.)
– resources/views (Blade templates for frontend, admin, seller, auth)
• Routing & Middleware
– routes/web.php, routes/auth.php
– Role-based middleware under app/Http/Middleware
• Configuration & Services
– config/database.php (MySQL)
– config/stripe.php (Stripe API)
– config/auth.php (guards for admin, seller, user)
• Asset Pipeline
– package.json, vite.config.js, tailwind.config.js
– public/assets/dist (compiled CSS/JS)
• Data Layer
– database/migrations define tables: users, categories, carts, products, product_images, payments, coupons
Main Components
a. Clients
– Customer Browser (frontend storefront)
– Seller Browser (seller dashboard)
– Admin Browser (administration dashboard)
b. Web Server / Load Balancer
– Nginx or Apache entrypoint serving public/index.php
c. Laravel Application (Single Monolith)
– HTTP Kernel & Middleware (Auth, Role enforcement)
– Controllers (Auth, Home, Profile, Admin, Seller, StripeController)
– Services / Business Logic (CartService, PaymentService, CouponService)
– Models & ORM (Eloquent ORM mapping to MySQL)
– Views (Blade templates)
d. Data Store
– MySQL Database (users, products, carts, orders, coupons)
– Optional Cache/Session Storage (file, Redis, configured under config/cache & config/session)
– Queues (jobs for email, order processing via config/queue)
e. External Services
– Stripe API for payment processing
– Mail service (SMTP/SES) for email verification, order confirmations
Relationships and Data Flows
• HTTP Requests from each client flow to the Web Server, then into the Laravel Kernel.
• Middleware checks roles/permissions before dispatching to Controllers.
• Controllers orchestrate calls to Models/Services, then read/write to the Database.
• PaymentController (StripeController) calls out to Stripe’s REST API.
• Responses (HTML via Blade views or JSON for AJAX) flow back to the client.
• Jobs (email, notifications) are queued; workers pull from the queue and send via Mail service.
Architectural Patterns and Principles
• MVC (Model-View-Controller)
• Role-Based Access Control via custom middleware (AdminMiddleware, SellerMiddleware, UserMiddleware)
• Service Layers for business logic (cart management, coupon application, payment processing)
• Eloquent ORM for ActiveRecord pattern
• Asset bundling/build pipeline (Vite, Tailwind, PostCSS)
Essential Elements
• Component Labels (e.g., “AdminController”, “Product Model”, “Stripe API”)
• Version notes (Laravel 11, PHP 8.x, MySQL 8.x)