Vue 3: How to create SSR + SPA functionality for a CMS engine? - vue.js

We have a CMS where we are trying to provide the support of VueJS framework to our client websites. The views and their logic will be coded from the CMS Panel itself. The problem comes when trying to render the website having the support for both SPA and SSR due to SEO.
When client requests for a page, the SSR should work during that time but once the page is rendered, the SPA should take the control and let the user navigate(vue-router) wihtout page reload as it works in Vue SPA.
I checked on with this question and it won't help due to my unique requirement. There are no static bundles available for my case.
Any help will be appreciated!
I have tried many examples to achive this however they aren't exactly helping for my case.
https://github.com/0x00000001A/vuejs-spa-ssr-vuex
https://github.com/shenron/vue3-example-ssr

You may need nuxtjs. It can help you spa+ssr on vue

Related

The Cost of Applying SSR on server - Laravel & Vue

I dont know is this a right place to ask this question, so i planned to make a blog website with SPA (Single Page Application) model using vuejs, we all know SPA websites are not SEO friendly and we need SSR or Prerendering to overcome this problem.
From some source on the internet i found out that apllying SSR to a Website make it consume more server resource and i need to upgrade my hosting plan if needed and it will affect to my website operating cost.
can you guys give me advice what should i do?
from your experience did ssr cost server resources that much?
should i make my website without javascript framework and using fully dynamic php page?

How to create a mutli page Vue.js app without Vue-Cli?

I created a Vue.js app without using Vue CLI, so that means I did everything from scratch including setting up Webpack 4. The reason I did this was because I don't like the idea of frameworks concealing the inner workings of things so that I can't fix things myself.
As an SPA, I have got the basic demo site working with an Home and About view. But I am looking to create a multi-page app with Express. The only information on multi-page Vue.js apps seems to be linked to the pages option that only comes with Vue CLI (see here)
Is there a way to have a multi-page app for projects created without Vue CLI?
Sure, you could handle routing with Express and have the page rendered server-side.
You can use Vue official package for routing, vue-router and choose between SSR (server-side rendering) or client side.
I suggest you to check this official doc about it: https://ssr.vuejs.org/

How to manage VUE routing builiding a MPA webpage?

I'm new using Vue.js. I'm trying to build the frond-end design for a large system for a company. In this system the users have an account where they can access multiple pages to administrate their accounts, interactuate with other accounts, make appoinments, administrate or delete other users, etc. I think that since is a big system, I should use a MPA aproach, because I've read that SPA should not be used for webpages as blogs or online shops because those webpages that are constantly getting updated (as this system will be).
My question is: I can't find a propper guide to configure MPA on vue, is there one guide for this?
I already followed up this stackoverflow anwser by PJ.Wanderson: multiple pages in Vue.js CLI
but is still have doubts.
Should I still be using the vue router? What kind of configuration should I use there?
How can I handle routes with parameters in this case? Should I use SSR too in this case?
Thanks in advance.
If you want to build a MPA in Vuejs, your best bet is building it in Nuxt. Nuxt wil handle all the SSR for you. I'm wondering why even build it in Vue in the first place? The reason there isn't that much information on MPA's with Vuejs is because most people build SPA's with it. Another alternative would be to build a SPA in Vuejs and deploy that on a subdomain. Then have al your marketing and other relevant pages on a simple wordpress site. Hope this helped.

Does nuxt need a server?

I'm studying nuxt.
I leave a question because I have a question while studying.
nuxt can ssr, but ssr is known as server side rendering.
Then, I wonder where the server is.
Because vue is built on node, is the server automatically made into node server?
And, how is SEO possible if we make it with nuxt?
I understand that it is possible if you make html with MPA. However, using nuxt makes SEO possible.
So, when you create a project with nuxt, does the client make it an MPA when it makes the first request?
where the server is?
Depends... Nuxt include a node server (nuxt), but you can during the nuxt instalation merge them with other node server frameworks
when use nuxt alone or with other server-side framework?
Depends of your needs, knowledge and project.
For example I usually use nuxt alone, more apollo graphql it give me all I need. but for Shopify apps, the admin embed login is write for Koa and super easy to use so I prefers nuxt + koa when I develop this kind of app.
what means ssr?
server side rendering, the important thing is Rendering, that means nuxt (or nuxt + extra server-side framework) read the vue (js) code in the server and rendered them in Html code, after that it send the html to the client machine.
This is the reason why SEO is possible, when a web crawler visit the site it receive a fulfilled HTML page easy to read and clasify.
Nuxt has a really extensive and easy to understand guide, I recomend you follow them. Example you can use Head for edit the Header of the page,

How to structure vue app when using global components

Currently, we try to figure out, how we can structure our vue code for this use case:
routing will be handled by the backend, so basically we don't creating an SPA here
we want to use vue to replace some jquery plugins. So on some sites of our website we have e.g. a drop-down component or a date picker component ...
one site will be small SPA
on each site, we have a navigation, where we also want using vue
How should this be structured? Is it one big vue application?
My idea is to build two vue applications:
one for the small SPA
one for all the components we need on different sites
Anybody can help out here?
For developing SPA in vuejs. Please refer to these two links
https://github.com/vuejs/vue-cli
and
https://github.com/chrisvfritz/vue-2.0-simple-routing-example
And for integerating VueJS in existing web page
you can follow the official website of vuejS