RETURN TO SYSTEM DESIGN VAULT (55)BLUEPRINT #35 // Medium
#35MediumCore Distributed Systems
Design a User Login and Authentication System for a Website
ASKED IN INTERVIEWS AT:GoogleVisaGusto
EXECUTIVE SUMMARY & PROBLEM STATEMENT
Design a secure, distributed authentication service supporting OAuth 2.0 / OIDC, JWT access tokens, refresh token rotation, MFA, and distributed session revocation.
SCALE ESTIMATION & TRAFFIC ENVELOPE
DAILY ACTIVE USERS / TPS50 Million active sessions, 5,000 token issuances/sec
READ / WRITE TRAFFIC RATIOHeavy stateless validation across internal services
5-YEAR STORAGE CAPACITYRelational user DB + Redis for active refresh token registry
FUNCTIONAL REQUIREMENTS
- [1]User signup, login with email/password and Social OAuth
- [2]Issue short-lived access tokens and secure HTTP-only refresh tokens
- [3]Multi-factor authentication (TOTP) and session revocation
NON-FUNCTIONAL REQUIREMENTS
- •Brute-force protection and credential stuffing defense
- •Stateless verification for microservices
- •Sub-10ms token verification
CORE ARCHITECTURAL COMPONENTS
Auth API Service
Password Hashing Module (Argon2id)
JWT Key Provider Service
Rate Limiting & Risk Engine
Redis Revocation List
DATA SCHEMA & PERSISTENCE
Users: id, email, password_hash, mfa_secret; Sessions: session_id, user_id, refresh_token_hash, expires_at
DISTRIBUTED TRADE-OFFS & FAILURE MODES
- ⟡Short-lived JWTs (15 min) allow fast stateless validation; revoked tokens are checked against a lightweight Redis blacklist.