E-Commerce Domain Model

Class diagram — entities, attributes, and relationships

classDiagram direction TB 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 style User fill:#E3F2FD,stroke:#1A1A1A,stroke-width:2px style Order fill:#FFF3E0,stroke:#1A1A1A,stroke-width:2px style OrderItem fill:#E8F5E9,stroke:#1A1A1A,stroke-width:2px style Product fill:#FFFDE7,stroke:#1A1A1A,stroke-width:2px style Category fill:#F3E5F5,stroke:#1A1A1A,stroke-width:2px style Address fill:#E0F7FA,stroke:#1A1A1A,stroke-width:2px style Payment fill:#FCE4EC,stroke:#1A1A1A,stroke-width:2px