Node.js Cheat Sheet: Commands, Modules & Performance Tips

This cheat sheet is your go-to guide for mastering Node.js efficiently. Whether you’re building robust backends or optimizing existing projects, this resource gives you instant access to essential commands, core modules, environment variables, and performance optimization techniques. Authored by Node.js TSC member Rafael Gonzaga, this guide distills years of backend expertise into a single, practical reference. Ideal for developers working with Express, Fastify, or any modern JavaScript backend.
Use it to streamline development, debug smarter, and write cleaner Node.js code—faster.

 

By signing up to our newsletter, you can download our cheat sheet for FREE.

Table of Contents

  • Modules: Import & Export
    • How to use CommonJS and ES modules in Node.js projects.
  • Built-in Modules Overview
    • Quick lookups for fs, path, http, crypto, os, and more.
  • File System (fs)
    • Read, write, append, and delete files with minimal code.
  • Streams
    • Create, manage, and pipe data streams efficiently.
  • Performance Optimization
    • Use V8 flags and Node’s profiler to track and boost performance.
  • Debugging & Node Inspector
    • Step-by-step setup for effective runtime debugging.
  • Permission Model
    • Lock down your Node apps with scoped access using permission flags.
  • Environment Variables & CLI Flags
    • Essential variables and startup options to configure behavior and memory.
  • Event Loop & Timers
    • Understand execution order and scheduling with nextTick, setTimeout, and setImmediate.
  • Worker Threads
    • Run code in parallel to take advantage of multicore processors.
  • Testing
    • Use Node’s native test module for lightweight testing with assertions.

By signing up to our newsletter, you can download our cheat sheet for FREE.