Skip to content

Instantly share code, notes, and snippets.

@mmartinjoo
Created August 9, 2025 21:22
Show Gist options
  • Save mmartinjoo/1b653b2724ef7d1e0f68be9ffca000bb to your computer and use it in GitHub Desktop.
Save mmartinjoo/1b653b2724ef7d1e0f68be9ffca000bb to your computer and use it in GitHub Desktop.
System Design with Laravel - Table of Contents

Introduction

  • Phase 0 - The basics
  • Phase 1 - Workers
  • Phase 2 - Dedicated worker servers
  • Phase 3 - Scaling
  • Phase 4 - Load Balancers
  • Phase 5 - Object storage
  • Phase 6 - Caching
  • Phase 7 - CDN
  • Phase 8 - Database scaling

Planning different projects

  • Your own SaaS idea
  • New startups with VC funding
  • New startups without VC funding
  • Smaller apps for smaller companies

Designing an order management system

Features

  • Creating orders
  • Reports

Starting point

Estimating system requirements

  • Storing orders
  • Storing files
  • The minimum storage requirements

Workers

  • Estimating the required number of workers
  • Using docker
  • Multiple queues and priorities

Database design

  • Multiple columns
  • Hashing
  • Redundant columns
  • Pre-computing aggregates
  • Materialized views
  • Flatten many-to-many relationships
  • Partitioning

Materialized views and reports

  • Real-time updates
  • Using the view table
  • Testing the performance
  • Migrating existing data
  • Serving multiple reports

CQRS

Multiple services

  • Synchronous messaging
  • Asynchronous messaging

Specialized databases

  • Redis
  • ClickHouse

Common performance issues

Designing a subscription system

  • Products and features
  • Plans
  • Orders
  • Subscriptions
  • Subscription usage

Designing parts of Google Drive

Block-level file storage

  • Benefits
  • Technical challenges
  • Implementation

File synchronization

  • Event-Driven Architecture
  • Conflicts
  • Delta synchronization
  • Deduplication
  • Batch processing
  • Caching

Redis is not just a cache

  • Lists
  • Sets
  • Sorted sets
  • Streams
  • Pub/Sub
  • HyperLogLogs
  • Other data structures

LRU caches

  • LRU cache with arrays
  • LRU cache with linked lists
  • LRU cache with Redis lists
  • LRU cache with Redis sorted sets
  • LRU cache in action

Database indexing

Theory

  • Arrays
  • Linked list
  • Binary tree
  • Binary search tree (BST)
  • Indexing in the early days
  • B-Tree
  • B+ Trees

Index access types

  • const
  • range
  • range (again)
  • index
  • ALL
  • Select *

Composite indexes

  • Cardinality

Database indexing in practice

  • Listing posts by status
  • Feed
  • Publishing posts
    • Avoiding memory problems
    • Avoiding spamming the database
    • Measuring performance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment