Hacker News new | ask | show | jobs
by neoplatonian 2027 days ago
Hi. As someone new to frontend, could anyone tell me how frontend for lightweight-but-very-functional sites like these (also hackernews) built? Do they use something like Next.js for server-side-rendering? Which frameworks would you recommend to build a social network, if one wanted to avoid Single Page frameworks like React and Vue?
3 comments

Having built sites of similar levels of interactivity, we would have used some sort of server side framework with a template library (A custom PHP framework+Smarty, Spring Boot+Thymeleaf, Python+Django), without any front end frameworks at all. We would use jQuery a little, and later some Bootstrap. But these days vanilla JS would probably suffice for what we'd generally have used jQuery for. This is probably a bit old school at this point, I'm sure.
jQuery is a relatively small dependency and it's still more expressive than vanilla JS so I wouldn't hesitate to use it if it felt appropriate.

One could also reach for something like Preact if some components are too complicated for manual imperative updates. You can use it without a build step and only for some parts of your pages. For compatibility you can ship a server-rendered component that you then throw away if the client has JS enabled (although that would require you to implement it twice).

You don't need to use react and vue as single page frameworks, you can just use them for reactivity / events. There are lightweight alternatives for that too.

If you do it that way you don't need server side rendering since your JS is only handling events and there are no client side components or anything like that.

Sibling comments mentioned some approaches already but just FYI, Hacker News is built on Arc, a custom-made Lisp dialect: https://en.wikipedia.org/wiki/Arc_(programming_language)
I thought Arc was only for backend? Or does it render HTML as well?
I think the backend directly emits HTML. Some JS (without libraries if I'm not mistaken) is used on the client side for things like voting. I don't know how it does persistence or what its infrastructure looks like.