How this Node.js track works
- Node server in the playground — runnable code executes as ESM (
main.mjs): useimport/export,console.log, and built-innode:modules. Click Run to execute. - CommonJS in prose — many tutorials and older packages use
require/module.exports; lessons explain both. Runnable snippets prefer ESM orcreateRequirewhen comparing styles. - Prerequisites — finish JavaScript (functions, promises, async/await) first. For backend context, skim PHP and Java request–response lessons.
Express and npm install are taught conceptually—HTTP lessons use built-in node:http in the runner. Real projects need a local package.json and dependencies.
Install on your device (macOS, Linux, Windows)
Install Node.js 20 LTS for npm projects; the playground executes ESM on the dev runner.
macOS
brew install nodeor install nvm:nvm install --lts
Linux
- Debian/Ubuntu:
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt install -y nodejs(Nodesource) or distro packages. - Fedora:
sudo dnf install -y nodejs npm
Windows
winget install OpenJS.NodeJS.LTSor installer from nodejs.org.
Verify: node -v and npm -v print versions.
Run code on this site (Backend & language playgrounds)
- Clone or open this project locally; copy
.env.exampleto.env. - Ensure
LEARNING_RUNNER_ENABLED=trueandLEARNING_RUNNER_URL=http://127.0.0.1:9999/v1/execute. - Terminal 1:
php artisan serve(orcomposer run devfor Laravel + Vite + runner together). - Terminal 2:
npm run runner— keep it running while you click Run on server.
Project init: mkdir my-api && cd my-api && npm init -y
Node.js lets you run JavaScript on the server—outside the browser. Built on Google Chrome's V8 engine, Node is designed for I/O-heavy work: HTTP APIs, webhooks, CLIs, and real-time services where waiting on disks and networks should not block the whole process.
How this track differs from browser JavaScript
After the JavaScript track, you know variables, functions, promises, and DOM APIs that run in the user's browser. Node runs the same language on the server (or your laptop terminal) with different built-ins: fs for files, http for servers, process for environment and exit codes—no document or window.
For backend context, compare with PHP and Java: all three handle HTTP requests, talk to databases, and return JSON or HTML—but Node shares syntax with your front-end React or Vue code.
What you will learn
- Node runtime, modules (CommonJS and ESM), npm, and the event loop
- Async patterns: callbacks, promises, async/await, streams basics
- HTTP servers with
node:httpand Express concepts - JSON APIs, env config, validation, cookies/sessions, and security habits
- Debugging, testing mindset, deployment, and interview essentials
Playground setup
This topic uses the nodejs_server profile: runnable code executes as ESM (main.mjs). Use import/export, console.log, and node: built-in modules. Express and npm install are taught in prose—HTTP lessons use built-in modules in the runner.
Self-check
- In one sentence, where does Node.js run compared to browser JavaScript?
- Why is the JavaScript track a prerequisite?
Interview prep
- What is Node.js in one sentence?
Node.js is a JavaScript runtime built on Chrome's V8 engine that runs JS outside the browser—ideal for HTTP APIs, CLIs, and tooling with npm's package ecosystem.