← ClaudeAtlas

node-backendlisted

Build production Node.js backends — Express/Fastify/Nest, the event loop, async/await correctness, streams, graceful shutdown, and not blocking the single thread. Use when writing a Node HTTP service, debugging "the server hangs / is slow under load", handling errors in async code, streaming large payloads, managing the process lifecycle, or choosing a framework. Triggers — "node server", "Express", "Fastify", "NestJS", "event loop", "the API is slow", "unhandled rejection", "stream", "graceful shutdown", any backend `*.js`/`*.ts` with `http`/`express`. Pairs with typescript (typed Node), api-design (the contract), security-web (server hardening), observability (logging/metrics), performance (profiling).
kouroshez/coding-os · ★ 6 · API & Backend · score 77
Install: claude install-skill kouroshez/coding-os
# Node.js Backend Node runs your JavaScript on **one** thread with an event loop. It scales by never blocking that thread — every CPU-bound or sync call freezes *all* requests. The craft is async-correct code, streaming over buffering, and a clean process lifecycle. > Audit a package.json for engine pin, lockfile, and risky scripts: > `python3 scripts/check_package.py package.json` ## Never block the event loop ```javascript // Wrong — sync read blocks EVERY in-flight request until the file loads import { readFileSync } from "node:fs"; app.get("/data", (req, res) => res.send(readFileSync("big.json"))); // Correct — async yields the loop while I/O happens import { readFile } from "node:fs/promises"; app.get("/data", async (req, res) => res.send(await readFile("big.json"))); ``` `*Sync` calls, `JSON.parse` of a huge string, a tight `for` over a million items, synchronous crypto/zlib — all freeze the loop and tank p99 for every concurrent request. For genuine CPU work (image resize, hashing), offload to a Worker Thread or a separate service; don't compute it inline. Detail → [references/event-loop.md](references/event-loop.md). ## Async errors must be caught — or the process dies ```javascript // Wrong — a rejected promise in a handler with no catch → unhandledRejection app.get("/x", async (req, res) => { const u = await db.get(); res.json(u); }); // (if db.get rejects, Express 4 doesn't catch async throws → hangs or crashes) // Correct — wrap, or use a framework that a