nodejs-backend-patterns
by wshobsonComprehensive patterns and best practices for building scalable Node.js backend services with Express or Fastify. Covers middleware, error handling, authentication, database integration, and API design for REST, GraphQL, and microservices.
Overview
What is nodejs-backend-patterns?
nodejs-backend-patterns provides a curated set of patterns, best practices, and code examples for building scalable, maintainable Node.js backend services. It focuses on using Express.js and Fastify to create REST APIs, GraphQL servers, and microservices, with guidance on middleware, error handling, authentication, and database integration.
Who Should Use This Skill?
- Backend developers building Node.js APIs or microservices
- Teams standardizing backend architecture and workflows
- Projects requiring robust authentication, authorization, and database access
- Anyone seeking production-ready Node.js backend patterns
Problems Solved
- Reduces boilerplate and setup time for new Node.js backend projects
- Standardizes middleware, error handling, and security practices
- Offers clear examples for integrating SQL/NoSQL databases
- Helps implement authentication, authorization, and background jobs
How to Use
Installation Steps
-
Add the skill to your agent or project:
npx skills add https://github.com/wshobson/agents --skill nodejs-backend-patterns -
Review the main documentation files:
SKILL.mdfor a high-level overview and usage scenariosreferences/advanced-patterns.mdfor advanced topics like dependency injection, database integration, and authentication
Core Concepts and Patterns
- Express.js and Fastify Setup: Learn minimalist and high-performance approaches for API servers.
- Middleware and Error Handling: Implement security, logging, and robust error management.
- Authentication & Authorization: Integrate authentication flows and secure your endpoints.
- Database Integration: Connect to SQL (e.g., PostgreSQL) or NoSQL databases with best practices.
- Scalable Architecture: Structure your code for maintainability and future growth.
Adapting to Your Project
- Use the provided patterns as a reference and adapt them to your repository, framework, and infrastructure needs.
- Explore the
references/folder for advanced examples, such as dependency injection containers and service registration.
FAQ
When should I use nodejs-backend-patterns?
Use this skill when starting a new Node.js backend, refactoring an existing API, or standardizing backend practices across a team. It's especially useful for REST APIs, GraphQL servers, and microservices.
Does it support both Express and Fastify?
Yes. The skill provides setup and usage patterns for both Express.js (minimalist, flexible) and Fastify (high-performance, modern) frameworks.
What about authentication and database integration?
nodejs-backend-patterns includes guidance and code examples for implementing authentication, authorization, and integrating with SQL/NoSQL databases. See references/advanced-patterns.md for advanced topics.
Where can I find advanced patterns and examples?
Check the references/advanced-patterns.md file for topics like dependency injection, service registration, and advanced API response formatting.
How do I explore all available resources?
Open the Files tab in the skill directory to browse all documentation, references, and helper scripts.
