News for hackers. Stuff that matters.

Ask HN: Is there a CDN that pre-renders the app on the server?

I got a crazy idea this morning.

What if there was middle-man (CDN, proxy, etc) that sits between the browser and the target service and, for each page request, it would act as a headless browser, visiting the target page, running all the JS and doing the rendering, and then dumping the DOM tree to HTML and serving it to the client (with zero JS)?

So the target app could be 100% JS-rendered but it'd look to the browser as though it's just a static HTML page.

(I know that the question then is "doesn't it mean that the website would end up not being interactive because the JS doesn't get delivered to the browser?", but I imagine use cases when it's not really a concern)

Is there any project on the Web that does anything remotely similar to this idea? The core thing is using a headless browser to do all the JS-initiated rendering on the server before the content hits the browser.

( 6 comments | 2 points | on HN )
Re:Ask HN: Is there a CDN that pre-renders the app on the se... by kirillrogovoy on Monday October 11, 2021 @05:55AM (#28826592)
As a side note, I can imagine this approach being used for a customer-facing "proxy server".

E.g. there are people who disable JS by default and enable it for the websites they trust or when the page is completely dead without running JS.

I imagine an improved "Disable JS" function that (1) makes sure your browser doesn't run any JS but (2) ships a normally rendered page.

Re:Ask HN: Is there a CDN that pre-renders the app on the se... by j_alex on Monday October 11, 2021 @08:16AM (#28827461)
I am currently developing kind of what you're looking for! https://browser.staging.jimber.io You can interact with the browser on the backend (the headless one). But we could take out the 'small' part that renders the webpage in it's inital stage
Re:Ask HN: Is there a CDN that pre-renders the app on the se... by milosonator on Monday October 11, 2021 @07:39AM (#28827211)
I think basecamp is working on this kind of technology, but I think it is somewhat common for some performance focused shops to pre-render their initial HTML and cache it in their load balancer.

Basecamp I think is taking it a step further.. read more here: https://hotwired.dev/

Re:Ask HN: Is there a CDN that pre-renders the app on the se... by shabda on Monday October 11, 2021 @06:05AM (#28826633)
Is Mighty Browser (https://www.mightyapp.com/) what you are looking for?
Re:Ask HN: Is there a CDN that pre-renders the app on the se... by kirillrogovoy on Monday October 11, 2021 @06:19AM (#28826702)
Thank you!

Somewhat similar but not really.

Mighty Browser seems to go one step further and does "head-full" browser rendering on the server while streaming you the video of it to your computer.

With my idea, the HTML rendering still happens on the user's computer within the user's browser.

Re:Ask HN: Is there a CDN that pre-renders the app on the se... by wizwit999 on Monday October 11, 2021 @09:10AM (#28827916)
this would be really inefficient, stuff like server side rendering for react is what's used