Skip to content

Module Recap

Module 01 covered the foundation: what Node.js is, the event loop, running scripts, TypeScript setup, and npm. Here is what to take forward.

Node.js runs JavaScript outside the browser. It provides file system, network, and OS access instead of DOM APIs. The same TypeScript you know from the frontend works here — with different globals and a different execution environment.

The event loop enables non-blocking I/O. Node.js is single-threaded but handles many concurrent operations by never blocking. When your API queries a database, the event loop continues processing other requests until the query completes. async/await is how you write this code cleanly.

TypeScript in Node.js uses tsx + tsconfig. tsx watch runs TypeScript directly with auto-restart during development. tsc compiles to dist/ for production. The "module": "NodeNext" setting aligns TypeScript’s module system with Node.js’s native resolution.

npm manages packages and scripts. dependencies are runtime packages; devDependencies are build-time. Always commit package-lock.json. Use npm run to run scripts defined in package.json.

The project structure you set up in Lesson 04 is the skeleton of the Bulletin API:

bulletin-api/
├── src/
│ ├── index.ts ← Express app setup, middleware, listen
│ ├── routes/
│ │ ├── auth.ts ← POST /auth/register, POST /auth/login
│ │ ├── posts.ts ← GET/POST /posts, GET/DELETE /posts/:id
│ │ └── comments.ts ← GET/POST /posts/:id/comments
│ ├── middleware/
│ │ └── authenticate.ts ← JWT verification middleware
│ ├── db/
│ │ ├── index.ts ← SQLite connection
│ │ └── schema.ts ← CREATE TABLE statements
│ └── types/
│ └── index.ts ← User, Post, Comment interfaces

Each module in this course fills in one more layer. By Module 07 this structure will be complete and deployed.

TermWhat it means
Node.jsJavaScript runtime outside the browser, built on V8
Event loopThe mechanism that processes async callbacks without blocking
Non-blocking I/OOperations that register callbacks and return immediately
processGlobal object with runtime info: env, argv, cwd(), version
tsxTool that runs TypeScript directly — no compile step needed
"module": "NodeNext"tsconfig setting for Node.js native ES module resolution
dependenciesRuntime packages (needed in production)
devDependenciesBuild-time packages (not needed in production)
package-lock.jsonExact dependency version lockfile — always commit this

Module 02 — npm, Modules, and the Runtime →

Module 02 goes deeper into the Node.js runtime: how CommonJS and ES modules work, the fs module for file I/O, the path module for cross-platform paths, the process object, and environment variables with dotenv. These are the building blocks every Node.js application uses before any framework appears.