Node.js Core · 8 min read · Intermediate
Node.js Runtime, Modules & process
Understand how Node.js runs JavaScript outside the browser using V8, libuv, built-in node: modules, and process.env.
What you'll learn
- Import Node built-ins explicitly with the node: prefix (node:path, node:os)
- Read runtime configuration safely from process.env with defaults
- Understand why blocking the single-threaded event loop hurts concurrency
Node.js executes JavaScript on the server using Chrome’s V8 engine and an asynchronous, event-driven I/O model (libuv). Because JavaScript runs on a single main thread, keeping I/O asynchronous lets one Node process serve thousands of concurrent connections.
Fill-in-the-Blank Exercise
Read Port from Environment
Read PORT from process.env with a fallback of 3000.
const port = Number(.env.PORT 3000);Live Code Lab (Node.js 20)
Node.jsruntime.js
Expected OutputClick “Run Live” to compile with Node.js 20
Node: v20.17.0 Platform: linux | Port: 3000 Safe path: data/courses.json
Check Your Understanding
Score: 0 / 1
1. Why should Node.js servers avoid synchronous blocking calls like fs.readFileSync() inside request handlers?
Study Workspace
Finished this lesson?
Your progress is saved locally in your browser, no account needed.