Live data from Hacker News

Modern Node.js Patterns

kashw1n.com

61–70 of 448 posts

Re: Modern Node.js Patterns

#61
post #27

The killer upgrade here isn’t ESM. It’s Node baking fetch + AbortController into core. Dropping axios/node-fetch trimmed my Lambda bundle and shaved about 100 ms off cold-start latency. If you’re still npm i axios out of habit, 2025 Node is your cue to drop the training wheels.

node fetch is WAY better than axios (easier to use/understand, simpler); didn't really know people were still using axios

You still see axios used in amateur tutorials and stuff on dev.to and similar sites. There’s also a lot of legacy out there.

Re: Modern Node.js Patterns

#62

The LLM made this sound so epic: "The node: prefix is more than just a convention—it’s a clear signal to both developers and tools that you’re importing Node.js built-ins rather than npm packages. This prevents potential conflicts and makes your code more explicit about its dependencies."

Also no longer having to use an IIFE for top-level await is allegedly a „game changer.“

Re: Modern Node.js Patterns

#63

I love Node's built-in testing and how it integrates with VSCode's test runner. But I still miss Jest matchers. The Vitest team ported Jest matchers for their own use. I wish there were a similar compatibility between Jest matchers and Node testing as well.

assertions in node test feel very "technically correct but kind of ugly" compared to jest, but I'll use it anyway

Re: Modern Node.js Patterns

#65

The killer upgrade here isn’t ESM. It’s Node baking fetch + AbortController into core. Dropping axios/node-fetch trimmed my Lambda bundle and shaved about 100 ms off cold-start latency. If you’re still npm i axios out of habit, 2025 Node is your cue to drop the training wheels.

Undici in particular is very exciting as a built-in request library, https://undici.nodejs.org

Undici is solid. Being the engine behind Node's fetch is huge. The performance gains are real and having it baked into core means no more dependency debates. Plus, it's got some great advanced features (connection pooling, streams) if you need to drop down from the fetch API. Best of both worlds.

Re: Modern Node.js Patterns

#66
post #10

This is great. I learned several things reading this that I can immediately apply to my small personal projects. 1. Node has built in test support now: looks like I can drop jest! 2. Node has built in watch support now: looks like I can drop nodemon!

I still like jest, if only because I can use `jest-extended`.

Re: Modern Node.js Patterns

#67
I see two classes of emerging features, just like in the browser:

1. new technologies

2. vanity layers for capabilities already present

It’s interesting to watch where people place their priorities given those two segments

Re: Modern Node.js Patterns

#68

The LLM made this sound so epic: "The node: prefix is more than just a convention—it’s a clear signal to both developers and tools that you’re importing Node.js built-ins rather than npm packages. This prevents potential conflicts and makes your code more explicit about its dependencies."

[deleted]

Re: Modern Node.js Patterns

#69

I love Node's built-in testing and how it integrates with VSCode's test runner. But I still miss Jest matchers. The Vitest team ported Jest matchers for their own use. I wish there were a similar compatibility between Jest matchers and Node testing as well.

Currently for very small projects I use the built in NodeJS test tooling.

But for larger and more complex projects, I tend to use Vitest these days. At 40MBs down, and most of the dependency weight falling to Vite (33MBs and something I likely already have installed directly), it's not too heavy of a dependency.

Re: Modern Node.js Patterns

#70
post #10

This is great. I learned several things reading this that I can immediately apply to my small personal projects. 1. Node has built in test support now: looks like I can drop jest! 2. Node has built in watch support now: looks like I can drop nodemon!

I still like jest, if only because I can use `jest-extended`.

If you haven't tried vitest I highly recommend giving it a go. It is compatible with `jest-extended` and most of the jest matcher libraries out there.
Post reply on HN