nodejs-best-practices

Guides Node.js framework selection, async patterns, security, and architecture decisions.

2|Updated May 30, 2026
One-click install
npx skills add https://github.com/virahitvin8/crafty-gis --skill nodejs-best-practices-virahitvin8
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nodejs-best-practices
Source: https://github.com/virahitvin8/crafty-gis/tree/main/GIT_STAR/.agent/skills/nodejs-best-practices
Command: npx skills add https://github.com/virahitvin8/crafty-gis --skill nodejs-best-practices-virahitvin8

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Choosing the right Node.js framework, async pattern, and architecture for each project is error-prone when developers default to familiar tools instead of context-driven decisions. This Skill provides decision-making principles for building Node.js backends in 2025. ## Core Features & Use Cases - Framework Selection Guidance: Decision trees and comparison tables for Hono, Fastify, Express, and NestJS based on deployment target, cold start needs, and team experience. - Architecture & Error Handling: Layered structure principles (controller/service/repository), centralized error handling, and HTTP status code selection rules. - Security & Validation Checklists: Input validation boundaries, library selection (Zod, Valibot, ArkType), and a security checklist covering hashing, JWT, rate limiting, and CORS. - Use Case: When starting a new serverless API, use this Skill to determine whether Hono fits the edge deployment target, then apply its async and validation principles to structure the codebase. ## Quick Start Ask the AI to help you choose a Node.js framework and architecture for your new backend project using the nodejs-best-practices skill.

Frequently Asked Questions about nodejs-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose between Express, Fastify, and Hono for a Node.js API?

Choose Hono for edge and serverless deployments with fast cold starts, Fastify for high-performance APIs, and Express for legacy projects or maximum ecosystem support. Base the decision on deployment target, cold start requirements, and team experience.

What validation library should I use for Node.js in 2025?

Zod is the default for TypeScript-first projects with type inference, Valibot offers a smaller tree-shakeable bundle, and ArkType targets performance-critical cases. Validate at all boundaries including request bodies, environment variables, and external API responses.

Can Node.js run TypeScript files directly without a build step?

Node.js 22 and later supports running TypeScript files directly using the --experimental-strip-types flag. This works well for scripts and simple APIs, though larger projects may still benefit from a full build pipeline.

When should I use Promise.all versus Promise.allSettled?

Use Promise.all for parallel independent operations where any failure should reject the whole batch. Use Promise.allSettled when some operations can fail without affecting others, since it returns results for both fulfilled and rejected promises.

Why does my Node.js server slow down under CPU-intensive tasks?

CPU-bound work like cryptography or image processing blocks the event loop, and async patterns do not help. Offload such work to worker threads or external services, and never use synchronous methods like fs.readFileSync in production.