languages
March 30, 2026 · 7 min read · 0 views

Node.js 23: New Features, Performance Improvements, and Migration Guide

Node.js 23 is here with enhanced module resolution, improved async performance, and WebSocket support. Learn what's new and how to upgrade safely.

Node.js 23: What’s New and Why It Matters

Node.js 23 was released in October 2024, bringing a collection of meaningful improvements for backend developers and DevOps engineers. While not a Long-Term Support (LTS) release, Node.js 23 introduces experimental features and performance enhancements that will shape the platform’s future. This guide breaks down the key changes, explains their practical implications, and walks you through a safe migration path.

Key Features and Improvements

1. Enhanced Module Resolution and ES Modules

Node.js 23 improves how the runtime resolves and loads ES modules, making it easier to work with both CommonJS and ESM in mixed codebases. The improvements focus on reducing ambiguity and improving performance when loading large module graphs.

What changed:

  • Faster ES module initialization through optimized resolution caching
  • Better error messages when module resolution fails
  • Improved support for conditional exports in package.json

Practical example:

// package.json with conditional exports
{
  "name": "my-lib",
  "type": "module",
  "exports": {
    ".": {
      "import": "./dist/index.mjs",
      "require": "./dist/index.cjs",
      "types": "./dist/index.d.ts"
    },
    "./utils": {
      "import": "./dist/utils.mjs",
      "require": "./dist/utils.cjs"
    }
  }
}

In Node.js 23, these exports are resolved more reliably, and TypeScript integration is improved. If you’re building libraries that support both module systems, this is a significant win.

2. WebSocket Support (Experimental)

One of the most anticipated features in Node.js 23 is native WebSocket support via the WebSocket global API, bringing Node.js closer to web standard APIs.

// Node.js 23: WebSocket support out of the box
const ws = new WebSocket('wss://echo.websocket.org');

ws.onopen = () => {
  console.log('WebSocket connected');
  ws.send('Hello Server');
};

ws.onmessage = (event) => {
  console.log('Message from server:', event.data);
};

ws.onerror = (error) => {
  console.error('WebSocket error:', error);
};

Previously, you needed external packages like ws or socket.io. While the feature is experimental, having native support reduces dependency bloat and improves performance for real-time applications.

3. AsyncLocalStorage Improvements

AsyncLocalStorage, crucial for tracking context across async operations (logging, request IDs, user sessions), now performs better in high-concurrency scenarios.

const { AsyncLocalStorage } = require('async_hooks');

const requestIdStorage = new AsyncLocalStorage();

const express = require('express');
const app = express();

// Middleware to set request ID
app.use((req, res, next) => {
  const requestId = req.headers['x-request-id'] || generateId();
  requestIdStorage.run(requestId, () => {
    next();
  });
});

// Access request ID anywhere in async chain
app.get('/api/users', async (req, res) => {
  const requestId = requestIdStorage.getStore();
  console.log(`[${requestId}] Fetching users...`);
  
  const users = await db.query('SELECT * FROM users');
  res.json(users);
});

In Node.js 23, AsyncLocalStorage operations are faster, particularly beneficial for logging frameworks and distributed tracing systems.

4. V8 Engine Update (v12.9)

Node.js 23 ships with V8 12.9, which includes:

  • Better JIT compilation for frequently called functions
  • Improved garbage collection in memory-constrained environments
  • Enhanced debugging capabilities

Performance impact: Typical throughput improvements of 3–7% depending on workload, with notable gains in serialization and string operations.

5. Improved Buffer Performance

Buffer operations, heavily used in file I/O and network code, are now faster:

const fs = require('fs');
const crypto = require('crypto');

// File streaming with improved buffer handling
const readStream = fs.createReadStream('large-file.bin', { highWaterMark: 64 * 1024 });
const writeStream = fs.createWriteStream('output.bin');

// Buffer hashing (now faster in Node.js 23)
const hash = crypto.createHash('sha256');
readStream.on('data', (chunk) => {
  hash.update(chunk);
});
readStream.pipe(writeStream);

readStream.on('end', () => {
  console.log(`File hash: ${hash.digest('hex')}`);
});

Step-by-Step Migration Guide

Step 1: Audit Your Current Node.js Version

First, check what version you’re running:

node --version
# Output: v22.x.x

Step 2: Review Breaking Changes

While Node.js 23 maintains backward compatibility with 22, there are a few deprecations:

  • Node.js flag changes: Some experimental flags have been reorganized
  • Internal APIs: Rarely-used internal APIs may have changed
  • Deprecated modules: Check if you rely on deprecated features

Review the full release notes and the changelog.

Step 3: Update Your Development Environment

Use a Node version manager for safe upgrades:

Using nvm (Node Version Manager):

# List available versions
nvm list-remote | grep v23

# Install Node.js 23
nvm install 23

# Switch to Node.js 23
nvm use 23

# Verify
node --version

Using fnm (Fast Node Manager):

fnm install 23
fnm use 23

Step 4: Test Your Application Locally

In your project directory:

# Install dependencies (regenerate node_modules to ensure compatibility)
rm -rf node_modules package-lock.json
npm install

# Run your test suite
npm test

# Run your application
npm start

Step 5: Check for Dependency Compatibility

Some packages may have native bindings that need recompilation:

# If you have native dependencies, rebuild them
npm rebuild

# Check for outdated packages
npm outdated

Step 6: Enable Experimental Features (Optional)

To use WebSocket or other experimental features:

# Run with experimental features enabled
node --experimental-websocket app.js

Or add to your package.json:

{
  "scripts": {
    "start": "node --experimental-websocket app.js"
  }
}

Step 7: Update Your CI/CD Pipeline

Modify your deployment configuration:

.github/workflows/ci.yml:

name: CI
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [22, 23]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}
      - run: npm ci
      - run: npm test

Common Pitfalls and How to Avoid Them

Pitfall 1: Native Module Incompatibility

Problem: Packages with native C++ bindings may fail after upgrading.

Solution:

# Clear build cache and rebuild
rm -rf node_modules
npm cache clean --force
npm install
npm rebuild

Pitfall 2: Experimental Features in Production

Problem: Experimental features (like WebSocket) may change or be removed.

Solution: Only use experimental features in non-critical paths, and check release notes before upgrading:

// Wrap experimental features in try-catch
let ws;
try {
  ws = new WebSocket('wss://example.com');
} catch (err) {
  console.warn('WebSocket not available, falling back to polling');
  // fallback logic
}

Pitfall 3: Performance Regression

Problem: Rarely, new versions introduce regressions in specific workloads.

Solution: Use Kloubot’s API Request Builder to benchmark your endpoints before and after upgrade:

# Load test endpoint
curl -X GET http://localhost:3000/api/users

Run multiple times and compare latency:

// Benchmark script
const http = require('http');
const iterations = 1000;
const start = process.hrtime.bigint();

for (let i = 0; i < iterations; i++) {
  http.get('http://localhost:3000/api/data', (res) => {
    res.on('data', () => {});
  });
}

setTimeout(() => {
  const end = process.hrtime.bigint();
  const avg = Number(end - start) / iterations / 1_000_000; // ms
  console.log(`Average response time: ${avg.toFixed(2)}ms`);
}, 5000);

Pitfall 4: Forgetting TypeScript Type Updates

Problem: TypeScript definitions may change in Node.js 23.

Solution: Update @types/node:

npm install --save-dev @types/node@latest

Then check for type errors:

tsc --noEmit

Production Readiness

Before deploying Node.js 23 to production:

  1. Run your full test suite (unit, integration, e2e)
  2. Performance test under realistic load
  3. Monitor logs for new warnings or errors
  4. Gradual rollout: Deploy to canary/staging first
  5. Have a rollback plan: Keep Node.js 22 available for quick downgrade

Docker Deployment Example

# Dockerfile for Node.js 23
FROM node:23-alpine

WORKDIR /app

COPY package*.json ./
RUN npm ci --only=production

COPY . .

EXPOSE 3000
CMD ["node", "--experimental-websocket", "server.js"]

Build and test:

docker build -t myapp:node23 .
docker run -p 3000:3000 myapp:node23

Tools for Debugging Node.js 23 Issues

When troubleshooting migration issues, leverage developer tools:

For example, if your API is returning unexpected JSON:

// Use JSON Formatter to validate
const response = await fetch('http://localhost:3000/api/data');
const data = await response.json();
// Paste the JSON into [JSON Formatter](/tools/json) to verify structure

What’s Next: Looking Ahead

Node.js 23 is a preview of the upcoming LTS release expected in October 2025 (Node.js 24 will be skipped; Node.js 26 will be the next LTS). Keep these features in mind:

  • WebSocket API will be stabilized
  • Async hooks will receive further optimizations
  • Module resolution will continue improving

Conclusion

Node.js 23 brings real improvements for developers: faster module resolution, native WebSocket support, and performance gains. While it’s not an LTS release, upgrading your development environment is worth it to prepare for the next LTS cycle. Follow the step-by-step migration guide above, test thoroughly, and you’ll be ready to take advantage of these new capabilities.

The upgrade path is straightforward, breaking changes are minimal, and the benefits are tangible. Start with your development environment, verify your test suite passes, and plan a gradual rollout to production.

Related Kloubot Tools

This post was generated with AI assistance and reviewed for accuracy.