█
LastWrite
  • > Curriculum
  • > Pricing
  • > For Educators
  • > About
  • > Contact
Log InGet Started

Questions, concerns, bug reports, or suggestions? We read every message, write to us at [email protected].

More ways to reach us →
LastWrite

Structured computer science lessons for aspiring developers and security professionals.

[email protected]

(201) 785-7951

Mon–Fri, 9 AM–5 PM EST

Learn

  • Curriculum
  • Pricing

Company

  • About
  • For Educators & Schools
  • Contact Us

Legal

  • Terms of Service
  • Privacy Policy
© 2026 LastWrite. All rights reserved.
Curriculum/Programming Languages/Node.js/What Node.js Is
35 minBeginner

What Node.js Is

After this lesson, you will be able to: Explain Node.js, its event loop, and why it dominates I/O-heavy workloads.

Node = V8 + libuv + a JS-friendly API. Single-threaded event loop; libuv pool for blocking I/O.

This is a free introductory lesson. No purchase required.

Why Node won

Same language client + server. Lightning-fast iteration. npm ecosystem. Built for async I/O, perfect for web servers + tools + scripts. Drawbacks: single-threaded for JS (GIL-like). CPU-heavy = worker_threads or spawn out.

Event loop in Node

Phases: timers (setTimeout) → pending callbacks → idle → poll (I/O) → check (setImmediate) → close callbacks. Microtasks (Promise.then) drain between each phase. process.nextTick is HIGHEST priority, fires before any microtask. Use sparingly.

Run your first script

Install Node 20+; run with `node script.mjs` for ESM.

python
// hello.mjs
import { readFile } from "node:fs/promises";
const data = await readFile("./package.json", "utf-8");
console.log(JSON.parse(data).name);
// node hello.mjs, runs the script with top-level await

Bun and Deno as alternatives

Bun: drop-in faster Node alternative; native TS; bundler + test runner included. Deno: built by Node's original creator; secure-by-default; standalone TS; non-npm by default but supports npm. Node is still the default in 2026; Bun + Deno are credible for new projects.

Quick Check

Why is Node single-threaded?

Pick the cleanest answer.

Back to Node.js
Node Core Modules→