HLD-133·Caching & Consistency
Easy · 500 ptsPasswordless Magic-Link Login & Single-Use Token Verifier
Design a Slack / Notion-style passwordless sign-in service that issues hashed 15-minute magic-link tokens, dispatches transactional login emails asynchronously, and atomically redeems links on click.
Max p99
≤ 36 ms
Availability
≥ 99.5%
Budget
≤ $2,900
Functional Requirements
- FR-1POST /auth/magic-link/send — Generates cryptographic token hash, enforces per-email rate limits, and enqueues outbound email delivery.
- FR-2POST /auth/magic-link/verify/{token_hash} — Atomically marks unexpired token consumed and mints an authenticated user session.
- FR-3DELETE /auth/magic-link/pending/{email_hash} — Invalidates older unclicked links when a user requests a fresh login link.
- FR-4Must guarantee one-time link redemption without blocking user HTTP requests on third-party SMTP latency.
Workload Profile
Normal Sign-In Flow14,000 Session/Status Read RPS / 2,400 Link Issue & Verify Write RPS
Newsletter Campaign Click Surge42,000 Read RPS / 6,800 Write RPS
Active Working Set6 GB live 15-minute token hashes & per-email cooldown counters
Consistency GateRead-after-write token consumption + async email queue decoupling
Consistency Model
Read-after-write on token_hash consumption and session creation so email link scanners or double-clicks never mint duplicate sessions.
Relevant practice for
Solutions Locked
Sign in and either achieve AC or complete 3 official submissions on this question to inspect community diagrams and writeups.
Loading solutions...
Submission History (0)Select to replay
No submissions yet
Click Submit in the top bar to evaluate against all 7 judge cases and save each run here.
Click an item in Inventory above, or press B to add a component, double-click to name, C to connect.
Design Write-up
Write under ### Architecture for Diagram to take that up directly
Compulsory section · if not written yet, Diagram reads from the start of your write-up.
Architecture: required·FRs mentioned: 0/4·0 boxes · 0 edges
0 words