EasyStarter

Recipe Sharing App

DatabasesAPI DesignSearchStorage

Problem Statement

ChefBook is building a recipe sharing app where home cooks can:

- Post recipes - add title, description, ingredients list, step-by-step instructions with photos, cooking time, servings, and dietary tags (vegan, gluten-free, etc.).Search & filter - search recipes by name, ingredient ("recipes with chicken and broccoli"), cooking time, dietary restrictions, and cuisine type.Meal planner - drag recipes into a weekly calendar. Auto-generate a consolidated grocery list from the week's recipes.Save & rate - bookmark favorite recipes, rate them (1-5 stars), and leave reviews.Social - follow other cooks, see a feed of new recipes from people you follow.

Targeting 50,000 users with 20,000 recipes and 10,000 DAU.

What You'll Learn

Design a recipe sharing platform with ingredient search, meal planning, and grocery lists. Build this architecture under realistic production constraints, then validate tradeoffs in the design lab simulation.

DatabasesAPI DesignSearchStorage

Constraints

Registered users~50,000
Daily active users~10,000
Total recipes~20,000
Search latency< 300 ms
Images per recipe5-10
Availability target99.5%
ApproachClick to expand

Interview-Ready Approach

1) Clarify Scope and SLOs

  • Problem statement: Design a recipe sharing platform with ingredient search, meal planning, and grocery lists.
  • Design for a peak load target around 100 RPS (including burst headroom).
  • Registered users: ~50,000
  • Daily active users: ~10,000
  • Total recipes: ~20,000
  • Search latency: < 300 ms
  • Images per recipe: 5-10

2) Capacity Planning Method

  • Convert traffic and growth constraints into request rate, storage growth, and concurrency budgets.
  • Keep at least 2-3x safety margin per tier (ingress, compute, storage, async workers).
  • Reserve explicit latency budgets per hop so p95 can be defended in review.

3) Architecture Decisions

  • Databases: Define a clear system-of-record and design read/write paths separately before adding optimizations.
  • API Design: Standardize API boundaries, idempotency keys, pagination, and error contracts first.
  • Search: Use primary store for writes and async index updates for search relevance + scale.
  • Storage: Use object storage for large blobs and keep metadata/authorization separate in the API tier.

4) Reliability and Failure Strategy

  • Use strong write constraints (transactions or conditional writes) and explicit backup/restore strategy.
  • Apply strict input validation and backward-compatible versioning.
  • Track indexing lag and support reindex from source of truth.
  • Enforce lifecycle policies, retention tiers, and checksum validation.

5) Validation Plan

  • Run one peak-load test, one dependency-degradation test, and one failover test.
  • Verify idempotency for all retried writes and async consumers.
  • Track user-facing SLOs first: p95 latency, error rate, and successful throughput.

6) Trade-offs to Call Out in Interviews

  • Databases: SQL gives stronger transactional guarantees; NoSQL often gives better write scaling and flexibility.
  • API Design: Rich APIs improve developer speed but can create long-term compatibility burden.
  • Search: Search index gives rich querying but introduces eventual consistency and index ops overhead.
  • Storage: Object storage is cheap and durable, but random low-latency reads are weaker than databases/caches.

Practical Notes

  • Ingredient-based search requires an inverted index of ingredient → recipe_ids. PostgreSQL full-text search or a simple tag-based filter works at this scale.
  • Grocery list generation: aggregate all ingredients from selected recipes, merge duplicates by ingredient name, and sum quantities.
  • Store recipe images in S3 with a CDN; generate thumbnails on upload for listing views.

Learn the Concept

Practice Next

Reference SolutionClick to reveal

Why This Solution Works

Request path: The solution keeps ingress, service logic, and stateful dependencies separated so each layer can scale independently.

Reference flow: Web Clients -> API Gateway -> API Service -> Primary SQL DB -> Object Storage -> Search Index

Design strengths

  • The architecture keeps synchronous paths short and isolates stateful dependencies behind clear boundaries.

Interview defense

  • This design makes bottlenecks explicit (ingress, core compute, persistence, async workers).
  • It supports progressive scaling without re-architecting the core request path.
  • It keeps correctness-sensitive state changes in durable systems while offloading background work asynchronously.