Master Prompt: Ecommerce Website with Admin Panel (Laravel + MySQL)

ecommerce-website-with-admin-panel

This master prompt is designed to generate a complete ecommerce website using Laravel and MySQL. It guides the creation of a full-stack system with a user-friendly shopping interface and a powerful admin panel for managing products, orders, users, and store settings.

🛒 Global eCommerce Platform

Project Identity

Project directory: C:\xampp\htdocs\ecommerce

Name: Global eCommerce Platform Type: Full-stack multi-vendor-ready eCommerce system with custom admin dashboard Version Target: Laravel 11.x (latest stable) Audience: B2C consumers + store admin(s)

Tech Stack (Locked)

Layer Technology
Backend Laravel
Frontend Blade + Tailwind CSS
Database MySQL
Auth Laravel Breeze (extendable to Sanctum)
Payments Stripe, PayPal, Cash on Delivery
AJAX/UX Alpine.js + Axios
Media Spatie Media Library
Admin Panel Custom Laravel Admin (no Nova/Filament)
Queue/Jobs Laravel Queue (database driver)
Cache Laravel Cache (Redis-ready)
Storage Laravel Storage (S3-ready)

Architecture Rules

  1. Follow strict MVC + Service Layer pattern — no business logic in controllers or views.
  2. Use Repository pattern for data access where queries are complex.
  3. All routes must be organized into route groups (web.php, admin.php, api.php).
  4. Use Form Request classes for all validation — never validate in controllers directly.
  5. All database interactions via Eloquent — no raw queries except for complex reports.
  6. Use database migrations for all schema changes, seeders + factories for test data.
  7. Use Blade components (<x-component>) for all reusable UI elements.
  8. Apply SOLID principles — especially Single Responsibility.
  9. Use Laravel Events & Listeners for side effects (email, inventory alerts, logs).
  10. Comment every non-obvious code block with a // Reason: explanation.

Database Schema

Tables & Key Relationships

users                → orders, reviews, wishlists, addresses

categories           → subcategories (self-referential), products

products             → product_images, product_variants, order_items, reviews, wishlists

product_variants     → (size, color, SKU, stock, price)

orders               → order_items, payments, shipping_details

order_items          → products, product_variants

payments             → orders (polymorphic-ready)

coupons              → orders (pivot: coupon_usages)

reviews              → users, products

wishlists            → users, products

addresses            → users

settings             → (key/value store, typed)

cms_pages            → (slug, title, content, SEO fields)

newsletters          → (email, subscribed_at)

Column Conventions

  • All tables use id (unsigned bigint, auto-increment), created_at, updated_at.
  • Use soft_deletes on: users, products, orders, categories.
  • Use status ENUM fields where appropriate: [‘active’,’inactive’], [‘pending’,’processing’,’shipped’,’completed’,’cancelled’,’refunded’].
  • Money fields stored as integers (cents) to avoid float precision issues.

Admin Dashboard

Authentication

  • Separate admin guard (guards.admin in auth.php).
  • Admin middleware group applied to all /admin/* routes.
  • Role field on users table: [‘superadmin’, ‘admin’, ‘staff’].
  • Staff can view but not delete; only superadmin can manage other admins.

Dashboard Overview (real-time stats)

  • Today’s revenue vs. yesterday (percentage delta).
  • Total orders by status (donut chart via Chart.js).
  • Revenue over last 30 days (line chart).
  • Top 5 selling products.
  • Low stock alerts (products with qty ≤ threshold).
  • Recent 10 orders table with quick status update.
  • New customer signups this week.

Modules

Store Settings

General:     store name, logo, favicon, tagline, contact email, phone, address

Currency:    default currency, currency symbol, currency position

Tax:         tax rate (%), tax inclusive/exclusive toggle, per-region tax (optional)

Shipping:    flat rate, free shipping threshold, per-product shipping override

SEO:         default meta title, description, OG image

Social:      links for Facebook, Instagram, Twitter/X, YouTube, TikTok

Payments:    enable/disable Stripe, PayPal, COD; enter API keys via encrypted settings

Theme:       primary color, accent color, dark mode default

Homepage:    toggle sections on/off (hero, categories, featured, bestsellers, testimonials)

Product Management

Fields:

– Title, slug (auto-generated, editable)

– Short description (for cards), long description (rich text)

– Category + subcategory

– Tags (comma-separated, stored as JSON or pivot table)

– Base price (cents), sale price (cents), sale end date

– SKU (auto-generated if blank)

– Stock quantity, low stock threshold

– Weight + dimensions (for shipping)

– Featured toggle, status toggle

– Multiple images (up to 10, with primary image flag)

– Variants: add variant groups (e.g., Color, Size) with individual SKU/price/stock overrides

 

Bulk Actions:

– Bulk delete, bulk status change, bulk export (CSV)

Category Management

– Name, slug, description

– Parent category (self-referential, depth limit: 3)

– Category image

– SEO fields (meta title, description)

– Status (active/inactive)

– Display order (drag-and-drop sortable)

Order Management

– Filterable list: by status, date range, payment status, customer

– Order detail view:

– Customer info + address

– Ordered items with variant details

– Payment method and status

– Shipping tracking number field

– Status update dropdown with email trigger

– Internal notes field (admin only)

– Invoice: PDF generation (Dompdf) with store branding

– Refund flag (manual, for record-keeping)

Customer Management

– Full customer list with search and filter

– Customer profile: account info, address book, order history, review history

– Block/unblock with reason stored in DB

– Export customer list (CSV)

Coupon System

– Code (uppercase, unique)

– Type: flat amount or percentage

– Minimum order value

– Max usage (global + per-user)

– Expiry date

– Applicable to: all products, specific categories, specific products

– Usage report (who used it, when, how much saved)

Content Management (CMS)

Dynamic pages with:

– Title, slug, content (rich text via Quill or TipTap)

– SEO meta fields

– Status (published/draft)

– Last edited by + timestamp

 

Pre-seeded pages: About, FAQ, Terms & Conditions, Privacy Policy, Contact

Reports Module

– Sales Report: revenue by day/week/month, filterable by date range and category

– Inventory Report: stock levels, low-stock items, sold quantities

– Customer Report: new vs returning, top buyers

– Export all reports as CSV or PDF

Public Website

Layout & Navigation

Header:

– Logo (links to home)

– Main nav: Home | Shop | Categories (mega-menu) | About | Contact

– Right icons: Search | Wishlist (count) | Cart (count) | User Account

– Sticky on scroll, collapses to hamburger on mobile

 

Footer:

– Store info + social links

– Quick links (CMS pages)

– Newsletter subscription input

– Payment method icons

– Copyright + currency/language switcher (if multi-lang enabled)

Homepage

  1. Hero Slider — animated, CMS-managed, CTA button
  2. Category Grid — icons + names, top 8 categories
  3. Featured Products — badge “Featured”, admin-flagged
  4. Promotional Banner — full-width image banner (CMS-managed)
  5. Latest Products — newest 8 products
  6. Best Sellers — highest-ordered products (calculated)
  7. Testimonials — static or CMS-managed review quotes
  8. Newsletter Bar — email capture with AJAX submission

Shop Page

Sidebar:

– Categories (collapsible tree)

– Price range slider (min/max, AJAX filter)

– Rating filter

– Availability filter (in stock only)

 

Main area:

– Search bar (with debounce AJAX)

– Sort: Newest, Price Low-High, Price High-Low, Best Rated, Best Selling

– Grid/List view toggle

– Product cards with: image, name, price, rating, Add to Cart, Wishlist

– Pagination (server-side, SEO-friendly URLs)

– Quick View modal (AJAX product load)

Product Detail Page

– Image gallery with thumbnail strip + zoom on hover

– Breadcrumb navigation

– Product title, rating summary, review count

– Price (strike-through original if on sale, countdown timer for sale end)

– Stock status indicator

– Variant selector (color swatches, size buttons — updates price/stock dynamically)

– Quantity picker

– Add to Cart (AJAX) + Buy Now (direct to checkout)

– Wishlist toggle

– Share buttons

– Tabbed section: Description | Specifications | Reviews

– Related products (same category, randomized)

Cart

– Persistent cart (DB for logged-in, session for guests, merge on login)

– AJAX add/update/remove — no page reload

– Cart sidebar drawer (slides in from right)

– Cart page: item list, quantity update, subtotal

– Coupon input with AJAX validation

– Shipping estimate

– Order summary sidebar

– Proceed to Checkout CTA

Checkout

Step 1 — Contact & Shipping

– Guest checkout OR login prompt

– Full name, email, phone

– Address (with country dropdown, state auto-populate if possible)

– Shipping method selection

 

Step 2 — Payment

– Stripe (card form via Stripe.js Elements — PCI compliant)

– PayPal (redirect flow)

– Cash on Delivery

 

Step 3 — Review & Place Order

– Order summary, final total, payment method

– Place Order button

– On success: order confirmation page + email

 

Modal option: Floating checkout modal for single-product “Buy Now” flow.

User Account

Dashboard:  recent orders, wishlist preview, profile completion indicator

Orders:     paginated list → order detail view with timeline

Wishlist:   grid of saved products, add-to-cart from wishlist

Addresses:  manage multiple saved addresses, set default

Profile:    update name, email, password, avatar

Auth Pages

Login | Register | Forgot Password | Reset Password | Email Verification

All pages styled to match store theme.

Use Laravel’s built-in password hashing (bcrypt).

Rate-limit login attempts (5/min via throttle middleware).

Payment Integration

Stripe

– Use Stripe.js Elements for card input (no raw card data touches server)

– Create PaymentIntent on backend via stripe-php SDK

– Handle webhooks: payment_intent.succeeded, payment_intent.payment_failed

– Store: stripe_payment_intent_id in payments table

PayPal

– Use PayPal REST SDK (srmklive/paypal package)

– Create order on PayPal, redirect user, capture on return

– Store: paypal_order_id in payments table

Cash on Delivery

– No external API

– Order created with payment_status = ‘pending’

– Admin marks as paid when collected

Multi-currency

– Store all prices in base currency (cents)

– Currency conversion via exchangerate-api.com or OpenExchangeRates (cached hourly)

– Display in user’s selected currency; checkout always in base currency

– Store selected currency in session/cookie

Email Notifications (Laravel Mail + Queue)

Trigger Email Sent To
Order placed Customer + Admin
Order status changed Customer
Payment confirmed Customer
Password reset Customer
Welcome / email verification Customer
Low stock alert Admin
New customer registration Admin
  • Use Mailable classes with Blade templates.
  • Queue all emails via dispatch()->onQueue(’emails’).
  • Use Markdown mail for clean, responsive templates.

Performance & Security

Performance

  • Eager load all relationships (no N+1 — use Laravel Debugbar in dev).
  • Cache: store settings, category tree, homepage sections (cache bust on admin save).
  • Images: lazy load in frontend, optimize on upload via Intervention Image.
  • Pagination: always paginate product lists (default 16/page).
  • Use db:index on foreign keys and frequently filtered columns.

Security

  • All forms use @csrf.
  • Use policy classes for authorization (user can only edit own profile/orders).
  • Admin routes double-protected: middleware + gate check.
  • Stripe keys + PayPal secrets in .env, never hardcoded.
  • Sanitize all rich-text CMS content (HTMLPurifier or Blade’s {!! !!} only where safe).
  • File upload validation: mime type + size + extension whitelist.
  • Prevent mass assignment: always define $fillable in models.

File & Folder Structure

app/

Http/

Controllers/

Admin/          ← all admin controllers

Auth/           ← auth controllers

Frontend/       ← public-facing controllers

Middleware/

Requests/         ← Form Request classes (one per feature)

Models/

Services/           ← Business logic (CartService, OrderService, PaymentService)

Repositories/       ← Data access layer

Events/ & Listeners/

Mail/

Notifications/

 

resources/

views/

layouts/

app.blade.php           ← public layout

admin.blade.php         ← admin layout

components/               ← reusable Blade components

frontend/                 ← public page views

admin/                    ← admin page views

emails/                   ← email templates

partials/                 ← shared partials (header, footer, modals)

 

routes/

web.php                     ← public routes

admin.php                   ← admin routes (prefixed /admin)

api.php                     ← AJAX endpoints

 

database/

migrations/

seeders/

factories/

Seeders & Demo Data

Provide seeders for:

  • 1 superadmin account (admin@store.com / password)
  • 5 categories with 2 subcategories each
  • 30 products with images, variants, prices
  • 20 test customer accounts
  • 10 sample orders in mixed statuses
  • 5 coupons (mix of types)
  • All CMS pages (About, FAQ, Terms, Privacy, Contact)
  • Default store settings

Bonus Features (Implement in this order if time allows)

  1. Wishlist — toggle via AJAX, persist to DB for logged-in users
  2. Product Reviews — star rating + comment, admin approve before publish
  3. Inventory Alerts — auto-email admin when stock ≤ threshold
  4. Sales Reports — downloadable CSV/PDF from admin
  5. Dark Mode — admin panel toggle, saved to localStorage
  6. Multi-language — Laravel Localization, at least EN + AR (RTL support)
  7. PWA-ready — manifest.json + service worker stub

Deliverables Checklist

  • [ ] Full Laravel project (installable via composer install + .env setup)
  • [ ] All database migrations
  • [ ] All Eloquent models with relationships + scopes
  • [ ] All controllers (admin + frontend + auth)
  • [ ] All Form Request validators
  • [ ] Service classes (CartService, OrderService, PaymentService, CouponService)
  • [ ] Named routes for every page
  • [ ] All Blade templates (public + admin)
  • [ ] Blade components library
  • [ ] Stripe + PayPal integration files
  • [ ] Mail templates (all triggers above)
  • [ ] Seeders + Factories
  • [ ] .env.example with all required keys documented
  • [ ] README.md installation guide (step-by-step)
  • [ ] SQL dump of final schema

Output code that is production-ready, modular, fully commented, and immediately deployable. Prioritize working logic over placeholder stubs. Every file generated should be complete — no // TODO left behind.

Share with friends:
Scroll to Top