W
Wasp4w ago
XMDim

Can i add ssr only in one page?

I have an external page that will be fed with one page param (different for every user) and i want the items that being fetched to be on server side so all my api calls not being seen. Could this be done or? basically is a different page every user can upload images or videos so they get their own space on s3. Problem is i want to pass on param the user and get me different things (like one static image names etc)
4 Replies
kapa.ai
kapa.ai4w ago
Hi @XMDim. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Currently, Wasp does not support per-page SSR (Server-Side Rendering) out of the box. The Wasp team is aware of the need for SSR for SEO and other use cases, and there are open discussions and issues about how to approach SSR, SSG, and related features. However, as of now, SSR is not implemented, and there is no built-in way to enable SSR for just a single page or route. The current architecture renders React pages on the client side, and all API calls are visible in the browser's network tab. There are discussions about possibly supporting SSR in the future, potentially inspired by frameworks like Next.js or using tools like vite-plugin-ssr, but nothing concrete has been released yet. The team is considering how to allow more flexibility, such as custom queries for enriching user data, but this is not the same as SSR. For now, all data fetching happens on the client side, and there is no mechanism to hide API calls from the client by rendering data server-side for a specific page only. You can follow the progress and discussions here: Figure out our plan for SSR / SSG, also SEO, Server side rendering (SSR). If you need to restrict access to certain data or API calls, you should implement proper authentication and authorization on your server-side actions and queries. But the actual fetching and rendering will still be client-side until SSR is supported. In summary:
- SSR per page is not currently possible in Wasp. - All API calls for fetching data are visible to the client. - SSR/SSG is on the roadmap, but not yet available. If SSR is critical for your use case, you may need to wait for future Wasp updates or consider alternative approaches for now. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @XMDim, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Filip
Filip4w ago
Hey @XMDim, I must admit I didn't quite understand the question. Could you provide more info or try to rephrase it?
XMDim
XMDimOP4w ago
Well it’s an events page. Each logged in user can make an event that will be different per user. so user 1 can have event/1 , user 2 can have event/2 etc. Because I want the event to be dynamic like event/:eventid , I want based on id to fetch some data that user created when he was logged in. If it was ssr I could fetch those info on the server without exposing sensitive data and api routes on front end like it is now. So can I do this ? If I was on ssr based on event id I could hit for example the user and get those data I want without exposing user data on the public client. event/event is is a public route not behind with @sodic
Filip
Filip4w ago
If it was ssr I could fetch those info on the server without exposing sensitive data and api routes on front end like it is now.
Why do you think you're exposing sensitive data and api routes? Aren't they all authenticated. I'm still not 100% sure what you mean, but I don't think you need or want SSR to solve your problem (and it couldn't do it anyway). So we might have an XY problem here.
XY problem
The XY problem is a communication problem encountered in help desk, technical support, software engineering, or customer service situations where the question is about an end user's attempted solution (X) rather than the root problem itself (Y or Why?). The XY problem obscures the real issues and may even introduce secondary problems that lead t...

Did you find this page helpful?