الانتقال إلى المحتوى
التعليمخريطة التعلم· 7 دقائق للقراءة

Becoming a Node.js Backend Engineer: From the Event Loop to Scale

The event loop, TypeScript, NestJS, SQL with and without an ORM, streams, worker threads and scaling, in five stages with a project and the books for each, and what single-threaded really means for your server.

ReadIn

مقال كل يوم يفرق معاك

22 نوفمبر 2026
  • كاتب موثّق
محتويات المقال

A team's Node.js API handles its normal traffic with room to spare. Then a customer asks for a yearly report, and for several seconds every request times out, even the health check. In the incident channel someone writes the usual verdict: Node is single-threaded, it can't do heavy work, we should rewrite the service in Go. The CPU profile tells a different story: one handler built a huge CSV in a synchronous loop and held the event loop the whole time. Moving that job off the main thread fixed it without a rewrite.

The common misconception

The belief: Node.js is single-threaded, so it can only handle small apps, and any heavy work will freeze the whole server no matter what you do.

Half of it is true, and the Node.js docs say so. A single Node.js process runs its JavaScript on one thread and uses one CPU core for it, and CPU-bound work such as resizing images, hashing or parsing huge payloads ties up that thread and makes the whole application unresponsive.

The rest doesn't follow. The lets Node.js do non-blocking I/O by handing work to the operating system kernel whenever it can, and the Don't Block the Event Loop guide explains that Node.js also keeps a worker pool for file system calls, DNS lookups and some crypto and compression work. Its scalability comes from using few threads for many clients. For CPU work there are three built-in tools: worker_threads for CPU-heavy JavaScript, cluster or a process manager to run several processes across cores, and child_process for other programs. "No matter what you do" is wrong: there's a lot you can do, and learning it is the job.

What a Node.js backend engineer really does

Most work is HTTP APIs and services: endpoints with validation and authorization, database queries, caching, calls to third-party APIs, background jobs, and tests for all of it. In production you watch latency, memory and event loop delay, run several instances behind a load balancer, and find the occasional function that blocks the loop. NestJS, a framework that runs on top of Express or Fastify, adds modules and dependency injection, so knowing both the framework and what sits underneath it pays off.

The stages from zero to senior

This roadmap applies to Node.js 26, the current LTS line (the docs say production apps should run only Active or Maintenance LTS releases), with TypeScript 7, NestJS 12, Express 5 and PostgreSQL 19, as of November 2026. Durations assume about 10 hours a week; at 20 hours, expect roughly half.

  1. Stage 1: JavaScript and the event loopLearn: JavaScript (closures, objects, promises, async/await, errors), then Node.js itself: ES modules, npm and package.json, fs, http, events, environment variables, and how the event loop runs callbacks and microtasks. Learn the difference between blocking and non-blocking calls early. Postpone: frameworks, TypeScript and Docker. Build: a CLI that reads a large log file as a stream and prints statistics, then a small JSON server on node:http. Ready when: you can explain why an await in one request doesn't stop other requests but a long while loop does. About 3–5 months.
  2. Stage 2: TypeScript and HTTP APIsLearn: TypeScript in strict mode, running it with Node's type stripping and checking it with tsc --noEmit, then Express 5 or Fastify: routing, middleware, error handling, runtime validation, REST conventions and status codes, logging, and tests with the built-in node:test. Postpone: NestJS and microservices. Build: a tasks API with validation, central error handling and tests for every endpoint. Ready when: no request reaches your logic without validation, and CI runs the type check and tests. About 2–3 months.
  3. Stage 3: Databases with SQL and an ORMLearn: SQL in PostgreSQL (joins, indexes, constraints and transactions), raw queries through the pg driver with , then an ORM such as Prisma, Drizzle or TypeORM with migrations. Add connection pooling, pagination, the N+1 problem and Redis for caching. Postpone: choosing a NoSQL store just to avoid learning SQL. Build: move the tasks API to PostgreSQL with raw SQL, then rewrite one module with an ORM and compare the queries it sends. Ready when: you can read EXPLAIN for a slow query and wrap a multi-step write in a transaction. About 3–5 months.
  4. Stage 4: NestJS, auth and async workLearn: NestJS modules, providers and dependency injection, controllers, pipes for validation, guards for authorization and interceptors; sessions or tokens; a Redis-backed job queue for slow work; and streams with for uploads and exports. Postpone: CQRS and event-sourcing libraries. Build: rebuild the API in NestJS with login, a queued email job and a CSV export that streams instead of loading everything into memory. Ready when: you can explain what Nest's dependency injection does that you wired by hand in stage 2, and a large export keeps memory flat. About 3–4 months.
  5. Stage 5: Scale and senior skillsLearn: measuring event loop delay with perf_hooks, CPU profiles and heap snapshots, memory leaks, a pool of long-lived worker threads for CPU work, several processes or containers behind a load balancer, graceful shutdown, timeouts, retries and idempotency, tracing with OpenTelemetry, and rate limiting. Postpone: nothing now; go deep where your team hurts. Build: load-test your API, find a blocking function in a CPU profile, move it to a worker pool, run several instances and add tracing. Ready when: you can explain an incident from metrics and profiles and fix its cause, not just add servers. Expect 6–12 months.

Books for each stage

BookAuthorsEdition and yearStageFree or paid
Eloquent JavaScriptMarijn Haverbeke4th edition, 20241Free online; the paper copy is paid
Effective TypeScriptDan Vanderkam2nd edition, 20242Paid
Node.js Design PatternsMario Casciaro, Luciano Mammino4th edition, 20252–4Paid
Distributed Systems with Node.jsThomas Hunter II1st edition, 20205Paid

Node.js Design Patterns is the core book of this track; its fourth edition is updated for Node.js 24 and adds a chapter on testing with the built-in test runner. Distributed Systems with Node.js is the oldest here and, by its author's description, assumes you have already built several Node.js apps. Its ideas about the event loop, clustering, reverse proxies, health checks and observability still hold, but compare the tools it uses for logs, metrics and tracing (ELK, Graphite, Zipkin) with current options; for tracing, start with the OpenTelemetry docs for JavaScript.

There's no official Node.js certification to aim for right now: the OpenJS JSNAD and JSNSD exams were retired on 30 September 2025. Certification programs change, so check again before you plan around one; until then, your portfolio carries the weight.

Common mistakes

  • Calling synchronous APIs such as readFileSync inside request handlers.
  • Starting a new worker thread for every task instead of keeping a pool of long-lived workers, as the Node.js docs advise.
  • Using an ORM without understanding the SQL it sends.
  • Adding servers to fix slowness before finding the code that blocks the event loop.
  • Reading whole files or query results into memory when a stream would do.

How to show your work

Keep the NestJS project on GitHub with a README, a docker compose file that starts it with PostgreSQL and Redis, and CI that runs the type check and tests. Include a load-test script and a short write-up of one blocking function you found in a profile, with event loop delay before and after the fix. It shows more than a list of frameworks.

Next on ReadIn

Key takeaways

  • Node.js runs your JavaScript on one thread per process, but I/O happens in the kernel and a worker pool, which is why it serves many clients with few threads.
  • CPU-heavy work does block the event loop; move it to worker threads, separate processes or a job queue.
  • Learn JavaScript and the event loop first, SQL before an ORM, and Express before NestJS.
  • Measure event loop delay and profile before you add servers or plan a rewrite.

📚 المصادر

  1. The Node.js Event Loop — Node.js Learn
  2. Comparing Node.js concurrency models — Node.js Learn
  3. Worker threads — Node.js API documentation
  4. Introduction — NestJS Documentation
  5. Node.js Releases — nodejs.org

التعليقات (0)