Design: Shopping Cart and Session Management System
Design covers shopping cart operations and session management including storage, retrieval, and expiration. User authentication and payment processing are out of scope.
Functional Requirements
FR1: Allow users to add, update, and remove items in their shopping cart.
FR2: Maintain user session to keep the cart state across multiple requests and visits.
FR3: Support both logged-in users and guest users with temporary sessions.
FR4: Ensure cart data is consistent and available during the shopping process.
FR5: Allow cart recovery after session expiration or user logout.
FR6: Support up to 100,000 concurrent users with low latency.
FR7: Provide APIs for frontend to interact with cart and session data.
Non-Functional Requirements
NFR1: API response time p99 should be under 150ms.
NFR2: System availability should be at least 99.9% uptime.
NFR3: Session data should expire after 30 minutes of inactivity for guests.
NFR4: Persist cart data for logged-in users for at least 30 days.
NFR5: Handle sudden traffic spikes during sales events.
