E-Commerce Domain Model

Class diagram — entities, attributes, and relationships

classDiagram direction TB classDef yellow fill:#FFFDE7; classDef blue fill:#E3F2FD; classDef green fill:#E8F5E9; classDef purple fill:#F3E5F5; classDef teal fill:#E0F7FA; classDef orange fill:#FFF3E0; class User { +int id +string email +string name +string passwordHash +datetime createdAt +login(email, password) bool +logout() void +updateProfile(data) User } class Order { +int id +string status +decimal subtotal +decimal tax +decimal total +datetime placedAt +place() void +cancel(reason) bool +getItems() OrderItem[] } class OrderItem { +int id +int quantity +decimal unitPrice +decimal lineTotal +getSubtotal() decimal } class Product { +int id +string sku +string name +string description +decimal price +int stock +isAvailable() bool +decrementStock(qty) void } class Category { +int id +string name +string slug +getProducts() Product[] } class Address { +int id +string street +string city +string country +string postalCode } class Payment { +int id +string method +string status +decimal amount +datetime processedAt +process() bool +refund() bool } User "1" --> "0..*" Order : places User "1" --> "1..*" Address : has Order "1" --> "1..*" OrderItem : contains Order "1" --> "1" Address : ships to Order "1" --> "1" Payment : paid via OrderItem "0..*" --> "1" Product : references Product "0..*" --> "1" Category : belongs to cssClass "User" blue cssClass "Order" orange cssClass "OrderItem" green cssClass "Product" yellow cssClass "Category" purple cssClass "Address" teal cssClass "Payment" purple