When we start to design a new app we should group the core functionality in logical components. These logical groupings are called layers. Layers help to differentiate between the different kinds of task performed by the components, making the reusability and maintenance of our code easier. Each logical layer contains a number of discrete component types grouped into sub-layers, with each sub-layer performing a specific type of task.
Having an application divided into separate layers, each one of them has distinct roles and functionality that help us with the following:
Maximizing maintainability of the code
Answering "Where should I create this file?" or "Where should I install this package?"
Optimizing the way that the application works when deployed in different ways and sharing most of the backend logic between platforms