The Node.js Handbook, 2025 edition
AI workshop
join cohort #2
The Node.js Handbook has been one of the first books I wrote back in 2018.
It’s been downloaded tens of thousands of times, and it’s even been the base for the official Node.js documentation, something I’m quite proud of.
I’ve now completely rewritten it for 2025, focusing on what matters most for beginners learning Node.js. After feedback and careful consideration, I’ve streamlined the content to be truly beginner-friendly, removing complex production patterns in favor of clear explanations and practical examples.
This new edition focuses on fundamental concepts with explanations that help you understand not just how to use Node.js, but why things work the way they do.
This handbook provides comprehensive coverage of Node.js v22 LTS, from basic concepts to advanced topics. It includes:
- 40+ major topics covering all aspects of Node.js development
- Modern JavaScript features and ES modules
- Built-in APIs and their practical usage
- Best practices for production applications
- Performance considerations and optimization
- Security guidelines and error handling
- Real-world examples with working code
The handbook is designed for developers who want to build server-side applications with JavaScript, offering both foundational knowledge and advanced techniques for production-ready Node.js applications.
Download it from https://flaviocopes.com/access/
Here’s the full table of contents:
Introduction & Setup
- Introduction to Node.js
- JavaScript runtime environment
- V8 engine outside the browser
- Single-process architecture
- Non-blocking I/O model
- Event-driven programming
- Node.js v22 LTS features
- Installation
- Official packages
- Package managers (Homebrew, etc.)
- Node Version Manager (nvm)
- LTS vs Current versions
- Example Application
- Basic HTTP server
- ES modules syntax
- Request/response handling
- Server configuration
Core Concepts
- Node vs Browser
- Environment differences
- DOM vs Server APIs
- Module systems comparison
- ES2015+ feature support
- Environment control advantages
- Running Scripts
- Command line execution
- Shebang usage
- Executable permissions
- Script configuration
- Development Tools
- Built-in —watch mode
- Auto-restart functionality
- nodemon (legacy approach)
Environment & Configuration
- Environment Variables
- process.env object
- Setting variables
- Built-in .env file support (v20.6+)
- dotenv package (legacy)
- Multiple .env files
- Command Line Arguments
- process.argv array
- Argument parsing
- Built-in parseArgs utility (v18.3+)
- Third-party libraries
- Console Output
- console.log() and methods
- Format specifiers
- Object rendering
- String formatting
- User Input
- readline module
- Promise-based interface
- Interactive prompts
- Stream processing
Module System
- ES Modules
- import/export syntax
- Default exports
- Named exports
- Module resolution
- node: prefix for built-ins
- Top-level Await
- Async module loading
- Promise handling
- Module initialization
Event System
- Event Emitter
- EventEmitter class
- Event-driven architecture
- Custom events
- Event handling patterns
- Events Module API
- addListener/on methods
- emit method
- once listeners
- removeListener/off
- Event names and counts
- Listener management
File System Operations
- File Descriptors
- Opening files
- File handles
- Resource management
- File Information
- fs.stat() method
- File metadata
- File types and permissions
- Size and timestamps
- File Paths
- Path manipulation
- Cross-platform compatibility
- Absolute vs relative paths
- Path parsing and formatting
- Reading Files
- Synchronous reading
- Asynchronous reading
- Promise-based APIs
- Stream reading
- Writing Files
- Write operations
- Append mode
- Stream writing
- File creation
- Working with Folders
- Directory operations
- Creating folders
- Reading directory contents
- Renaming and removing
- Recursive operations
Core Modules
- fs Module
- File system operations
- Synchronous methods
- Asynchronous methods
- Promise-based API
- File watching
- path Module
- basename() - file names
- dirname() - directory paths
- extname() - file extensions
- join() - path concatenation
- resolve() - absolute paths
- parse() - path components
- format() - path construction
- normalize() - path cleanup
- relative() - relative paths
- os Module
- arch() - system architecture
- cpus() - CPU information
- freemem() - available memory
- homedir() - home directory
- hostname() - system name
- loadavg() - system load
- networkInterfaces() - network info
- platform() - OS platform
- release() - OS version
- tmpdir() - temp directory
- totalmem() - total memory
- type() - OS type
- uptime() - system uptime
- userInfo() - user details
- http Module
- HTTP server creation
- Request handling
- Response methods
- Status codes
- Headers management
- HTTP methods
- Agent configuration
- Server classes
Streams & Data Flow
- Node.js Streams
- Stream fundamentals
- Why use streams
- Memory efficiency
- Composability
- Stream Types
- Readable streams
- Writable streams
- Duplex streams
- Transform streams
- Stream Operations
- pipe() method
- Stream chaining
- Data events
- Error handling
- Backpressure
- Creating Streams
- Custom readable streams
- Custom writable streams
- Transform stream creation
- Stream implementation
Cryptography
- Web Crypto API
- Cryptographic operations
- Hashing functions
- Encryption/decryption
- Key generation
- Digital signatures
Development Practices
- Development vs Production
- Environment differences
- Configuration management
- Performance considerations
- Security practices
- Debugging tools
- Error Handling
- Exception creation
- Error objects
- Try/catch blocks
- Uncaught exceptions
- Promise rejections
- Async/await errors
- Testing
- Built-in test runner
- Test organization
- Assertions
- Test coverage
- Mocking
Network Programming
- HTTP Server
- Server creation
- Request processing
- Response handling
- Routing basics
- Middleware concepts
- HTTP Requests
- GET requests
- POST requests
- PUT/DELETE methods
- Request options
- Response handling
- Request Body Data
- Body parsing
- JSON handling
- Form data
- File uploads
- Stream processing
Advanced Concepts
- Event Loop
- Event loop phases
- Call stack
- Task queuing
- Microtasks
- Blocking operations
- Asynchronous Patterns
- Callbacks
- Promises
- Async/await
- Error propagation
- Timers
- setTimeout()
- setInterval()
- setImmediate()
- Recursive timers
- Timer cancellation
- Process Control
- process.nextTick()
- Queue prioritization
- Event loop interaction
- Scheduling
- Worker Threads
- Multi-threading in Node
- Worker creation
- Thread communication
- SharedArrayBuffer
- Use cases
Download it from https://flaviocopes.com/access/
I wrote 20 books to help you become a better developer:
- CSS Handbook
- Node.js Handbook
- Astro Handbook
- HTML Handbook
- Next.js Pages Router Handbook
- Alpine.js Handbook
- HTMX Handbook
- TypeScript Handbook
- React Handbook
- SQL Handbook
- Git Cheat Sheet
- Laravel Handbook
- Express Handbook
- Swift Handbook
- Go Handbook
- PHP Handbook
- Python Handbook
- Linux Commands Handbook
- C Handbook
- JavaScript Handbook