'SSR rendering Vue with Laravel

I have developed a Vue app and a Laravel app and connected them with Vuex,VueRouter and the API endpoints, now I want to implement SSR. So far I have found 2 methods for implementing SSR:

  • use PhpV8js and Render Vue SSR in Laravel blade
  • use 2 separate processes: Laravel (php-fpm) and VueSSR (node)
    1. accept the request in Laravel and render session dependent data like user info, queries on repositories in json
    2. pass session json to node proccess (with socket or http)
    3. node process renders Vue app with session data and passes it back to laravel
    4. laravel renders the SSR blade with rendered Vue app

my concerns for first the method is: I don't like using PhpV8js in production environment with lots of traffic and a Vue component heavy app!

for second one: I don't know if passing html pages back and forth between socket apps is a good idea.

for a production environment which of these do you prefer? which will be the most performant? and are there other ways to accomplish Vue+Laravel SSR?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source