nodejs-backend-patterns
What it does
This guide helps build internet services (backends) using Node.js. It teaches how to organize code, handle errors, secure access, and connect to databases.
When to use it
- ✓Building a website or app that needs a server.
- ✓Developing an API for other programs to use.
- ✓Creating systems that need real-time communication.
Skill link
https://github.com/wshobson/agents/blob/main/plugins/javascript-typescript/skills/nodejs-backend-patterns/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“How can I build a secure Node.js server for my online store?”
5 new skills a week. 1 minute to read.
How it works
It explains code organization patterns and best practices. This includes how to handle incoming requests, potential errors, and ensure only authorized users access certain parts.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Node.js Backend Patterns
Comprehensive guidance for building scalable, maintainable, and production-ready Node.js backend applications with modern frameworks, architectural patterns, and best practices.
When to Use This Skill
- Building REST APIs or GraphQL servers
- Creating microservices with Node.js
- Implementing authentication and authorization
- Designing scalable backend architectures
- Setting up middleware and error handling
- Integrating databases (SQL and NoSQL)
- Building real-time applications with WebSockets
- Implementing background job processing
Detailed patterns and worked examples
Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.
Best Practices
- Use TypeScript: Type safety prevents runtime errors
- Implement proper error handling: Use custom error classes
- Validate input: Use libraries like Zod or Joi
- Use environment variables: Never hardcode secrets
- Implement logging: Use structured logging (Pino, Winston)
- Add rate limiting: Prevent abuse
- Use HTTPS: Always in production
- Implement CORS properly: Don't use
*in production - Use dependency injection: Easier testing and maintenance
- Write tests: Unit, integration, and E2E tests
- Handle graceful shutdown: Clean up resources
- Use connection pooling: For databases
- Implement health checks: For monitoring
- Use compression: Reduce response size
- Monitor performance: Use APM tools
Testing Patterns
See javascript-testing-patterns skill for comprehensive testing guidance.
FAQ
What is 'middleware'?
Middleware are like 'guards' or 'processors' that check or modify requests coming to the server before they reach your main function.
Why use TypeScript?
TypeScript helps prevent common errors by checking data types before the program runs, making the code more reliable.
What are 'best practices'?
These are the best known ways to do something, which make the code safer, easier to understand, and maintainable in the future.
Details
Original description by the author
Build production-ready Node.js backend services with Express/Fastify, implementing middleware patterns, error handling, authentication, database integration, and API design best practices. Use when creating Node.js servers, REST APIs, GraphQL backends, or microservices architectures.
repo: wshobson/agents
Popularity
- GitHub stars
- 41k
- Ranking position
- #6714
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
screen-reader-testing
41kHas your agent test websites using screen readers to ensure they are accessible.
wcag-audit-patterns
41kHelps your agent audit websites for accessibility and fix issues according to WCAG guidelines.
multi-reviewer-patterns
41kEnables your agent to coordinate parallel code reviews, deduplicating findings and consolidating reports.
parallel-debugging
41kAllows the agent to debug complex issues with parallel investigations and root cause analysis.
Similar skills
api-connector-builder
280kHas your agent build new API connections following the existing pattern. Use when you need to add one more integration without creating a new way of doing things.
api-design
280kHelps your agent design REST APIs following best practices. It's useful for defining how APIs communicate, how errors are shown, and how to organize data.
backend-patterns
280kHelps your agent with server-side architecture patterns and database optimization. It's useful for building or reviewing code that runs on the server.