DEV Community

Discussion on: Introducing an Alternative to NEXT.js

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

I admire the post thanks for sharing!
On the subject, I have a framework agnostic alternative this should work with just about anything. send in a headless browser like chrome headless (puppeteer) to render the requested page, toString the output and send that as the response. In other words a much faster browser with no UI does the heavy lifting ahead of time and does cache for the next visitor which is even faster.

Collapse
 
saltyshiomix profile image
Shiono Yoshihide

Oh, thank you for your sharing that!
The idea of intermediate puppeteer server is awesome :)

If you are OK, please let me know your framework!

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

Just download puppeteer to get started with headless chrome controlled by JavaScript. Then no matter what framework, given I use express, on route, point the browser here, get the rendered page as a string, store as a variable then serve that string. Not much else to it.

Like I say, no framework required just puppeteer and any http server.

Thread Thread
 
saltyshiomix profile image
Shiono Yoshihide

Thank you letting me know!

It may be similar to react-native-dom, right? (If wrong, I'm sorry.)

I will try puppeteer later :)

Thread Thread
 
adam_cyclones profile image
Adam Crockett 🌀

Potentially? I am not a react specialist. Puppeteer is fantasticly useful, I have used it within a unit testing framework to create acceptance tests.