FreshBite Architecture Evolution Timeline

Food Delivery App - Architecture Evolution Activity

Initial Scenario: FreshBite Food Delivery App

You're the CTO of FreshBite, a new food delivery startup. Your app connects customers with local restaurants for food delivery.

Starting Architecture (Monolithic)

100
Users
5
Restaurants
$200
Monthly Cost
1
Developer
Monolithic Architecture
Single Web Server
(All Services)
↓
MySQL Database
(Local)
↓
File Storage
(Local Disk)

Interactive Architecture Diagram Editor

Create your own architecture diagram by adding components and connecting them. Click components to add, drag to move, and connect components by clicking connection mode.

Components:

Initial Architecture Documentation

Architecture Diagram

Simple monolithic architecture with all components on a single server. Use the interactive diagram editor above to create and export your architecture diagram.

Component List

  • Single web server running all application logic
  • Local MySQL database on same server
  • File storage on local disk

Current Limitations

  • No scalability - single point of failure
  • Limited performance under load
  • No redundancy or backup systems
  • Security concerns with everything on one server

Stage 1: Startup

Current State: The initial scenario above

Task: Document the Current Architecture

Document the current architecture and identify what works and what doesn't. Use the interactive diagram editor to create your architecture documentation.

Key Considerations

  • What components are currently in place?
  • What are the strengths of this architecture?
  • What are the weaknesses and limitations?
  • What would break first under increased load?
  • What security concerns exist?

Create Your Architecture Diagram

Document the current monolithic architecture. Add components, connect them, and export as part of your deliverables.

Components:

Stage 1 Deliverables

1. Current Architecture Documentation

Architecture Type: Monolithic
Components:
  • Single web server (handles all requests, business logic, and routing)
  • MySQL database (stores all data: users, restaurants, orders)
  • Local file storage (stores images, documents)
Note: Export your interactive diagram above as part of this deliverable.

2. What Works

  • Simplicity: Easy to develop, deploy, and maintain with one developer
  • Low Cost: $200/month is affordable for a startup
  • Fast Development: No complex integrations or distributed systems
  • Single Deployment: One codebase, one deployment process
  • Adequate for Current Scale: Handles 100 users and 5 restaurants

3. What Doesn't Work / Limitations

  • Single Point of Failure: If server goes down, entire app is down
  • No Scalability: Cannot handle traffic spikes or growth
  • Performance Bottlenecks: Database and application compete for resources
  • No Redundancy: Data loss risk if server fails
  • Security Risks: All components on one server increases attack surface
  • Limited Monitoring: No visibility into system health
  • Deployment Risk: Any update requires full system restart
  • Resource Constraints: Cannot scale individual components independently

4. Risk Assessment

  • High Risk: Data loss, complete service outage
  • Medium Risk: Performance degradation, security breaches
  • Low Risk: Development velocity (acceptable for current team size)

Stage 2: Growing Company

10,000
Active Users
150
Restaurants (3 cities)
5
Developers
99.5%
Uptime Required
$2,000
Monthly Budget

New Challenges: Peak traffic causing slowdowns, need for reliability

Task: Redesign the Architecture

Consider: How do you handle increased load? Where are the bottlenecks? What new components do you need? How does security change? Use the diagram editor to design your new architecture.

Key Considerations

  • Load Handling: Need load balancers, multiple servers, caching
  • Bottlenecks: Database will be the main bottleneck - need read replicas or caching
  • New Components: Load balancer, CDN, caching layer, monitoring, backup systems
  • Security: Need firewalls, SSL/TLS, database encryption, access controls
  • Reliability: Need redundancy, failover mechanisms, automated backups

Design Your Scalable Architecture

Create a multi-tier architecture with horizontal scaling. Add load balancers, multiple servers, caching, and database replication.

Components:

Stage 2 Deliverables

1. Redesigned Architecture Diagram

Multi-tier architecture with horizontal scaling capabilities. Export your interactive diagram above.

2. Architecture Components

  • CDN: Distributes static assets (images, CSS, JS) globally to reduce server load
  • Load Balancer: Distributes incoming requests across multiple web servers
  • Web Servers (3+): Horizontal scaling - add more servers as needed
  • Redis Cache: Caches frequently accessed data (user sessions, restaurant menus, popular orders)
  • Database Primary: Handles all write operations
  • Database Replica: Handles read operations, reduces load on primary
  • Cloud Storage: Scalable object storage for images and files
  • Monitoring: Real-time system health and performance tracking

3. Load Handling Strategy

  • Horizontal Scaling: Add more web servers behind load balancer
  • Caching Layer: Redis reduces database queries by 60-80%
  • Read Replicas: Distribute read queries across multiple database instances
  • CDN: Offloads 70-90% of static asset requests
  • Auto-scaling: Automatically add servers during peak hours

4. Bottleneck Solutions

  • Database Bottleneck: Solved with read replicas and Redis caching
  • Server Capacity: Solved with load balancing and horizontal scaling
  • Static Asset Delivery: Solved with CDN
  • Session Management: Solved with Redis (shared across servers)

5. Security Enhancements

  • Network Security: Firewall rules, VPC isolation
  • Encryption: TLS/SSL for data in transit, encryption at rest for databases
  • Access Control: IAM roles, least privilege access
  • DDoS Protection: Cloud provider DDoS mitigation
  • Security Monitoring: Intrusion detection, log analysis
  • Backup & Recovery: Automated daily backups, point-in-time recovery

6. Cost Breakdown (Monthly)

  • Load Balancer: $20
  • 3 Web Servers: $450 ($150 each)
  • CDN: $100
  • Redis Cache: $150
  • Database Primary + Replica: $600
  • Cloud Storage: $80
  • Monitoring: $50
  • Backup Storage: $50
  • Network & Data Transfer: $500
  • Total: ~$2,000/month

7. Reliability Measures

  • 99.5% Uptime Target: Achieved through redundancy
  • Health Checks: Automatic failover if server fails
  • Database Replication: Automatic failover to replica if primary fails
  • Automated Backups: Daily backups with 30-day retention
  • Monitoring Alerts: Immediate notification of issues

Stage 3: Enterprise Scale

500,000
Active Users (Global)
5,000
Restaurants (20 countries)
50+
Developers (Multiple Teams)
99.9%
Uptime + DR Required
$50,000
Monthly Budget

New Requirements: Real-time order tracking, mobile app + web, compliance (PCI DSS, GDPR), disaster recovery

Task: Redesign for Enterprise Scale

Consider: How do you handle global scale? What about different teams working independently? How do you ensure security and compliance? What about disaster recovery? Design your microservices architecture using the diagram editor.

Key Considerations

  • Global Scale: Multi-region deployment, edge computing, geo-distributed databases
  • Team Independence: Microservices architecture, API-first design, service ownership
  • Security & Compliance: Zero-trust architecture, encryption everywhere, audit logs, compliance frameworks
  • Disaster Recovery: Multi-region failover, automated backups, RTO/RPO targets
  • Real-time Features: WebSockets, message queues, event streaming

Design Your Microservices Architecture

Create a distributed microservices architecture with API gateway, multiple services, message queues, and global distribution.

Components:

Stage 3 Deliverables

1. Microservices Architecture Diagram

Distributed microservices architecture with global reach and independent team ownership. Export your interactive diagram above.

2. Global Scale Strategy

  • Multi-Region Deployment: Deploy in 3+ regions (US-East, EU-West, Asia-Pacific)
  • Geo-Routing: Route users to nearest region for low latency
  • Edge Computing: CDN with edge functions for dynamic content
  • Database Sharding: Partition data by region/user for performance
  • Global Load Balancing: Distribute load across regions with health checks
  • Content Replication: Replicate critical data across regions for DR

3. Team Independence Architecture

  • Microservices: Each team owns complete service lifecycle
  • API Gateway: Centralized entry point with service discovery
  • Service Mesh: Handles service-to-service communication, security, monitoring
  • Independent Deployments: Teams deploy services independently without coordination
  • API Contracts: Well-defined interfaces enable parallel development
  • Container Orchestration: Kubernetes for service management and scaling
  • CI/CD Pipelines: Each service has its own pipeline

4. Microservices Breakdown

  • User Service: Authentication, user profiles, preferences
  • Order Service: Order creation, management, history
  • Restaurant Service: Restaurant data, menus, availability
  • Payment Service: Payment processing, PCI DSS compliant
  • Notification Service: Push notifications, emails, SMS
  • Tracking Service: Real-time order tracking with WebSockets
  • Recommendation Service: ML-based recommendations
  • Analytics Service: Business intelligence and reporting

5. Security & Compliance Framework

  • Zero-Trust Architecture: Every request authenticated and authorized
  • PCI DSS Compliance: Isolated payment service, encrypted card data, tokenization
  • GDPR Compliance: Data encryption, right to deletion, consent management, data residency
  • Encryption: TLS 1.3 everywhere, encryption at rest (AES-256)
  • Identity & Access: OAuth 2.0, JWT tokens, RBAC, MFA
  • Network Security: VPC isolation, security groups, WAF
  • Secrets Management: Centralized secrets store (AWS Secrets Manager, HashiCorp Vault)
  • Audit Logging: Comprehensive audit trails for compliance
  • Vulnerability Scanning: Automated security scanning in CI/CD
  • Penetration Testing: Regular third-party security audits

6. Disaster Recovery Plan

  • RTO (Recovery Time Objective): 15 minutes
  • RPO (Recovery Point Objective): 5 minutes
  • Multi-Region Active-Active: Services running in multiple regions simultaneously
  • Automated Failover: Health checks trigger automatic region failover
  • Database Replication: Real-time replication across regions
  • Backup Strategy: Hourly incremental, daily full backups, 90-day retention
  • Disaster Recovery Testing: Quarterly DR drills
  • Data Residency: GDPR-compliant data storage per region

7. Real-Time Features Architecture

  • WebSocket Service: Real-time order tracking updates
  • Message Queue: Apache Kafka for event streaming
  • Event-Driven Architecture: Services communicate via events
  • Push Notifications: Firebase/APNs for mobile push
  • Real-Time Analytics: Stream processing for live metrics

8. Observability & Monitoring

  • Metrics: Prometheus + Grafana for system metrics
  • Logging: Centralized logging (ELK stack or CloudWatch)
  • Tracing: Distributed tracing (Jaeger, Zipkin) for request flows
  • APM: Application Performance Monitoring
  • Alerting: PagerDuty integration for on-call
  • Dashboards: Real-time operational dashboards

9. Cost Breakdown (Monthly)

  • Multi-Region Infrastructure: $15,000
  • Kubernetes Clusters (3 regions): $6,000
  • Database Clusters (sharded, replicated): $8,000
  • CDN & Edge Computing: $3,000
  • Message Queue & Streaming: $2,000
  • Cache Clusters: $2,500
  • Object Storage (multi-region): $1,500
  • Monitoring & Observability: $2,000
  • Security Services (WAF, DDoS, etc.): $1,500
  • Backup & DR: $1,000
  • Network & Data Transfer: $7,500
  • Total: ~$50,000/month

Discussion Questions

For Each Stage Transition:

What drove the architectural changes?

  • Stage 1 β†’ 2: Business growth (100 to 10,000 users), performance issues, need for reliability
  • Stage 2 β†’ 3: Global expansion, team scaling (5 to 50+ developers), compliance requirements, real-time features

What new security challenges emerged?

  • Stage 1 β†’ 2: Increased attack surface with multiple servers, need for network security, encryption
  • Stage 2 β†’ 3: Microservices increase attack surface, compliance requirements (PCI DSS, GDPR), zero-trust needed

How did complexity change?

  • Stage 1: 3 components, single failure point, simple monitoring
  • Stage 2: 8+ components, multiple failure points, need for monitoring
  • Stage 3: 20+ services, distributed system complexity, comprehensive observability needed

What were the trade-offs?

  • Cost vs. Performance: Higher costs for better performance and reliability
  • Simplicity vs. Scalability: More complex architecture enables global scale
  • Development Speed vs. Reliability: More time on infrastructure, but better uptime

Cross-Stage Analysis:

What patterns do you see in architectural evolution?

  • Start simple (monolith), scale horizontally (load balancing), then decompose (microservices)
  • Progressive addition of redundancy and reliability measures
  • Increasing focus on observability and monitoring
  • Security becomes more critical and complex at each stage

How did the team's role change with each stage?

  • Stage 1: Full-stack developer, jack-of-all-trades
  • Stage 2: Specialized roles (backend, frontend, DevOps, DBA)
  • Stage 3: Team ownership of services, platform teams, SRE teams

What would happen if you tried to build Stage 3 architecture from day 1?

  • Over-engineering: Too complex for initial needs
  • High costs: $50k/month vs. $200/month
  • Slower development: Complex infrastructure slows feature development
  • Team overhead: Need large team to manage complexity
  • Premature optimization: Solving problems you don't have yet

How does cloud adoption typically fit into this evolution?

  • Stage 1: Simple cloud hosting (VPS, basic managed services)
  • Stage 2: Cloud-native services (managed databases, load balancers, CDN)
  • Stage 3: Full cloud-native architecture (Kubernetes, serverless, managed services)
  • Cloud enables each stage transition with managed services reducing operational overhead