Node.js Recipes
View CommandsRun JavaScript outside the browser. Manage packages, scripts, and server-side applications with Node.js runtime commands.
10 recipes
Scale Node.js with Cluster and PM2
Use the cluster module and PM2 process manager to run multiple Node.js workers across all CPU cores for production scaling.
Debug Node.js with Chrome DevTools
Attach Chrome DevTools debugger to a Node.js process for breakpoints, stepping, profiling, and live memory inspection.
Optimize Node.js Docker Images
Build minimal, secure, and fast Node.js Docker images for production using multi-stage builds and best practices.
Environment Variable Management
Manage environment variables securely with dotenv, validation, and type-safe configuration for Node.js applications.
Migrate from CommonJS to ES Modules
Convert a Node.js project from require/module.exports to import/export syntax with proper configuration.
Find and Fix Memory Leaks
Detect memory leaks in Node.js applications using heap snapshots, process.memoryUsage(), and diagnostic tools.
Monorepo with npm Workspaces
Set up and manage a monorepo using npm workspaces for shared packages, consistent tooling, and streamlined development.
CPU Profiling with --prof and clinic.js
Profile Node.js CPU usage to find performance bottlenecks using built-in V8 profiler and clinic.js flame charts.
npm Audit and Dependency Security
Scan Node.js dependencies for known vulnerabilities using npm audit and integrate security checks into your workflow.
Built-in Node.js Test Runner
Use the built-in node --test runner for unit and integration testing without installing external test frameworks.