Nicholas C. Zakas on the idea that we have choice in server-side JavaScript runtimes now, and you should be careful.
… it makes sense to preserve the ability to switch runtimes easily. It doesn’t matter if you want to use Node.js or Deno or Bun in production right now. What you really want is the ability to change your mind later with as little pain as possible.
Here’s his advice (truncated for brevity):
- Don’t use Deno- or Bun-specific APIs. Stick with Node APIs that are already supported in Deno and Bun.
- Use the “node:” prefix for Node.js internal modules. Node works just fine when using the “node:” prefix, so you can ensure compatibility across all three runtimes.
- Use npm and JSR packages, not HTTP module specifiers. Deno is still the only runtime to support URL modules, so it’s best to stick with npm and JSR packages, which can be used across all three.
- Use package.json for dependencies. Don’t use the proprietary file formats which have no advantages.
- Always run CI with Node, too. Even if you’re deploying to Deno or Bun, run CI in Node.