技能 nodejs-backend-patterns
📦

nodejs-backend-patterns

安全

Build Production-Ready Node.js Backend Services

也可從以下取得: wshobson

Creating robust Node.js backends requires understanding complex architectural patterns and best practices. This skill provides comprehensive guidance for building scalable, secure backend services with modern frameworks.

支援: Claude Codex Code(CC)
🥉 74 青銅
1

下載技能 ZIP

2

在 Claude 中上傳

前往 設定 → 功能 → 技能 → 上傳技能

3

開啟並開始使用

測試它

正在使用「nodejs-backend-patterns」。 How do I set up rate limiting for my Express API?

預期結果:

Use express-rate-limit with Redis for distributed rate limiting. Configure separate limits for general API endpoints and authentication endpoints. Example: apiLimiter allows 100 requests per 15 minutes, while authLimiter allows 5 requests per 15 minutes with stricter enforcement.

正在使用「nodejs-backend-patterns」。 What is the proper way to handle errors in Express?

預期結果:

Create custom error classes extending Error for different error types (ValidationError, NotFoundError, UnauthorizedError). Implement a global error handler middleware that logs errors and returns appropriate HTTP status codes without exposing internal details in production.

安全審計

安全
v1 • 2/24/2026

This is an educational/documentation skill providing Node.js backend development guidance through markdown code examples. All static analysis findings are false positives - the detected patterns are instructional code samples in markdown format, not executable skill logic. No actual security risks detected.

2
已掃描檔案
1,058
分析行數
0
發現項
1
審計總數
未發現安全問題
審計者: claude

品質評分

38
架構
100
可維護性
87
內容
50
社群
100
安全
91
規範符合性

你能建構什麼

API Development

Build REST or GraphQL APIs with proper middleware, validation, and error handling for production applications.

Microservices Architecture

Design scalable microservices with dependency injection, proper logging, and inter-service communication patterns.

Learning Modern Node.js

Learn industry-standard patterns for authentication, database access, caching, and error handling in Node.js applications.

試試這些提示

Basic Express Setup
Help me create a basic Express.js server with security middleware, request logging, and error handling. Include TypeScript types and proper configuration.
Authentication System
Design a JWT-based authentication system with login, registration, and token refresh endpoints. Include password hashing with bcrypt and proper error handling.
Database Layer Design
Create a repository pattern implementation for PostgreSQL with connection pooling, parameterized queries, and transaction support for an order management system.
Complete Microservice
Design a complete microservice architecture with Fastify, including dependency injection, health checks, metrics endpoints, and graceful shutdown handling.

最佳實務

  • Always use TypeScript for type safety and better IDE support
  • Validate all user input with libraries like Zod before processing
  • Use environment variables for configuration and never commit secrets to version control

避免

  • Using wildcard CORS origins in production environments
  • Storing sensitive data like passwords or tokens in plain text
  • Blocking the event loop with synchronous operations or complex calculations

常見問題

Should I use Express or Fastify for my project?
Express has a larger ecosystem and is well-established. Fastify offers better performance with built-in schema validation. Choose Express for maximum compatibility or Fastify for high-throughput APIs.
How do I handle database migrations in Node.js?
Use migration tools like Knex, Prisma, or typeorm. Define migrations as version-controlled files that can be applied or rolled back. Run migrations during deployment before starting the application.
What is the recommended project structure for Node.js APIs?
Use layered architecture: controllers handle HTTP requests, services contain business logic, repositories manage data access. Keep configuration, middleware, types, and utilities in separate directories.
How should I implement authentication in Node.js?
Use JWT for stateless authentication with short-lived access tokens and longer-lived refresh tokens. Hash passwords with bcrypt or argon2. Store secrets in environment variables and rotate them regularly.
What logging approach should I use in production?
Use structured logging with Pino or Winston. Include correlation IDs for tracing requests across services. Log to stdout and aggregate logs with tools like ELK stack or cloud logging services.
How do I ensure my Node.js API can handle high traffic?
Implement connection pooling for databases, add caching with Redis, use compression for responses, enable clustering to use all CPU cores, and implement proper rate limiting to prevent abuse.