System Design Guide
Fundamentals of Software System Design with End-to-End
Examples
Page 1 – Introduction to System Design
What is System Design?
System design is the process of defining the architecture, components,
interfaces, data models, and infrastructure required to build scalable,
reliable, secure, and maintainable software systems.
Large technology companies such as Google, Meta, Apple, Amazon,
Netflix, Microsoft, and Stripe use system design to ensure their platforms
can support millions or even billions of users while maintaining high
performance and availability.
System design is typically divided into:
High-Level Design (HLD)
Low-Level Design (LLD)
High-Level Design (HLD)
High-Level Design focuses on the overall architecture.
It answers questions such as:
What services exist?
How do they communicate?
Which databases should be used?
What cloud platform will host them?
How is traffic routed?
How is scalability achieved?
Example
Users
Load Balancer
│
API Gateway
┌────────────┼─────────────┐
│ │ │
Authentication Profile Payment
│ │ │
└────────────┼─────────────┘
Databases
Low-Level Design (LLD)
LLD focuses on implementation.
Examples include:
Class diagrams
Database schema
REST APIs
Design patterns
Object relationships
Error handling
Goals of Good System Design
A well-designed system should provide:
Scalability
Reliability
Availability
Performance
Security
Fault tolerance
Maintainability
Observability
Cost optimisation
Functional Requirements
Functional requirements define what the system must do.
Examples:
User login
Upload files
Search products
Send notifications
Process payments
Non-Functional Requirements
Non-functional requirements define how well the system performs.
Examples
99.99% uptime
200 ms API response
Support 50 million users
Encrypt data
Recover from failures within 15 minutes
Page 2 – Core Components of Modern Systems
Client Layer
Examples
Web Browser
Android App
iPhone App
Smart TV
IoT Device
API Gateway
Acts as the entry point for all requests.
Responsibilities:
Authentication
Rate limiting
Routing
Logging
Request validation
Popular technologies:
Kong
NGINX
AWS API Gateway
Apigee
Load Balancer
Distributes traffic across servers.
Algorithms:
Round Robin
Least Connections
IP Hash
Weighted Routing
Benefits:
High Availability
Fault Tolerance
Horizontal Scaling
Microservices
Instead of one large application, functionality is split into independent
services.
Example:
User Service
Profile Service
Notification Service
Payment Service
Recommendation Service
Search Service
Advantages:
Independent deployments
Better scalability
Easier maintenance
Technology flexibility
Databases
SQL Databases
Examples:
PostgreSQL
MySQL
SQL Server
Best for:
Financial systems
Transactions
Banking
Orders
NoSQL
Examples:
Cassandra
DynamoDB
MongoDB
Best for:
Large-scale applications
High throughput
Flexible schema
Cache
Examples
Redis
Memcached
Purpose
Reduce database calls.
Example
Instead of reading a user profile from the database every time,
Application
Redis
Database (only if cache miss)
CDN
Content Delivery Network
Examples
CloudFront
Cloudflare
Fastly
Purpose
Deliver images and videos from locations closest to users.
Page 3 – Scalability & Reliability
Horizontal Scaling
Server 1
Server 2
Server 3
Server 4
Traffic is distributed across all servers.
Advantages
Easy expansion
Better fault tolerance
Vertical Scaling
Increase:
CPU
RAM
Storage
Simple but limited by hardware.
Database Replication
Primary Database
────────┼────────
│ │
Replica 1 Replica 2
Benefits
Faster reads
Disaster recovery
High availability
Database Sharding
Instead of one massive database:
Shard A
Shard B
Shard C
Each shard stores part of the data.
CAP Theorem
A distributed database cannot simultaneously guarantee all three:
Consistency
Availability
Partition Tolerance
Most systems choose two.
Event-Driven Architecture
Instead of synchronous calls:
Order Created
Kafka
Inventory
Payment
Notification
Benefits
Loose coupling
Better scalability
Retry capability
Message Queues
Examples
Kafka
RabbitMQ
Google Pub/Sub
Amazon SQS
Used for:
Notifications
Emails
Payments
Analytics
Event processing
Monitoring
Tools
Prometheus
Grafana
Datadog
CloudWatch
Logs
Metrics
Tracing
Alerts
Page 4 – Example 1: URL Shortener (TinyURL)
Requirements
Functional
Shorten URLs
Redirect users
Generate unique IDs
Non-functional
Low latency
High availability
Billions of URLs
Architecture
Users
Load Balancer
API Gateway
URL Service
Redis Cache
Database
Database
ShortURL
LongURL
CreatedDate
ExpiryDate
Flow
1. User submits long URL.
2. Service generates unique ID.
3. Database stores mapping.
4. Short URL returned.
5. User accesses short URL.
6. Cache checked first.
7. Redirect to original URL.
Scaling
Redis cache
CDN
Database replication
Sharding
Multiple application servers
Page 5 – Example 2: WhatsApp Chat System
Requirements
Functional
Send messages
Read receipts
Online status
Group chat
Non-functional
Low latency
High availability
Millions of concurrent users
Architecture
Users
Gateway
Chat Service
Kafka
Notification Service
Databases
Flow
User A sends message
↓
Gateway
Chat Service
Kafka
Store Message
Push Notification
User B
Storage
Recent messages
Redis
Historical messages
Cassandra
Media
Object Storage
Reliability
Retry queues
Acknowledgements
Message persistence
Duplicate detection
Offline delivery
Page 6 – Example 3: Dating App (Bumble/Tinder)
Functional Requirements
User registration
Profiles
Swipe left/right
Matching
Chat
Notifications
Recommendations
High-Level Architecture
Mobile Apps
Load Balancer
API Gateway
┌─────────────┬──────────────┬─────────────┐
│ │ │ │
Auth Profile Swipe Service Chat Service
│ │ │ │
└─────────────┼──────────────┴─────────────┘
Match Service
Event Bus (Kafka/Pub/Sub)
┌─────────────┼──────────────┐
│ │ │
Notification Recommendation Analytics
│
Databases & Cache
Swipe Flow
User A swipes right on User B.
Swipe Service records the action.
If User B has not yet swiped, the system stores the event and returns
immediately.
When User B later swipes right on User A, the Match Service detects the
mutual match.
A match record is created.
An event is published to the event bus.
Notification Service sends push notifications to both users.
Chat Service creates a new conversation.
Database Design
Users
UserID
Name
Age
Preferences
Swipes
SwipeID
UserID
TargetUserID
Direction
Timestamp
Matches
MatchID
UserA
UserB
CreatedDate
Performance Optimisations
Redis caches frequently accessed profiles.
Geo-partitioning keeps nearby users together for faster queries.
Event-driven messaging decouples services and improves resilience.
Database replication supports high read traffic.
Horizontal scaling allows independent growth of services.
Load balancers distribute traffic across multiple instances.
Security
OAuth 2.0 or OpenID Connect for authentication.
TLS encryption for data in transit.
Encryption at rest for databases.
Rate limiting to reduce abuse.
API authentication and authorisation.
Audit logging and monitoring.
GDPR-compliant handling of personal data.
Key Design Trade-offs
Decision Benefit Trade-off
Independent scaling and Increased operational
Microservices
deployment complexity
Cache invalidation
Redis Cache Low-latency reads
challenges
Event Bus Loose coupling and resilience Eventual consistency
Strong transactional
SQL Database Harder to scale horizontally
consistency
NoSQL High throughput and Weaker consistency
Database scalability guarantees
Conclusion
Successful system design is about balancing business requirements with
technical constraints. Start by defining clear functional and non-functional
requirements, then select an architecture that meets scalability, reliability,
performance, security, and maintainability goals. The example systems—a
URL shortener, a chat platform, and a dating application—illustrate how
common design patterns such as microservices, caching, load balancing,
event-driven messaging, and distributed databases can be combined to
build robust, production-ready systems capable of serving millions of
users.