One of the core decisions we must make as web developers, that affects how our application architecture is where to implement UI logic and rendering in our application.
The various rendering techniques used today for building web apps include static & server rendering, client-side rendering, prerendering and rehydration.
In a traditional web application, the majority of the UI rendering logic would exist on the server. Static and Server Rendering involves generating the HTML for each URL of your page. The difference is that the HTML for static rendering is generated once at the time of creation, while server rendering dynamically generates the HTML on-demand as the client makes a request.
As browser applications become more interactive and complex, view logic is pushed to the front-end, this way it is able to render a complete-looking page on the client side.
Today to create very fast web apps, most devs result in building single-page applications (SPA), where the server returns a single HTML page containing a JS file which then handles the entire UI rendering logic on the client-side, including routing to new pages.
But there are challenges with the SPA model, the popular ones are SEO and speed of initial load. To solve this, the Prerendering technique which runs the SPA at build time to capture its initial states as HTML is used.
In other cases, we may need to combine client-side and server rendering using the rehydration technique and this combination is often referred to as SSR or Universal Rendering. The rehydration technique can also be split into various kinds.
As Laravel artisans we use the PHP language, PHP is one of the language choices for building traditional web applications in which application logic and UI rendering logic reside in a server-side application, by default PHP uses the server rendering technique.
For this talk, we want to look at how we can accomplish the various rendering techniques in developing a Laravel PHP application using tools like Vue, React, Inertia, Livewire e.t.c and also discuss their benefits, bottlenecks and tradeoffs, which will help us to decide the best way to architecture our apps.