Debugging Real-World Production Nightmares
Production bugs don't announce themselves politely. In this series, we confront ten nightmare scenarios using NightmareMart, an intentionally broken e-commerce app, demonstrating how to debug calmly and methodically when everything is on fire.
Progress
Series Info
- Episodes
- 10
- Run Time
- 1h 49m
- Difficulty
- Advanced
- Last Updated
- Feb 11, 2026
- Version
- Latest
Series Episodes
- Episodes (10)
The "Works on My Machine" Disaster
Checkout throws 500 errors in production but works perfectly locally. We'll trace the issue to improperenv()usage with config caching and learn why environment differences kill deployments.Death By N+1 Queries
The admin orders page gets slower until it times out. We'll use Debugbar to expose hidden N+1 queries in Blade templates and fix them with strategic eager loading.The Authorization Hole Nobody Noticed
A regular user triggers an admin-only refund and money disappears. We'll audit routes, discover missing middleware, and implement proper policy checks.Atomic or Die (Or At Least Oversell)
Two customers buy the last item... and both orders succeeded. We'll reproduce the race condition with concurrent requests and fix it with database locks and atomic operations.The Case of the Phantom Cart
Users occasionally see someone else's cart totals. We'll trace the bug to unscoped cache keys and learn when personalized data should never be cached.The Memory Leak That Killed the Worker
Receipt generation works for 50 orders, then the worker crashes. We'll profile memory growth, identify Eloquent accumulation in loops, and implement chunking with proper cleanup.The Timezone Nightmare
International customers report orders showing wrong dates: "I ordered yesterday but it says tomorrow." We'll untangle mixed timezone assumptions and establish the "store UTC, display local" principle.The Log File Massacre
The site returns 500 errors because the disk is full—laravel.log is 47GB. We'll identify runaway debug logging, implement rotation, and establish safe logging practices.One Search Query. Say Goodnight.
We watched a simple search likeWHERE name LIKE '%query%'turn into a full table scan and lock the database, so we need to tighten up how we handle searches. We'll reject tiny queries, add alimitandpaginate()to cap what we pull and then speed things up withCache::remember()using a key that includes the search andrequest()->input('page').The Silent Money Bug (From Mars)
Order totals don't match line items. We'll expose rounding errors, and rebuild calculations consistently using a custom "value type" object.
