0%
System requirements
Functional
Capacity estimation
Traffic
Storage
API design
Submission APIs
Database design
Schema
Storage Engine Choices
High-level design
Two Planes of Traffic
Request flows
App Submission Flow
Detailed component design
Code Signing: The Trust Foundation
Tradeoffs
Caching Strategy: What to Cache and When to Invalidate
Failure scenarios
CDN Edge Failure During a Hot App Launch
Future improvements
Delta Updates
System requirements
Functional
Capacity estimation
Traffic
Storage
API design
Submission APIs
Database design
Schema
Storage Engine Choices
High-level design
Two Planes of Traffic
Request flows
App Submission Flow
Detailed component design
Code Signing: The Trust Foundation
Tradeoffs
Caching Strategy: What to Cache and When to Invalidate
Failure scenarios
CDN Edge Failure During a Hot App Launch
Future improvements
Delta Updates
A digital distribution platform connects app developers with users through a centralized marketplace. Think Apple App Store, Google Play, or Steam. The platform must handle the full lifecycle: developers submit apps, the platform reviews and publishes them, users discover and download them, and money flows between all parties.
POST /v1/apps
1{
2 "name": "Weather Pro",
3 "description": "Real-time weather forecasts...",
4 "category": "weather",
5 "priceCents": 0,
6 "screenshots": [
7 "url1",
8 "url2"
9 ],
10 "minOsVersion": "14.0",
11 "supportedDevices": [
12 "phone",
13 "tablet"
14 ]
15}| Table | Key Columns | Notes |
| apps | app_id (PK), developer_id (FK), name, description, category, status, price_cents, created_at | Core app metadata. Status: draft, in_review, published, suspended |
| app_versions | version_id (PK), app_id (FK), version_string, binary_s3_key, binary_size, sha256_checksum, code_signing_cert_id, rollout_percentage, status | Each upload creates a new version. S3 key points to the binary |
| developers | developer_id (PK), email, org_name, certificate_id, payout_account, status | Developer accounts with code signing certificates |
| purchases | purchase_id (PK), user_id (FK), app_id (FK), amount_cents, platform_fee_cents, idempotency_key (UNIQUE), status, created_at | ACID transactions for financial records |
| reviews | review_id, app_id, user_id, rating, title, body, app_version, created_at | Stored in MongoDB for flexible schema and high write throughput |
| users | user_id (PK), email, name, device_ids (JSONB), platform, created_at | User accounts. device_ids tracks registered devices for entitlement sync |
| entitlements | entitlement_id (PK), user_id (FK), app_id (FK), source_type, source_id, granted_at, revoked_at | Single source of truth for app access. source_type: purchase, bundle, subscription, promo_code |
| certificates | cert_id (PK), developer_id (FK), public_key, fingerprint, issued_at, expires_at, revoked | Code signing certificate registry |
The key architectural insight is that this system has two fundamentally different traffic planes that scale independently:
POST /v1/apps with metadata. API returns appId and a presigned S3 URL.Code signing is the mechanism that lets a user's device trust that an app binary is authentic and unmodified. It uses asymmetric cryptography: the developer signs the binary with their private key, and anyone with the developer's public certificate can verify the signature.
Not all data has the same staleness tolerance, and your caching strategy should reflect this: App binaries: cache forever. Binaries are immutable. Version 2.1.0 never changes. The CDN caches them with infinite TTL. When a new version is published, it gets a new S3 key and CDN path. No invalidation needed. App metadata: 5-minute TTL. App names, descriptions, and screenshots change occasionally. A 5-minute TTL means users see updates within minutes while the cache absorbs 95%+ of repeated reads. When a developer updates metadata, the Catalog Service publishes a Kafka event that triggers cache invalidation, so changes appear faster than the TTL for active listeners. Pricing and entitlements: event-driven invalidation. A stale price is not cosmetic. If a developer raises an app's price from $0.99 to $4.99 and the cache still shows $0.99, users buy at the old price and the developer loses revenue. Pricing changes trigger immediate cache invalidation via Kafka events, not TTL-based expiry. Entitlements (has the user purchased this app?) use a similar pattern: on purchase completion, the entitlement cache is immediately updated. Search results: 5-minute TTL, no event-driven invalidation. Search results are an aggregation across thousands of apps. Invalidating the search cache on every metadata change would defeat the purpose of caching. Instead, search results go stale for up to 5 minutes, which is acceptable because the catalog of 1M apps changes slowly relative to user queries.
Frame consistency as a business decision in interviews. Stale app ratings are cosmetic, a 4.2 showing as 4.1 for 5 minutes is invisible to users. Stale pricing is a revenue leak, a $0.99 price displayed for 5 minutes after a price increase means every purchase in that window loses revenue. This distinction drives the caching strategy.
A major game launches and downloads spike 10x. One CDN edge node serving the US East region fails under load (disk full, OOM, or hardware failure).
Instead of downloading the full 100 MB binary for every update, compute the binary diff between the old and new version and send only the changed bytes. Tools like bsdiff or Google's Courgette can achieve 90%+ size reduction for typical app updates where most code is unchanged.
At 2.5M downloads/day where 70% are updates (1.75M), reducing average update size from 100 MB to 10 MB saves 157.5 TB/day in CDN egress. At $0.05/GB, that is $7,875/day or roughly $2.9M/year in bandwidth savings alone. Users also benefit: faster updates, less data usage, and fewer interrupted downloads on cellular networks.
Delta updates save approximately 90% of update bandwidth. At this platform's scale, that translates to roughly $2.9M/year in CDN egress savings. This is one of the highest-ROI infrastructure investments in the entire system.
Reading a solution is not the same as producing one under interview pressure. Design it on the whiteboard and get scored feedback.
0%
System requirements
Functional
Capacity estimation
Traffic
Storage
API design
Submission APIs
Database design
Schema
Storage Engine Choices
High-level design
Two Planes of Traffic
Request flows
App Submission Flow
Detailed component design
Code Signing: The Trust Foundation
Tradeoffs
Caching Strategy: What to Cache and When to Invalidate
Failure scenarios
CDN Edge Failure During a Hot App Launch
Future improvements
Delta Updates
System requirements
Functional
Capacity estimation
Traffic
Storage
API design
Submission APIs
Database design
Schema
Storage Engine Choices
High-level design
Two Planes of Traffic
Request flows
App Submission Flow
Detailed component design
Code Signing: The Trust Foundation
Tradeoffs
Caching Strategy: What to Cache and When to Invalidate
Failure scenarios
CDN Edge Failure During a Hot App Launch
Future improvements
Delta Updates