15 ms·
All our application lives behind an authentication except login pages. I still cannot grasp how would I use Nextjs in only SPA mode. Not everything needs to be
by CSDude 4y ago
All our application lives behind an authentication except login pages. I still cannot grasp how would I use Nextjs in only SPA mode. Not everything needs to be SSR, I don't want to spare resources, just want to deploy it to S3, put cloudfront infront of it, let 404 requests return index.html and I can use the URLs without #.
SSR should not be a must the docs should reflect that. There is no way I'm paying Vercel 20$ per user for our simple use case or I'm hosting a VM to render pages. I don't care about the improvements SSR would bring in the price of cost, deployment complexity, or any other complexity. Affecting React docs like this to push for SSR does not feel safe to me. I'm happy with my Vite based React TS project.
- synergy20 4y agocant agree more, vercel likes ssr,and it now owns nextjs and svelte,then it forces ssr on the community,it is basically leveraging open source for its own business needs solely, which will not last long if they keep doing this down the road. disappointed.
- leerob 4y agoYou can use Next.js in SPA mode – you don't have to use SSR. Here are the current docs (https://nextjs.org/docs/advanced-features/static-html-export https://nextjs.org/docs/advanced-features/static-html-export) and we're working on an improved version for the new App Router (https://beta.nextjs.org/docs/configuring/static-export https://beta.nextjs.org/docs/configuring/static-export) based on community feedback. With this export, can you deploy anywhere you prefer.
- synergy20 4y agothis is still the ssr-first-but-will-do-it-all, I read the docs along with svletekit(which by the way, is the same tone, saying sveltekit does both SSR and CSR). it is NOT, I do not need wade through all those unnecessary SSR code and doc and steps and some second-class-citizen configurations to figure out how to get a CSR out of it. CSR users are not that dumb. It seems to me Vercel is the only one pushing for SSR-for-everything, I switched from svelte to React for exactly that reason, now React/Next.js is selling the same thing, I'm back to Vue. Please do not ever buy-or-influence Vuejs for SSR-first-and-does-everything-you-need, at least leave one untouched for us who cares nothing about SEOs.
- cush 4y agoI never understood where the idea came from that if pages are authenticated, then SSR isn't needed. Maybe because people think the only benefit is SEO. The biggest benefit is performance. SSR is still great to have behind authenticated pages, to improve load times. eg multiple tabs, continuing sessions, etc. There are countless examples of sites that usr SSR + CSR + Auth - Netflix, Github...
- psnehanshu 4y agoThe only other benifit of Next.js other than SEO is the project architecture that it provides. If you are building web apps that live behind auth, it's a no brainer to use CSR. It's easy to deploy, cheaper to host and serve, not harder than SSR to develop. The cons about performance can be solved using code splitting. Moreover with proper caching, the app loads instantly. Are there new age alternative CRA that provides a scalable project architecture like Next.js provides. Maybe it can come with basic libraries like react-router, react-query, pre installed and Vite pre configured.
- cush 4y agoOf course, there are tradeoffs. Code splitting might help a bit for someone with a slow connection, but I wouldn't say it "solves" the problem like truly streaming content does.
- psnehanshu 4y agoYeah, it's like a trade off. You can't have your cake and eat it too. With CSR, you distribute the load of rendering to your clients, which reduces your cost, which in turn allows you to provide better service.