nodejs-best-practices

Apply Node.js development principles to guide framework, runtime, and architecture decisions.

Updated Sep 2, 2025
One-click install
npx skills add https://github.com/rafaelminatto1/fisioflow-51658291 --skill nodejs-best-practices-rafaelminatto1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nodejs-best-practices
Source: https://github.com/rafaelminatto1/fisioflow-51658291/tree/main/.agent/skills/nodejs-best-practices
Command: npx skills add https://github.com/rafaelminatto1/fisioflow-51658291 --skill nodejs-best-practices-rafaelminatto1

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Node.js teams often struggle with selecting the right framework, runtimes, and architectural approaches for different contexts. This guide provides decision-making principles that prevent copying patterns and instead teach how to think about trade-offs.

Core Features & Use Cases

  • Framework selection guidance across Edge/Serverless (Hono), High-Performance API (Fastify/NestJS), and traditional Express ecosystems.
  • Runtime & architecture principles, including native TypeScript, module systems (ESM vs CommonJS), and layered architectures to improve testability and maintainability.
  • Security, error handling, and async patterns guidelines to reduce risk and improve resilience.
  • Use Case: A team evaluating whether to adopt an edge deployment with Cloudflare Workers vs a traditional API server, and how to structure the service for maintainability.

Quick Start

Apply these Node.js best-practices to your project by auditing framework choices, runtime patterns, and architectural layering.

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 the right Node.js framework for edge, serverless, or API scenarios?

Choosing a Node.js framework requires evaluating deployment targets: use Hono for edge or serverless, Fastify or NestJS for high-performance APIs, and Express for traditional ecosystems. Context-aware selection ensures optimal runtime performance and maintainability.

What is the best way to structure a Node.js architecture for maintainability?

Layered architecture is the best way to structure Node.js applications for maintainability. By enforcing strict separation of concerns, layered architectures improve testability, reduce coupling, and make codebases easier to reason about across edge and full-stack scenarios.

How do I handle errors and async patterns securely in Node.js?

Handling errors and async patterns securely in Node.js requires robust error handling and security-conscious coding practices. Applying these guidelines reduces risk, improves application resilience, and prevents unhandled promise rejections across serverless and API environments.

Should I use ESM or CommonJS module systems in Node.js?

Deciding between ESM and CommonJS module systems in Node.js depends on your runtime environment and native TypeScript goals. Evaluating module systems prevents copying patterns blindly and ensures compatibility across edge, serverless, and traditional API deployments.

Does this Node.js guidance apply to existing codebases or only new projects?

This Node.js guidance applies to both existing codebases and new projects. It provides decision-making principles to audit framework choices, runtime patterns, and architectural layering, enabling informed refactoring and architecture decisions for current applications.