Heardable's legacy application was very much a working prototype however, it was not scalable and increasing the number of daily "Brand Scans" would send App and DB servers spiking out of control.
The core business logic was sound and desperately needed to be abstracted out. The first step was to refactor how modules were instantiated and the cleanup began with top-down approach, bringing down concurrent database connections to under 50 from a whopping 2k+ initially.
Then began the slow & tedious task of abstracting, testing and decoupling core business modules.
The PHP API servers were also moved out to Digital Ocean, cutting latency and saving over 2/3 thirds of the monthly infrastructure cost even after upscaling daily brands scans by 10X