So, given that, how does a PHP framework like Laravel fit into this new model? I believe Laravel has evolved quite nicely to compete in this new space. It has many features that enable developers to quickly build API backends plus it even ships with all the frontend build tools modern applications require, like webpack and your choice of either Vue or React. In short, Laravel is a very nice choice for building SPAs.
So what's the problem? The problem that I keep running into is that at times I'm forced to make a binary choice: either I build a completely server rendered application (e.g. use Laravel and it's templating language, Blade) and sacrifice the performance and responsiveness you get from a SPA, or I build a completely client-side rendered application (e.g. use VueJS and only use Laravel for the API) and sacrifice some of the SEO benefits you get from a fully server rendered app. I don't want to spend too much time talking about the various trade-offs between the two choices because to be fair it can be a bit subjective. I only mention this to point out the binary nature of the choices we have.
I need a single template language that can be rendered on the server and the client. A framework for rendering the initial UI on the server, one that lets the client take over the user experience from there.
I believe this is why NuxtJS exists. Yes, it provides these tools for building apps that let you render HTML on the server or in a SPA, or even pre-rendered, but it's very clear to me why it exists.
In my next post I will walk you through some practical examples of how I'm using it in my OneHourUp project.