I once wrote about implementing your own decoupled architecture for building large-scale apps, inspired by some of the work Nicolas Zakas did at Yahoo and I at AOL.
It included suggestions such as breaking down your app into small, highly-reusable components which were easier to maintain. These components would communicate (or react) to each each other by means of an event messaging bus or mediator. A permission model would ensure that components could only speak to parts of the system they were allowed to and facade patterns (abstraction APIs) let you switch out one utility library for another as needed.
A few years have passed since then and luckily standards-based web platform primitives started to appear to help with a similar set of problems. To say that this has been exciting to see evolve would be an under-statement.