A complete, professional e-commerce platform built with Laravel 10 backend, modern frontend with HTML/CSS/JavaScript, and Docker deployment. This project includes all the features of a modern e-commerce site with additional tools like n8n for workflow automation.
- Responsive Design: Mobile-first design that works on all devices
- Product Catalog: Browse products with advanced filtering and sorting
- Product Details: Detailed product pages with multiple images and descriptions
- Shopping Cart: Full cart functionality with quantity management
- User Authentication: Login and registration system
- Order Management: Order history and tracking
- Wishlist: Save favorite products
- Admin Panel: Complete admin interface for managing products, orders, and users
- Search & Filters: Advanced search with category, price, and sorting filters
- RESTful API: Complete REST API built with Laravel 10
- Authentication: Secure authentication with Laravel Sanctum
- Database Management: MySQL with migrations and seeders
- Product Management: CRUD operations for products
- Order System: Complete order processing workflow
- User Management: Admin and customer user roles
- Cart System: Session-based cart management
- Validation: Comprehensive input validation
- Error Handling: Proper error handling and responses
- n8n Integration: Workflow automation platform for business processes
- Docker Deployment: Complete containerized deployment
- Database Seeding: 50 sample products with realistic data
amazon-clone/
βββ backend/ # Laravel 10 Backend
β βββ app/
β β βββ Http/Controllers/ # API Controllers
β β βββ Models/ # Eloquent Models
β β βββ Http/Middleware/ # Custom Middleware
β βββ database/
β β βββ migrations/ # Database Migrations
β β βββ seeders/ # Database Seeders
β βββ routes/api.php # API Routes
β βββ Dockerfile # Backend Docker Configuration
β βββ .env # Environment Configuration
βββ frontend/ # Frontend Application
β βββ index.html # Homepage
β βββ product.html # Product Detail Page
β βββ cart.html # Shopping Cart
β βββ orders.html # Order History
β βββ admin.html # Admin Panel
β βββ css/style.css # Custom Styles
β βββ js/main.js # JavaScript Functionality
βββ docker-compose.yml # Docker Compose Configuration
βββ README.md # This file
- Backend: Laravel 10, PHP 8.2, MySQL 8.0
- Frontend: HTML5, Tailwind CSS, Vanilla JavaScript
- Authentication: Laravel Sanctum with JWT tokens
- Database: MySQL with Eloquent ORM
- Deployment: Docker & Docker Compose
- Automation: n8n workflow automation
- Docker and Docker Compose installed
- Git (for cloning the repository)
git clone <repository-url>
cd amazon-clonedocker-compose up --buildThis single command will:
- Build and start the Laravel backend on port 8000
- Start MySQL database on port 3306
- Start n8n automation platform on port 5678
- Set up all necessary dependencies
# Run migrations and seed data
docker-compose exec backend php artisan migrate --seed- Frontend: Open
frontend/index.htmlin your browser - Backend API: http://localhost:8000/api
- n8n Dashboard: http://localhost:5678 (admin/admin123)
- Database: localhost:3306 (user/password)
GET /api/products- List products with filteringGET /api/products/{id}- Get product detailsPOST /api/admin/products- Create product (Admin)PUT /api/admin/products/{id}- Update product (Admin)DELETE /api/admin/products/{id}- Delete product (Admin)
POST /api/cart/add- Add item to cartGET /api/cart- Get cart contentsPUT /api/cart/update- Update cart itemDELETE /api/cart/remove- Remove from cart
POST /api/orders- Create orderGET /api/orders- Get user ordersGET /api/orders/{id}- Get order detailsPUT /api/orders/{id}/cancel- Cancel order
POST /api/register- Register userPOST /api/login- Login userPOST /api/logout- Logout userGET /api/user- Get authenticated user
GET /api/admin/dashboard- Dashboard statsGET /api/admin/users- Manage usersGET /api/admin/orders- Manage orders
After running the seeder, you'll have these accounts:
- Email: admin@amazon-clone.com
- Password: admin123
- Role: Administrator
- Email: test@example.com
- Password: password
- Role: Customer
The application comes with 50 pre-loaded products across 6 categories:
- Electronics (iPhones, Laptops, Headphones, etc.)
- Fashion (Shoes, Clothing, Accessories)
- Home & Garden (Appliances, Smart Home devices)
- Sports & Outdoors (Fitness equipment, Outdoor gear)
- Books (Bestsellers across various genres)
- Beauty (Skincare, Makeup, Personal care)
- Input Validation: All inputs are validated on both frontend and backend
- Authentication: Secure token-based authentication with Laravel Sanctum
- Authorization: Role-based access control (Admin/User)
- CORS Configuration: Properly configured for cross-origin requests
- SQL Injection Prevention: Using Eloquent ORM and prepared statements
- XSS Protection: Input sanitization and output escaping
- Mobile-first approach
- Optimized for tablets and desktops
- Touch-friendly interface
- Smooth animations and transitions
- Loading states and error handling
- Toast notifications for user feedback
- Intuitive navigation and search
- Keyboard navigation support
- Screen reader compatible
- High contrast mode support
- Focus indicators for better usability
The included n8n platform allows you to create automated workflows such as:
- Order confirmation emails
- Inventory management alerts
- Customer follow-up sequences
- Data synchronization between systems
Access n8n at: http://localhost:5678
- Username: admin
- Password: admin123
For production deployment, update the following:
-
Environment Variables:
APP_ENV=production APP_DEBUG=false APP_URL=https://yourdomain.com
-
Database Configuration:
DB_HOST=your-database-host DB_DATABASE=your-database-name DB_USERNAME=your-database-user DB_PASSWORD=your-secure-password
-
Security:
- Generate a new APP_KEY:
php artisan key:generate - Use HTTPS in production
- Configure proper CORS settings
- Set up proper backup procedures
- Generate a new APP_KEY:
- Use a load balancer for multiple backend instances
- Implement Redis for session storage and caching
- Use CDN for static assets
- Consider database optimization and indexing
- Backend: Create controllers, models, and migrations in Laravel
- Frontend: Add new HTML pages and update JavaScript functionality
- Database: Create migrations for schema changes
- API: Document new endpoints in the API section above
- Backend: Use Laravel's testing framework
- Frontend: Implement unit tests for JavaScript functions
- Integration: Test API endpoints with tools like Postman
This project is open-source and available under the MIT License.
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
If you encounter any issues or have questions:
- Check the troubleshooting section below
- Create an issue in the repository
- Contact the development team
Docker containers won't start:
- Ensure Docker is running
- Check port availability (8000, 3306, 5678)
- Run
docker-compose downand try again
Database connection issues:
- Wait for MySQL container to fully initialize
- Check database credentials in .env file
- Ensure database is created and seeded
Frontend not loading products:
- Verify backend is running on port 8000
- Check browser console for CORS errors
- Ensure API endpoints are accessible
Permission errors:
- Check Docker container permissions
- Ensure proper file ownership
-
Database:
- Add indexes for frequently queried columns
- Optimize queries using Laravel Debugbar
- Consider database caching
-
Frontend:
- Implement lazy loading for images
- Minimize JavaScript bundle size
- Use CDN for static assets
-
Backend:
- Implement Redis caching
- Optimize database queries
- Use queue workers for heavy tasks
Built with β€οΈ for learning and demonstration purposes
This project showcases modern full-stack development practices and can serve as a foundation for real e-commerce applications.