Design a Game Distribution Platform with a Store, Library, and Downloads
System DesignModel answerLast updated
Design the core backend of a PC game platform: catalog browsing, purchasing, entitlement management, and large-file game delivery with delta updates.
Scenario
A PC gaming platform lets players browse a store, buy games, and download and play them through a desktop client. Developers publish new game builds and push updates. Your task is to design the backend systems that power this platform.
Assume the following core flows are in scope:
- Catalog and store: players browse and search games; each game page shows regional pricing and metadata.
- Purchase: a player buys a game; the game appears in their library only after payment succeeds.
- Library and launch check: the client lists games the player owns and verifies ownership before launching any title.
- Download and update: a player installs a game or receives a patch when a new build is released.
- Developer publishing: a developer uploads a new build and makes it available to players, with the ability to roll back.
Before you dive in, clarify scope with your interviewer
Good clarifying questions anchor the rest of your design:
- Are social features — friends, chat, activity feeds — in scope, or only store, library, and downloads?
- What scale should you assume: number of registered accounts, peak concurrent users, total titles, and typical game install size?
- Can players launch games while offline, and how strictly must ownership be re-verified at launch time?
- Are seasonal flash sales and day-one worldwide launches (the hardest traffic spikes) in scope?
- Does the publishing pipeline need staged rollouts or beta branches, or just a single production release per title?
- Are in-game item purchases, gifting, and refunds in scope, or only full-game transactions?
What your answer should address
A strong response covers all of the following:
- A clean requirements split before any architecture decisions
- A read-heavy catalog path optimized for caching and regional pricing
- A purchase and entitlement flow that grants ownership exactly once, even under failures
- Content delivery for large versioned builds: chunking, deduplication, delta patches, and CDN strategy
- A data model covering catalog entries, orders, entitlements, and build manifests
- Failure handling for payment provider outages, CDN issues, and interrupted downloads
- How the system behaves during peak load — a major game launch or a site-wide sale
Hints
Hint 1
The catalog is read-heavy and rarely changes; think about where caching and a CDN fit into the read path, and what cache invalidation looks like when a price changes for one region.
Hint 2
A purchase must create an entitlement exactly once even if the client retries or the payment webhook arrives twice. Walk through what happens when the payment succeeds but your database write fails, and how you recover.
Hint 3
Game builds can be 50–100 GB. Storing and transferring them as single blobs doesn't work. Think about how you'd chunk a build, deduplicate chunks across versions, and send only a delta patch when an update ships rather than the full file.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Strong Answer
1. Requirements and Assumptions
Start by nailing down scale before drawing any boxes.
Functional scope: catalog browsing with regional pricing, purchase with entitlement grant, library listing, ownership check at launch, game download and incremental update, developer build publishing with rollback.
Scale assumptions (confirm with interviewer):
- 100 M registered accounts, 8–10 M peak concurrent users
- ~50,000 titles in the catalog
- Typical game build: 20–80 GB; large titles up to 150 GB
- Peak write rate: a major launch or flash sale can spike purchases to 50,000–100,000 transactions per minute
- Build uploads: relatively rare but large; a developer ships a new build every few days per title
Non-functional: entitlement consistency (you can't lose a paid purchase), high availability on catalog and downloads, strong consistency on the purchase-to-entitlement write, tolerable eventual consistency on the library read.
2. High-Level Components
Player client
|
+-- Store API (read-heavy, cacheable)
| └── Catalog Service → Catalog DB (PostgreSQL)
| → CDN / cache layer
|
+-- Purchase API
| └── Order Service → Orders DB
| → Payment Provider (Stripe, etc.)
| → Entitlement Service → Entitlements DB
|
+-- Library API
| └── Entitlement Service (read path)
|
+-- Download API
└── Content Service → Object Storage (S3-compatible)
→ CDN edge nodes
A developer publishing tool talks to a Build Ingestion Service that writes chunks to object storage and updates the catalog with a new build manifest.
3. Catalog and Regional Pricing
The catalog is read-heavy, globally distributed, and rarely mutates. Lean into caching aggressively.
- Store game metadata (title, description, tags, media) in a relational DB. Pricing rows are keyed by
(game_id, region_code). - Serve catalog reads through a CDN with a TTL of a few minutes. A price update or a new release invalidates only the affected game's cache key, not the whole catalog.
- For search, a dedicated search index (Elasticsearch or a similar service) handles full-text queries and faceted filtering without hitting the primary DB.
Common mistake: routing all store traffic to the primary DB. Under a flash sale the store page views alone will overwhelm it; the store read path should almost never touch the DB directly.
4. Purchase and Entitlement — Exactly Once
This is the most consistency-sensitive flow. The steps are:
- Client calls
POST /orders→ Order Service creates an order record inPENDINGstate. - Order Service calls the payment provider. On success, it receives a charge confirmation.
- Order Service marks the order
PAIDand emits an event (or makes a synchronous call) to the Entitlement Service. - Entitlement Service inserts a row
(player_id, game_id, order_id)and returns success. - Order Service marks the order
FULFILLED.
Idempotency is critical. The payment webhook can fire more than once. Use the order_id as an idempotency key on both the payment call and the entitlement insert. A unique constraint on (player_id, game_id) at the DB level is a good backstop — duplicate entitlement grants fail safely.
Failure recovery: If the process crashes between steps 3 and 5, a background reconciliation job scans orders in PAID state older than a threshold and re-drives them to FULFILLED. This makes the flow eventually consistent without sacrificing the single-entitlement guarantee.
Ownership check at launch: The desktop client calls GET /entitlements/{player_id}/{game_id} before launching. For offline play, the client caches a signed entitlement token with a multi-day expiry; on reconnection it refreshes it.
5. Content Delivery — Large Files and Delta Updates
Shipping a 60 GB game as a single blob is impractical. Use chunked, content-addressed storage:
- Chunking: split each build into fixed-size chunks (~4–8 MB). Hash each chunk (SHA-256). Store chunks in object storage keyed by their hash.
- Manifest: a build manifest is a JSON document listing every file in the game, with each file represented as an ordered list of chunk hashes. The manifest itself is stored in object storage and referenced by a build version ID in the catalog DB.
- Delta updates: when a developer ships a new build, the ingestion service computes the diff between the new manifest and the previous one. Chunks already in object storage are not re-uploaded — the new manifest just references them by hash. The client downloads only the chunk hashes that appear in the new manifest but not the cached version.
- CDN distribution: the CDN caches chunks at edge nodes. Because chunks are immutable and content-addressed, cache invalidation is trivial — old chunks are never modified, new chunks get new hashes. TTL can be set to forever.
Handling a day-one launch spike: Pre-warm CDN edge caches by pushing popular title chunks to edge nodes before release time. Use a queuing layer (SQS or similar) in front of the chunk origin so a sudden burst of cache misses doesn't flood object storage directly.
6. Developer Publishing Pipeline
- Developer uploads a build via a multi-part upload to a staging bucket.
- Build Ingestion Service validates, chunks, deduplicates, and writes to the production content store.
- Ingestion commits the new manifest and bumps the build version in the catalog DB.
- A staged rollout flag controls what percentage of players receive the new build manifest. A rollback is just pointing the catalog record back at the previous build version ID — no data deletion needed.
7. Failure Modes and Operational Concerns
| Failure | Response |
|---|---|
| Payment provider down | Return a retriable error; order stays PENDING; no entitlement granted |
| Entitlement DB write fails after payment succeeds | Reconciliation job re-drives PAID orders; idempotency key prevents double-grant |
| CDN region outage | Client retries against another CDN PoP or falls back to origin with rate limiting |
| Interrupted download | Client resumes from the last incomplete chunk using the manifest as a checkpoint |
| Bad build deployed | Roll back by pointing the catalog to the previous manifest version |
Observability: track purchase funnel drop-off, entitlement grant latency, CDN hit rate per title, and chunk download error rate. Alert on order reconciliation backlog growing — that's a leading indicator of a payment-to-entitlement inconsistency.
Common Mistakes to Avoid
- Granting the entitlement inside the payment webhook handler without idempotency protection — leads to duplicate grants on webhook retry.
- Storing game files as single objects in blob storage — makes delta updates impossible and hammers origin on launches.
- Forgetting regional pricing in the data model and bolting it on later — pricing is a first-class entity, not an afterthought.
- Making the library read strongly consistent — it doesn't need to be; slight staleness is acceptable and lets you scale reads easily.