Design product catalog service
InstacartSoftware Engineer · OnsiteLast updated
This interview question evaluates requirements, scale assumptions, API/data design, architecture, trade-offs, failure modes, and rollout in a realistic interview setting. A strong answer for Design product catalog service states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.
Question
Design a product catalog service for a large e-commerce / grocery platform. The catalog must support a hierarchical category tree implemented with a self-referential (self-join) categories table, products that can belong to multiple categories, and product variants/SKUs with flexible attributes. Walk through the full design, covering each of the following:
-
High-level APIs. Define the read/write endpoints: product CRUD; category CRUD with hierarchy operations (
createCategory,moveCategory,listChildren,getBreadcrumbs); variant/SKU CRUD; product-to-category assignment; browse products within a category (with the option to include descendants); attribute/facet search and filter; product detail fetch; and asynchronous bulk import with job tracking. Show example request/response payloads, pagination, and filtering. -
Relational schema (with the category self-join). Specify tables, key fields, constraints, and indexes: a
categoriestable that self-references viaparent_id(plusname,slug/path,sort_order,depth); aproductstable; aproduct_categoriesmany-to-many join;product_variants(size/color, price); and a flexible attribute model (JSONB or EAV) for filterable attributes. Discuss the indexes required for fast tree traversal and product listing. -
Subtree query strategies and trade-offs. Explain how to efficiently query a full category subtree and breadcrumbs: adjacency list with recursive CTEs vs. materialized path (e.g., Postgres
ltree) vs. closure tables (and why nested sets are usually avoided). Discuss the read/write trade-offs and when to pick each. -
Caching, consistency, and the search index. Cover object/CDN/search caching with versioned keys and invalidation; the consistency model (transactional writes in the DB, eventual consistency for caches and the denormalized search index kept in sync via outbox/CDC); optimistic locking and idempotency.
-
Scaling. Show how the design scales to ~10M products at ~1k QPS reads (read-heavy): read replicas and multi-region reads, partitioning, denormalization of hot attributes, bulk-import write patterns, and pagination (keyset, not OFFSET).
-
Data integrity, versioning, and rollout. Cover cycle prevention, referential constraints, API versioning, and a zero-downtime (expand/contract) plan for schema changes.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.