node-backend-setup
/node-backend-setup
Bootstrap a Node.js backend with ESM, typed config, graceful shutdown, and structured logging from the start. Use when starting a Node service or hardening one that grew without foundations.
- Author
- Amey-Thakur ↗
- Repository
- AI-SKILLS ↗
- Licence
- MIT
- Last repository change
- 05.09.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 05.09.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Bootstrap a Node.js backend with ESM, typed config, graceful shutdown, and structured logging from the start. Use when starting a Node service or hardening one that grew without foundations.
Original author description
Bootstrap a Node.js backend with ESM, typed config, graceful shutdown, and structured logging from the start. Use when starting a Node service or hardening one that grew without foundations.
How it works
- Method
- Boundaries
SKILL.md preview
--- name: node-backend-setup description: Bootstrap a Node.js backend with ESM, typed config, graceful shutdown, and structured logging from the start. Use when starting a Node service or hardening one that grew without foundations. --- # Node backend setup A Node backend that starts as a quick `index.js` and grows accretes the same missing foundations every time: no config discipline, no graceful shutdown, console.log everywhere. Putting the foundations in at the start costs an hour and saves a rewrite. ## Method 1. **Start with ESM and TypeScript.** `"type": "module"`, a tsconfig targeting your Node version (see tsconfig-mastery), and a runner (`tsx`/`ts-node` for dev, compiled output or a bundler like `tsup` for prod). Modern Node runs TypeScript-adjacent setups cleanly; pick one and stay consistent to avoid the module-resolution pain (see js-modules). 2. **Load and validate config once, typed.** Read environment variables at startup into a validated, typed config object (a schema validator: zod/envalid), failing fast with a clear message if a required var is missing or malformed (see environment-config, request-validation). No `process.env.FOO` scattered through the code; one config module every file imports. 3. **Implement graceful shutdown from day one.** Trap `SIGTERM`/`SIGINT`: stop accepting new connections, finish in-flight requests, close the DB pool and other resources, then exit; with a timeout that forces exit if drain hangs (see graceful-shutdown). Every deploy and scale-in sends SIGTERM; without this, each one drops requests. 4. **Use structured logging, not console.log.** A logger (pino/winston) emitting JSON with levels, a request/correlation id, and no secrets (see structured-logging, log-levels). `console.log` gives you unsearchable, unleveled noise the moment the service sees real traffic. 5. **Add health and readiness endpoints.** A liveness check (process is up) and a readiness check (dependencies reachable) so orchestrators route and restart correctly (see health-checks); the difference matters the first time a dependency blips. 6. **Handle the process-level failures.** Register `unhandledRejection` and `uncaughtException` handlers that log and exit cleanly (a crashed process is better than a zombie in a bad state; let the orchestrator restart it), and never leave them unset (see js-error-handling). ## Boundaries - This is the service skeleton; the framework choice (Express, Fastify, Hono, Nest) and the API design sit on top (see rest-endpoint-design, api-design). Pick the framework for the project, but the foundations above are framework-independent. - Clustering and multi-core scaling (Node uses one core per process) is a deployment decision (a process manager or the orchestrator running N replicas), usually better than the in-process `cluster` module. - Long CPU-bound work blocks the event loop and belongs in worker threads or a separate service, not the request path (see js-event-loop).
Versions
The database has no other skills named node-backend-setup.
Database snapshot: 13.11.2026 · package version a91b300106ba (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100nodejs-service-foundations
Use when asked to set up or harden Node.js service foundations: env validation, logging, typed errors, type stripping, and shutdown wiring. Not for dedicated shutdown: use nodejs-graceful-shutdown. - 90nodejs-service-foundations
Use when asked to set up or harden Node.js service foundations: env validation, logging, typed errors, type stripping, and shutdown wiring. Not for dedicated shutdown: use nodejs-graceful-shutdown. - 100backend-patterns
Node.js/TypeScript server structure - handler/service/repository layers, edge validation, typed errors and a central handler, auth boundaries, data access (N+1, transactions, pooling), caching, durable jobs, outbound timeouts and retries, logging and graceful shutdown. Use when… - 100spine-service
Build a new production-ready service from scratch — config management, health checks, graceful shutdown, structured logging. Use when asked to "new service", "scaffold a backend", "bootstrap service", or "create microservice". - 95hono-ts-backend
Hono + TypeScript backend — best practices and scaffolding a new service (the **TypeScript / Node backend path**). Use when building or reviewing Hono TS APIs, or scaffolding a new **TypeScript / Node / all-TS** backend service: "new backend service", "scaffold a service",… - 100node-backend
Build and upgrade Node.js HTTP services with typed validation, lifecycle ownership and production behavior. Use when implementing Hono, Fastify, NestJS or another established Node server; use node-modern for runtime I/O details and preserve the chosen framework.