
The One
Home Automation Re-architecture
Overview
A home automation system controlling lights, cameras, sensors, and access in a facility with hundreds of devices. It was slow, crashed often, and would start to collapse with more than 100 devices. The client wanted to expand to 1000+ devices but the system couldn't handle it.
I analyzed it thoroughly: the main problem was how they transferred data - continuous HTTP polling where each device asked for updates every second, even when nothing changed. With hundreds of devices, this meant thousands of requests per second that brought the server to its knees.
I re-architected the system piece by piece using WebSocket for real-time communication (devices receive notifications only when needed, they don't continuously ask), custom binary serialization to reduce traffic by 80%, and Redux Toolkit to manage state predictably. I developed custom parsers for proprietary IoT device protocols and implemented a health monitoring system with auto-recovery.
The system now uses hybrid architecture: local processing with Redis for speed (if internet goes down, the house still works) + cloud sync with MongoDB for backup and remote access. Firebase Cloud Messaging handles push notifications to users' smartphones when something important happens. I also solved a critical user identity synchronization problem between local and cloud using MongoDB ObjectId instead of separate UUIDs, ensuring total consistency.
Result: handles 1000+ devices with <50ms latency and 99.9% uptime.
Key Features
- Network load -80% eliminating HTTP polling with WebSocket push (notifications only when needed)
- 1000+ devices managed with <50ms latency: lights, sensors, cameras, access controls
- Uptime 99.9% with automatic health monitoring and fault auto-recovery
- Hybrid architecture: local Redis for speed + cloud MongoDB for backup and remote access