Skip to content
Learn Netverks

Lesson

Step 1/36 3% through track

intro

Introduction to Node.js

Last reviewed May 28, 2026 Content v20260528
Track mode
nodejs_server
Means
Node sandbox
Reading
~3 min
Level
beginner

This lesson

An orientation to the Node.js track—how the server playground works, core vocabulary, and what you will practice next.

You need a clear map of the Node.js track so the event loop, modules, and server runtime do not feel like magic.

You will apply Introduction to Node.js in contexts like: REST/GraphQL APIs, BFF layers, CLIs, webhooks, and real-time services (with WebSockets).

Run JavaScript on the Node runner when configured—never mix arbitrary shell commands in lessons. Also read the interview prep blocks.

After HTML fundamentals and basic programming concepts—before or alongside SQL.

How this Node.js track works

  • Node server in the playground — runnable code executes as ESM (main.mjs): use import/export, console.log, and built-in node: modules. Click Run to execute.
  • CommonJS in prose — many tutorials and older packages use require/module.exports; lessons explain both. Runnable snippets prefer ESM or createRequire when 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

  1. brew install node or install nvm: nvm install --lts

Linux

  1. Debian/Ubuntu: curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt install -y nodejs (Nodesource) or distro packages.
  2. Fedora: sudo dnf install -y nodejs npm

Windows

  1. winget install OpenJS.NodeJS.LTS or installer from nodejs.org.

Verify: node -v and npm -v print versions.

Run code on this site (Backend & language playgrounds)

  1. Clone or open this project locally; copy .env.example to .env.
  2. Ensure LEARNING_RUNNER_ENABLED=true and LEARNING_RUNNER_URL=http://127.0.0.1:9999/v1/execute.
  3. Terminal 1: php artisan serve (or composer run dev for Laravel + Vite + runner together).
  4. 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:http and 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

  1. In one sentence, where does Node.js run compared to browser JavaScript?
  2. 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.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • Why Node after browser JS?
  • First API you would build?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump