Build CLI Apps with Node.js
Learn how to build practical CLI apps with Node.js and npm
What's Inside
- 014 mins
CLIs and the Terminal
Learn what CLI apps are and how terminal commands work.
- 026 mins
Your First Node.js Script
Run JavaScript with Node.js and build a small system-info script.
- 03Free6 mins
Creating a Node Project
Create a Node.js project with package.json, scripts, and ES modules.
- 046 mins
Modules in Node.js
Split a Node.js CLI across files with ES module imports.
- 05Free8 mins
Built-in Node Modules
Use built-in Node modules for system info, paths, and files.
- 06Free6 mins
npm Packages
Install npm packages and import them into a Node.js CLI.
- 077 mins
Reading Command Arguments
Read terminal arguments with process.argv and npm scripts.
- 089 mins
Flags and Options
Add flags, option values, defaults, and help text to a CLI.
- 098 mins
CLI Libraries and Subcommands
Use Commander to build subcommands, options, and help output.
- 107 mins
Interactive Prompts
Ask terminal questions with prompts and use answers in a CLI.
- 119 mins
Making a Real Command
Turn a Node.js project into a command that runs by name.
- 127 mins
Output, Errors, and Exit Codes
Route output, errors, and exit codes for a reliable CLI.
- 138 mins
Handling Failures Well
Handle expected mistakes and unexpected bugs without messy crashes.
- 148 mins
Reading Files
Read files from a CLI and handle common path errors.
- 1511 mins
Writing Files and Folders
Write files and create folders from a Node.js CLI.
- 1610 mins
JSON Storage
Store structured CLI data in a local JSON file.
- 17Free7 mins
Pipes and Redirects
Make a CLI work with stdin, stdout, stderr, pipes, and redirects.
- 1811 mins
Config and Environment Variables
Read config files and environment variables in a CLI.
- 1911 mins
Calling APIs from a CLI
Call an API from a CLI and format the JSON response.
- 2010 mins
Running Other Commands
Run Git from Node.js with child processes and capture output.
- 215 mins
Capstone: Build and Polish a CLI
Build a multi-command CLI from the course pieces.
What you'll learn
- Build useful terminal tools with Node.js
- Give your commands a name using npm
- Args, flags, prompts, config, env, and pipes
- Read and write files, folders, and JSON data
- Call APIs and run Git from your CLI
- Best practices for creating CLI applications
Meet the Author
The people behind this packWhat are Lesson Packs?
Lesson packs are premium, opinionated guides written by the team. Pro members get access to all current and future lesson packs, including other pro benefits.
- Written by the team behind roadmap.sh
- Visual diagrams and real examples
- A clear, opinionated path per roadmap
- Unlocks every current and future pack

