SPA + SSR (pre-rendering) use case #1704
-
Hello, I am considering using Vike to build an app that targets a backend API. I like its flexibility and I think it will suit my needs. Most of the app will be under authentication, so a simple SPA would be enough. For this, I thought Vite and React would be sufficient. However, I also need static pages for documentation, product descriptions, maybe articles or other pages that will be completely public and require SEO. Therefore, I would like to use pre-rendering (SSG) for them. I don't want a Node.js server or SSR as I already have a completely separated backend with a REST API. I would like to serve the app as a completely static HTML/CSS/JS. But when I scaffold the app with Vike or Bâti, both come with the server part (I know I can remove it). Lately, frameworks are leaning towards SSR, server components, and running a Node.js server. I noticed that Vike has a routing system and a guard that I would like to use. Does it make sense to use React Router or Tanstack Router for the SPA? Or can I use Vike's routing system for the SPA part as well? I'm concerned about the I also intend to use Tanstack Query, and I saw that for data fetching, there are the So, can I, or is it advisable to use Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I think I have solved already some of the questions. The
|
Beta Was this translation helpful? Give feedback.
-
Good point (FYI @phonzammi @magne4000).
See https://vike.dev/react-router. If Vike's router is blocking you in some ways then let us know. (We're aware of #1476 and working on it.)
Yes. It would be nice if
See https://vike.dev/extension-vs-custom.
Why?
I've improved the documentation around all that: d3c2e0e~...a1906e2. Most notably, have a look at the new content at https://vike.dev/guard. Does that answer your questions? Let me know what solution you ended up with.
FYI it's fairly high priority to implement that feature. Btw. would your company be up for sponsoring? (Beyond supporting Vike, also for tight-knit support and much increased feature request prioritization.) |
Beta Was this translation helpful? Give feedback.
Good point (FYI @phonzammi @magne4000).