← All Learning Paths

Node.js Backend Developer

Build production Node.js services: event-loop health, typed validation, JWT auth, graceful shutdown, and the debugging habits that keep APIs alive under load.

roleintermediate9 nodes15h total

Path overview

Node.js 后端的核心不是写路由,而是守住事件循环、错误边界与进程生命周期。本路径从事件循环与阻塞诊断入手,经过 Express 与 Fastify 的错误处理范式、类型化校验与 JWT 认证,最终落到优雅停机与生产级启动模板。

This path trains the habits that keep Node.js services alive: understanding the event loop, wiring error handling through Express and Fastify, validating inputs with typed schemas, and shutting down gracefully under SIGTERM.

  1. Reconstruct the reasoning behind "Error Handling Patterns for Production Applications" by tracing "Structured Logging and the Redaction Layer" to the failure it prevents in nodejs systems.

    Completion criteria: Record a short walkthrough of "Error Handling Patterns for Production Applications" with timestamps at "Structured Logging and the Redaction Layer" and "Recovery and Degradation", plus the commit that applies it.

    Next step: Express

    ⏱ 1h

  2. Wire "Express" into a scratch nodejs project, following "app.listen app.listen(port, callback?): Server", and record one working request/response pair.

    Prerequisites: Error Handling Patterns for Production Applications

    Completion criteria: Attach one successful call and one invalid call against "Express", citing "data-fetching" as the documented surface.

    Next step: Fastify

    ⏱ 1h

  3. Wire "Fastify" into a scratch nodejs project, invoke fastify() fastify(opts?: FastifyOptions): FastifyInstance, and record the error path.

    Prerequisites: Express

    Completion criteria: Show one successful call to fastify() fastify(opts?: FastifyOptions): FastifyInstance and one invalid call, with the returned status code and message for each.

    Next step: Fastify Type Provider Zod Serialization

    ⏱ 1h

  4. Execute "Fastify Type Provider Zod Serialization", change one constant, and describe how the output diverges from "Register a Zod type provider in Fastify so route schemas drive validation, serialization,".

    Prerequisites: Fastify

    Completion criteria: Attach the terminal transcript for "Fastify Type Provider Zod Serialization": command, exit code, and the printed result you used to confirm "Register a Zod type provider in Fastify so route schemas drive validation, serialization,".

    Next step: Node.js JWT Auth with Express

    ⏱ 0.75h

  5. Run the nodejs snippet "Node.js JWT Auth with Express", capture stdout, and show which line demonstrates the documented behavior: "the login entry point".

    Prerequisites: Fastify Type Provider Zod Serialization

    Completion criteria: Change one constant in "Node.js JWT Auth with Express", rerun, and attach both stdout captures plus a one-line diff explaining what moved.

    Next step: Add a Graceful Shutdown Handler

    ⏱ 0.75h

  6. Execute "Add a Graceful Shutdown Handler" end to end, then repeat the last step with one parameter changed and compare "Once shutdown begins, readiness returns 503 and the load balancer removes the instance.".

    Completion criteria: Deliver a transcript of "Add a Graceful Shutdown Handler" with each step's command and observed state, ending at "Once shutdown begins, readiness returns 503 and the load balancer removes the instance.".

    Next step: Express TypeScript Prisma Starter

    ⏱ 0.5h

  7. Use "Express + Prisma REST API" for a nodejs starter, adapting "An Express.js REST API with Prisma ORM, TypeScript, Zod validation, and Swagger docs for" without breaking the entry point.

    Completion criteria: Run "An Express.js REST API with Prisma ORM, TypeScript, Zod validation, and Swagger docs for", replace one module, and show the entry point still returns the documented output; include the diff.

    Next step: Trace a Request Pipeline Until the First Failure

    ⏱ 1.5h

  8. In the "Node.js Backend Developer" path, implement "Trace a Request Pipeline Until the First Failure" so JSON object: { pipeline: string[], results: { [stage]: pass | fail } } yields {blockedBy:auth,ranBefore:[rate-limit],handlerRan:false}, including the second sample's edge case.

    Prerequisites: Express TypeScript Prisma Starter

    Completion criteria: Submit a solution for "Node.js Backend Developer" that passes both samples ({pipeline:[rate-limit,auth,validate,handler],results:{rate-l to {blockedBy:auth,ranBefore:[rate-limit],handlerRan:false}) and attach the failing case you fixed.

    Next step: Capstone: Node.js Backend Developer

    ⏱ 0.5h

  9. Ship "Let in-flight requests finish within a configurable grace period." from "Build an HTTP Server with Graceful Shutdown", then prove it with the project's test suite and an acceptance note.

    Prerequisites: Express TypeScript Prisma Starter, Trace a Request Pipeline Until the First Failure

    Completion criteria: Run the project's test command for "Build an HTTP Server with Graceful Shutdown", paste the passing output, and attach the acceptance note for "Let in-flight requests finish within a configurable grace period." with the test name.

    Next step: Run the capstone's tests, publish the repository, and demo it to a reviewer.

    ⏱ 4h