Build a Large-Scale Question Library for Live Technical Interviews
System DesignModel answerLast updated
Design a platform where teams write, tag, version, search and rank interview questions, and where interviewers pick from a shortlist during a live session without leaking or repeating questions.
Problem
Your organization wants a shared library of interview questions that many teams can use at the same time. Design the backend and supporting systems for it.
Capabilities required
- Authoring and review: writers create and edit questions, including rubrics, hints and follow-ups. Reviewers approve them.
- Organization: questions carry tags (topic, level, type), and a difficulty rating that improves over time based on real results.
- Discovery: full-text and filtered search.
- Live selection: during an interview, the interviewer opens a session, sees a short ranked list of candidate questions, picks one, and that choice is locked in for that candidate.
- History: published content can change over time, but past sessions and scores must remain interpretable.
- Offline editing: authors can edit without a connection and sync later.
What your design should cover
- Assumptions about users, data volume, traffic and latency targets.
- API endpoints.
- Data models and indexing strategy.
- Ranking and recommendation of the shortlist.
- Multi-region deployment, caching, and where you choose consistency versus availability.
- Roles and permissions, abuse and leak prevention, and rate limits.
- Monitoring, alerting and cost.
- Failure modes and how you would roll the system out.
State your assumptions explicitly and justify the trade-offs you make.
Hints
Hint 1
Do the sizing first. Count questions, versions and bytes, and compare reads to writes. If the corpus is small, the interesting problems are not storage.
Hint 2
Separate the data that must be strongly consistent (a candidate never sees the same question twice, two interviewers never pick the same slot item) from the data that can lag (search index, difficulty stats, recommendations).
Hint 3
Treat leaked questions as a core requirement: show summaries before selection, reveal the full body only after, audit every full view, and watch for sudden jumps in solve rate.
Hint 4
Make published versions immutable and have sessions and feedback point at a version id, so recalibration and edits never rewrite history.
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
1. Clarify and size
Actors: authors, reviewers, interviewers, admins, and optionally candidates in a practice mode.
Assumptions (stated up front):
- 500K questions, about 5 versions each, about 20 KB per version. That is roughly 2.5M versions and about 50 GB. Small.
- 50K interviewers, 10K concurrent live sessions at peak, reads outnumbering writes around 1000:1.
- Targets: menu p99 < 200 ms, search p99 < 300 ms.
- A leaked question is a burned question, so leak control is a first-class requirement.
Key framing: storage is easy. The hard parts are leak and abuse control, calibration quality, and correctness of live session state.
2. API
POST /questions create draft
PUT /questions/{id}/drafts save draft (If-Match: base_version)
POST /questions/{id}/versions publish draft -> immutable version
GET /questions/{id}?version=n fetch, redacted by role
GET /search?q=&tags=&level=&diff=&cursor=
POST /sessions {candidate_id, role, level, slots}
GET /sessions/{id}/menu?slot=k ranked shortlist, titles and summaries only
POST /sessions/{id}/selections {slot, question_version_id} + idempotency key
POST /sessions/{id}/feedback {qv_id, solved, hints_used, time, score}
POST /sync {client_id, ops[], since_cursor}
All mutations carry idempotency keys. The menu returns summaries only; the full body is released after selection, which shrinks the leak surface.
3. Data model
- Question: id, owner team, status (draft, review, active, retired), current version, ACL policy.
- QuestionVersion (immutable): id, question id, number, body, rubric, hints, tags, author, content hash.
- Tag: hierarchical taxonomy.
- Calibration: version id, difficulty mean and variance, discrimination, observation count, exposure count, last used.
- Session: candidate, interviewers, slots, selections, state.
- CandidateExposure: unique on (candidate, question). Hard rule: never repeat.
- AuditLog: append-only record of every full-body view.
System of record: a relational store (Postgres, or a distributed SQL database such as Spanner or CockroachDB if multi-region writes are needed). Large assets go to object storage keyed by content hash.
4. Architecture
Clients go through a CDN/WAF and an API gateway (authentication, rate limiting) to separate services: authoring, session, search, ranking and sync. Change data capture from the database feeds Kafka, which drives the search indexer, calibration jobs and the analytics/audit warehouse.
5. Deep dives
Search. Index only the active version of each question in OpenSearch: BM25 on title and summary, keyword facets for tags, level and type, a numeric difficulty field, and an embedding for "similar questions". Apply permissions inside the query with a visible_to_groups filter. Post-filtering breaks pagination and leaks result counts. Index lag of a few seconds is fine. Use alias swaps for reindexing. The corpus fits a single cluster per region, so size for QPS.
Menu ranking. Two stages.
- Candidate generation: matching tags for role and level, active status, interviewer has access, not in the candidate's exposure set, not already chosen in another slot.
- Scoring: a weighted sum of difficulty fit to the target, discrimination, freshness, diversity, minus exposure rate and leak risk. Re-rank with MMR so the 5 to 8 shown items span subtopics.
Start with heuristic weights; move to a learned model only once outcome data exists. Exposure penalties both spread usage and limit leakage.
Difficulty calibration. Author-assigned difficulty is only a prior. A nightly batch fits a 2PL item response model, estimating difficulty and discrimination while controlling for candidate ability. Flag low-discrimination questions. A sudden jump in solve rate is a leak signal and triggers retirement review.
Versioning and offline editing. Published versions are immutable, and sessions and feedback reference a version id. Drafts use optimistic concurrency. Offline clients keep an operation log in IndexedDB and post it to /sync. Structured fields merge per field (last writer wins with a logical clock). Rich-text bodies use a CRDT such as Yjs, or a three-way merge that surfaces conflicts to the author. Do not cache other people's active questions offline; that is a leak vector.
Consistency vs availability.
- Strong: selections and candidate exposure. Enforce unique constraints on (session, question) and (candidate, question) in a strongly consistent store, or pin each session to a home region.
- Eventual: search index, calibration stats, recommendations, analytics. If ranking is down, fall back to a cached static menu.
Multi-region and caching. Serve reads from every region. Home writes by team or session. Cache the redacted menu data and tag metadata in Redis and at the CDN edge; never cache full bodies for broad audiences. Invalidate by version id, which makes cache keys naturally immutable.
6. Security and abuse
- Role-based access: author, reviewer, interviewer, admin, with team scoping.
- Redact by role; full body only for the interviewer of an active selected slot.
- Rate limit per user and per token on search and fetch; alert on scraping patterns (bulk sequential reads, many distinct questions in a short window).
- Watermark rendered bodies per viewer to trace leaks.
- Audit every full view.
7. Monitoring and cost
Track menu and search latency, index lag, CDC lag, selection conflict rate, cache hit ratio, exposure-constraint violations (should be zero), and leak-signal alerts. Cost is dominated by the search cluster and multi-region database replication, not storage. Use autoscaling on QPS and keep embeddings modest in dimension.
8. Failure modes and rollout
- Search down: serve browse by tag from cache.
- Ranking down: static cached menu.
- Region loss: fail session homes over, accepting a brief write pause for those sessions.
- Sync conflicts: never silently drop; surface them.
Roll out to one team first, shadow the ranker against manual picks, then ramp by team, validating that exposure violations stay at zero and latency targets hold.
Common mistakes
- Over-engineering storage for a 50 GB dataset.
- Making everything strongly consistent, or everything eventual.
- Post-filtering search results for permissions.
- Mutating published questions in place, which corrupts historical scores.
- Ignoring leaks as a product requirement.