Comment by tovej
1 day ago
Biggest takeaway for me is just how terrible node.js is as a server. Can't say I'm personally surprised, but I think people need to wake up to the mess that moving to self-hosting in javascript has brought. There's no reason to use js outside the browser, there are so many languages that are better suited to build processes and serving content. Testing is different, but why not just run a separate js interpreter specifically for that?
I understand if js is the only language you know, it's tempting to reach for it. But I'm currently actively avoiding js in the toolchain of all my web projects, and my sanity is slowly returning.
Feeling absolutely the same way these days (with 10+ years of experience with JS). My current breath of fresh air is Go and Swift (despite the fact XCode is the worst IDE I have ever worked with before). Curious what’s bringing back sanity for you?
I'm using bash for simple build problems like building dynamic component lists, when bash gets too unwieldy I switch to python. If the build process is stable enough and the scripts are beginning to get long, I'll rewrite the script as a CLI tool in a typed and compiled language.
Rinse and repeat.
The only thing that's really missing to me is bundling, which feels like a bit too big of a project to tackle on my own. But my current projects aren't big enough to need that, I'll pass that hurdle when it comes. And I may have to run webpack as a separate build process through node, but luckily I can do that in a CI container, and keep my dev machine clean.
Wait, what's wrong with it? For all the stuff I've written in Typescript it's been great. And the event loop of JS performs very well as well.
> the event loop of JS performs very well as well
that's the very opposite of my experience! Or rather it does perform, in the sense that I don't think there's much margin for improvement, but the very concept of single-threaded server that switches context on IO is so flawed and painful.
I spent many hours looking at various dashboards, trying to guess whether what I was looking at was a cause or a symptom or just noise. Any hypothesis of what is going wrong needs to take into account the weirdness and side-effects of the event loop. As much as I love the Typescript language, operating Node is a nightmare.
I saw the same issues with my servers.
I'm thinking about porting to Bun, as it's web server module is implemented in Zig.
Could have the benefit of using TypeScript without the issues of Node.js' HTTP module.