← Uber Interview Insights

Uber·Software Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
Jun 2026

Summary

System design round at Uber for a backend role, centered entirely on designing a cart and checkout system for an on-demand delivery app. The prompt was intentionally left vague so you had to drive the requirements yourself, which I found more stressful than the actual design work.

Questions Asked (4)

Q1

Design the backend cart system for an on-demand delivery app, covering the full lifecycle from cart creation through checkout and fulfillment.

System DesignAdaptability & Ambiguity
Author's notes

The prompt is intentionally vague and they want you to ask clarifying questions before touching the design.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and scope (e.g., single vs. multi-restaurant carts, real-time inventory, payment integration), then design a scalable, event-driven architecture that handles the cart lifecycle from creation to fulfillment. Focus on data consistency, idempotency, and low-latency updates, while discussing trade-offs and failure handling.

Pro tip: Emphasize idempotency and eventual consistency for cart mutations and checkout, as these are critical in distributed systems to avoid duplicate orders and ensure a smooth user experience.

1. Clarify Requirements and Scope

Ask questions to understand functional and non-functional requirements, such as cart persistence, multi-device support, inventory checks, and expected scale. Define boundaries like whether carts are per restaurant or per user, and how fulfillment integrates.

2. High-Level Architecture

Sketch the main components: API gateway, cart service, inventory service, pricing service, order service, and payment service. Choose a data store (e.g., Redis for active carts, DynamoDB for persistence) and communication patterns (sync REST for reads, async events for updates).

3. Cart Lifecycle and Data Model

Define the cart state machine (created, active, checked out, abandoned) and the data model (cart ID, user ID, items, quantities, prices, status). Explain how to handle item additions, updates, and removals with idempotent operations.

4. Checkout and Fulfillment Flow

Describe the checkout process: validate cart, lock inventory, calculate final price, process payment, and create order. Use idempotency keys to prevent duplicate orders and handle failures with retries and compensating transactions.

5. Scalability, Consistency, and Trade-offs

Discuss partitioning (e.g., by user ID), caching, and eventual consistency for cart updates. Address trade-offs between consistency and availability, and how to handle concurrent updates and race conditions.

Key Points to Mention

  • Idempotency for cart mutations and checkout to avoid duplicate orders
  • Data consistency models (strong vs. eventual) and their impact on user experience
  • Scalability strategies: sharding by user/region, caching, and read replicas
  • Event-driven architecture for decoupling services and handling asynchronous workflows
  • Failure handling: retries, dead-letter queues, and compensating transactions
  • Integration with inventory, pricing, and payment services, including locking mechanisms

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

How would you model the data for a cart system, and what indexing strategy would you use to support common queries like fetching a user's active cart or all items in a cart?

Data ModelingSystem Design
Author's notes

Pretty natural once I had the requirements scoped.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements and access patterns, then propose a logical data model with separate tables for carts, cart items, and products. Explain how you would index to support the most frequent queries efficiently, and discuss trade-offs like consistency vs. availability and SQL vs. NoSQL choices.

Pro tip: Mention that you would consider using a composite index on (user_id, status) for active carts and (cart_id, product_id) for cart items, and highlight that you would avoid over-indexing to keep write performance acceptable.

1. Clarify requirements and access patterns

Ask about expected read/write ratio, data volume, consistency needs, and the most common queries (e.g., fetch active cart, add/remove items, checkout).

2. Design the logical data model

Propose entities: User, Cart, CartItem, Product. Define relationships and key attributes, ensuring carts can be active or completed.

3. Choose storage technology and physical schema

Decide between relational (e.g., PostgreSQL) or NoSQL (e.g., DynamoDB) based on scale and access patterns, and define tables/collections with appropriate primary keys.

4. Define indexing strategy

Create indexes to support frequent queries: composite index on (user_id, status) for active carts, and index on cart_id for fetching items. Consider covering indexes for read-heavy paths.

5. Discuss trade-offs and optimizations

Address write amplification from indexes, caching strategies (e.g., Redis for active carts), and how to handle cart expiration or archival.

Key Points to Mention

  • Composite index on (user_id, status) to quickly find a user's active cart.
  • Index on cart_id (or composite (cart_id, product_id)) to fetch all items in a cart efficiently.
  • Consider using a separate table for cart items with a foreign key to carts, and possibly a unique constraint on (cart_id, product_id) to prevent duplicates.
  • Trade-offs: more indexes improve read performance but slow down writes; choose indexes based on query patterns.
  • Caching active carts in Redis to reduce database load for frequent reads.
  • Handling cart lifecycle: soft deletes or status field to mark carts as abandoned/completed, and archiving old carts.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

Multiple devices can update the same cart simultaneously. How do you handle concurrent modifications and prevent conflicts or data corruption?

System DesignTechnical Trade-offs
Author's notes

This is where I felt most confident.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements and constraints, such as consistency needs and scale. Then, propose a layered strategy: optimistic concurrency control with versioning at the application level, backed by database transactions and appropriate isolation levels. Finally, discuss trade-offs and alternatives like pessimistic locking or CRDTs for specific scenarios.

Pro tip: Mention that you would first try to avoid conflicts by designing the system to minimize shared mutable state, such as using a single writer per cart or partitioning by user. This shows you think about prevention, not just resolution.

1. Clarify requirements and constraints

Ask about consistency requirements (strong vs. eventual), expected concurrency level, and whether the cart is per-user or shared. This determines the appropriate solution.

2. Choose a concurrency control strategy

Decide between optimistic and pessimistic approaches. For carts, optimistic concurrency with version numbers is often suitable due to low contention.

3. Implement with database support

Use database transactions with appropriate isolation levels (e.g., serializable or snapshot isolation) and version checks in update statements to prevent lost updates.

4. Handle conflicts gracefully

Define conflict resolution: retry on version mismatch, merge changes, or notify the user. Ensure idempotent operations to avoid duplicate updates.

5. Discuss trade-offs and alternatives

Compare with pessimistic locking (higher contention, lower throughput) and CRDTs (eventual consistency, complex merges). Choose based on business needs.

Key Points to Mention

  • Optimistic concurrency control using version numbers or timestamps
  • Database transactions and isolation levels (e.g., serializable, snapshot)
  • Idempotent operations and retry mechanisms
  • Conflict resolution strategies (last-write-wins, merge, user prompt)
  • Trade-offs between consistency, availability, and latency (CAP theorem)
  • Alternative approaches: pessimistic locking, distributed locks, CRDTs

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

How do you ensure that checkout converts a cart to an order exactly once and that the cart state is valid at the time of conversion?

System DesignTechnical Trade-offsData Modeling
Author's notes

Correctness at checkout is the crux of the whole problem.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by framing the problem as a distributed transaction requiring idempotency and consistency. Propose a design that uses a unique checkout token or idempotency key to ensure exactly-once order creation, and validate cart state (e.g., items in stock, prices unchanged) within the same transaction or via a saga with compensating actions. Discuss trade-offs between strong consistency and availability, and how to handle failures and retries.

Pro tip: Emphasize that exactly-once is achieved through idempotent operations and deduplication, not by trying to prevent retries. Mention that you would use a database unique constraint on the idempotency key to enforce it at the storage layer.

1. Clarify requirements and constraints

Ask about scale, consistency requirements, and failure scenarios. Confirm that 'exactly once' means the order is created once even with retries, and that cart state must be valid (e.g., items available, prices correct) at conversion.

2. Design idempotent checkout initiation

Generate a unique idempotency key (e.g., UUID) when the user initiates checkout. Store this key with the order attempt and use it to deduplicate requests. The client should send this key with every retry.

3. Validate cart state atomically

Within a transaction or using optimistic concurrency control, re-validate the cart: check inventory, prices, and promotions. If validation fails, abort and return an error; if it succeeds, proceed to order creation.

4. Create order with exactly-once semantics

Use a database transaction to insert the order with the idempotency key as a unique constraint. If a duplicate key error occurs, fetch and return the existing order. This ensures exactly-once creation even with concurrent requests.

5. Handle failures and compensating actions

If order creation succeeds but downstream steps (e.g., payment) fail, use a saga pattern to compensate (e.g., cancel order, release inventory). Ensure the cart is not cleared until the order is confirmed.

Key Points to Mention

  • Idempotency keys and deduplication to achieve exactly-once order creation
  • Database unique constraints or conditional writes for atomicity
  • Optimistic concurrency control (e.g., versioning) for cart state validation
  • Saga pattern or two-phase commit for distributed transactions across services
  • Handling retries and timeouts gracefully without double-charging or double-ordering
  • Trade-offs between consistency, availability, and latency (e.g., CAP theorem)

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.