Live data from Hacker News

Ask HN: Server side rendering is now a good idea?

news.ycombinator.com

31–40 of 43 posts

Re: Ask HN: Server side rendering is now a good idea?

#31
post #27

Earlier quoted context omitted.

Can you elaborate on this please? I'm a backend engineer with little interest in the frontend morass de jure, but my company is looking to move to React. Reasons are that Vue2 is being EOL and there's a lot of work to move to Vue3, it's about the same workto just start over in React and there's a larger pool of talent for it. I don't really know much about the whole situation, but it seems to highlight the cause of m…

I tried to elaborate in a previous comment(on some other post) but moderation deleted my comment. It's very difficult to hide disgust and disdain for this library if you've used it. The reasons are as follows: 1) React boasts that is just JS but has arbitrary rules like don't use useEffect in loops. 2) Even after 9 years even the core features are not clearly explained. The authors clearly did not know what they were…

[deleted]

Re: Ask HN: Server side rendering is now a good idea?

#32
Sorta agree but not wholly surprised. We hit new problems - increased user expectations. We experiment and learn what the right dose of tech to use. When things get complex, the pendulum swings with new innovations. But it is fun to think that we had to create basic forms or ever so slightly complex forms in pure JavaScript.

Apps that need react and other similar frameworks are like excalidraw, linear, figma, etc. think most crud apps are fine.

However, react is still a great programming tool for me. I like the abstractions available with remix, next, qwik, and all that. I can still have a backend api team, and a separate web team that uses remix to consume the api. Simple models.

Re: Ask HN: Server side rendering is now a good idea?

#33
Always has been.

CSR solves a different set of problems. One common problem is that front-end developers don't always have access to the back-end, nor do they always have the skills to deal with back-end. Sometimes it's just quicker to have back-end provide the data (i.e. an endpoint), and have the front-end deal with it.

I think, since before CSR became the popular trend, that front-end development had fragmented and proliferated so much that it has become fairly complicated. Front-end development used to be just a web "designer" would design it and make the page look pretty. Toss in some JS for interactivity + animation. Once they're done, hand it off to the web "developer" for hosting and integration into the web server. Now it has grown into this monstrosity where we can have the designer, UI/UX person, front-end API, etc. With the client doing all the rendering, web pages have started to slow down. At some point, folks are like, "Wait a minute! What about SSR? We can solve so much of our performance and security issues that way!"

Trends are often cyclical, with the previous trend being replaced by old trends making fresh rounds. I suspect we will see old ideas with fresh eyes, and a new way to reason about things.

Re: Ask HN: Server side rendering is now a good idea?

#35
With regards to security, obviously it is possible to get security wrong when exposing APIs to the front end. That said, when it comes to the risk of your server being compromised, the less code running on your server the better. So if you can move some of that code onto the client, then it is a pretty significant security win. Except for XSS and DOS attacks, client code by definition doesn't bring any security risks. It is UNTRUSTED. So if you mess up your react code, there is very little that can go wrong. If you mess up server side code, however, you are asking for trouble.

I believe that minimalist, well audited REST or Websocket protocols are FAR more secure than server side rendering. How can you audit the entirety of your UI for security flaws? How can you analyze data leakage formally over such a large surface area? You cannot. But you can analyze 10 REST endpoints passing JSON. You can analyze RPC over websockets. Often times such specifications can fit on 4 sheets of printer paper. Take it on the train with you. Print out a copy and look for security flaws while you're on the toilet. You can't do that with server-side rendering.

I guess if there is not much data-flow both ways, then server-side rendering could be much more secure. For example, if you have a page live rendering stock charts on a news site. One that is complex but doesn't allow for much configuration. Server side rendering would be more secure. However, if you are creating something like a CRDT based shared spreadsheet that supports formulas, server-side rendering could basically mean that you are giving untrusted clients the ability to run Turing complete code on your server ;) . You'll be far better off having as much as possible on the client and as small and simple a protocol as you can manage between the front end and the back end.

Basically, security wize:

- If drawing the page requires a huge number of data points to create a visualization that the client cannot interact with much, then server side rendering reduces the attack surface (you're just sending display information).

- If the page allows for a lot of user control over the data, you increase your attack surface by processing more untrusted information server side.

Re: Ask HN: Server side rendering is now a good idea?

#36
post #7

checkout how rails does best of both worlds with something called "turbo" https://www.hotrails.dev/turbo-rails/crud-controller-ruby-on...

Turbo is just a JS library, not tied to rails. I use it with golang and I love it! It offers a nice tradeoff between heavy custom HTML attributes and too much 'convention over configuration'. Also pairs nicely with alpine.js

Seconded! I use Turbo with Haskell and Rust web apps. SSR with Turbo is the sweet spot for me.

Re: Ask HN: Server side rendering is now a good idea?

#37
Are you writing a media player? Are you writing an interactive application that requires little to no backend? Go client-side.

For everything else, meaning 99% of the projects you will ever be paid to work on, server-side framework with just a little sprinkle of JS where needed is enough and 10x more productive.

Re: Ask HN: Server side rendering is now a good idea?

#38

It's a lot simpler for sure these days. I've built my indie startup with Phoenix Liveview. It's all server side rendered, with liveview sprinkling in interactivity. Can you tell it's server side rendered? https://www.gamedrop.gg/lists/slymilano/exciting-game-releas... https://www.gamedrop.gg/game/hogwarts-legacy I think there are similar tools in other platforms like Rail's and Laravel.

Looks great and performs great. Thank you for sharing!

Thanks for sharing your experience with the site!

Re: Ask HN: Server side rendering is now a good idea?

#39
post #25

The speed of light isn't getting any faster. Examples: https://www.cloudping.co/grid I'd be wary of taking asynchronous actions and making them synchronous. For instance, if you had a list of items each with a delete icon next to it, you don't want to turn deleting three items from click-click-click into click-wait-click-wait-click. Chrome Dev Tools can simulate added latency as well as restricted bandwidth, so you c…

Can’t batch actions with either strategy?

Re: Ask HN: Server side rendering is now a good idea?

#40
post #25

The speed of light isn't getting any faster. Examples: https://www.cloudping.co/grid I'd be wary of taking asynchronous actions and making them synchronous. For instance, if you had a list of items each with a delete icon next to it, you don't want to turn deleting three items from click-click-click into click-wait-click-wait-click. Chrome Dev Tools can simulate added latency as well as restricted bandwidth, so you c…

Can’t batch actions with either strategy?

Yeah a delete checkbox would make sense. I've seen that in the past, and evidently forgot about it.

A specific horror show I remember was a Netflix-like DVD shipping service, where you maintained an ordered list of DVDs you'd like to receive. Each DVD in your queue had a textbox with a sequence number (1, 2, 3...) in it. You could edit the numbers and on submit, the server would do a stable sort. "1" and "999" could conveniently push multiple items to the top/bottom of the list, but to precisely order the first five items - the most common use case! - you'd usually need multiple passes. Drag and drop would have been way better.

Post reply on HN