Design Online Shopping System like Amazon
| Difficulty: Hard | Source: awesome-low-level-design |
Requirements
- Browse products, add to cart, place orders
- Multiple product categories with search
- Manage profiles, view order history, track status
- Inventory management
- Multiple payment methods
- Concurrent access
- Scalable
- User-friendly
Class Diagram

Classes, Interfaces and Enumerations
| Class/Interface | Description |
|---|---|
| User | Id, name, email, password, orders list |
| Product | Id, name, description, price, quantity; update quantity, check availability |
| Order | Id, user, order items, total, status |
| OrderItem | Product, quantity |
| OrderStatus | Enum: pending, processing, shipped, delivered, cancelled |
| ShoppingCart | Add, remove, update items; map of product IDs to order items |
| Payment | Interface; CreditCardPayment implementation |
| OnlineShoppingService | Singleton; synchronized |
Design Patterns Used
| Pattern | Application |
|---|---|
| Singleton | OnlineShoppingService provides centralized management of users, products, and orders with synchronized access |
Code Implementations
| Language | Source Code |
|---|---|
| Java | View on GitHub |
| Python | View on GitHub |
| C++ | View on GitHub |
| C# | View on GitHub |
| Go | View on GitHub |