Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)41k · #6714

nodejs-backend-patterns

Skill này làm gì

Hướng dẫn này giúp xây dựng các dịch vụ internet (backend) bằng Node.js. Nó dạy cách tổ chức code, xử lý lỗi, bảo mật truy cập và kết nối tới cơ sở dữ liệu.

Khi nào nên dùng

  • ✓Khi bạn xây dựng website hoặc ứng dụng cần một máy chủ.
  • ✓Khi bạn phát triển API để các chương trình khác sử dụng.
  • ✓Khi bạn tạo hệ thống cần giao tiếp thời gian thực.

Liên kết skill

https://github.com/wshobson/agents/blob/main/plugins/javascript-typescript/skills/nodejs-backend-patterns/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/wshobson/agents/blob/main/plugins/javascript-typescript/skills/nodejs-backend-patterns/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Làm sao để xây dựng máy chủ Node.js an toàn cho cửa hàng trực tuyến của tôi?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Hướng dẫn giải thích các mẫu tổ chức code và thực hành tốt nhất. Điều này bao gồm cách xử lý các yêu cầu đến, các lỗi có thể xảy ra, và đảm bảo chỉ người dùng được ủy quyền mới truy cập được các phần nhất định.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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

  1. Use TypeScript: Type safety prevents runtime errors
  2. Implement proper error handling: Use custom error classes
  3. Validate input: Use libraries like Zod or Joi
  4. Use environment variables: Never hardcode secrets
  5. Implement logging: Use structured logging (Pino, Winston)
  6. Add rate limiting: Prevent abuse
  7. Use HTTPS: Always in production
  8. Implement CORS properly: Don't use * in production
  9. Use dependency injection: Easier testing and maintenance
  10. Write tests: Unit, integration, and E2E tests
  11. Handle graceful shutdown: Clean up resources
  12. Use connection pooling: For databases
  13. Implement health checks: For monitoring
  14. Use compression: Reduce response size
  15. Monitor performance: Use APM tools

Testing Patterns

See javascript-testing-patterns skill for comprehensive testing guidance.

Câu hỏi thường gặp

“Middleware” là gì?

Middleware giống như “người gác cổng” hoặc “bộ xử lý” kiểm tra hoặc thay đổi các yêu cầu gửi tới máy chủ trước khi chúng đến hàm chính của bạn.

Tại sao nên dùng TypeScript?

TypeScript giúp ngăn các lỗi thường gặp bằng cách kiểm tra kiểu dữ liệu trước khi chương trình chạy, làm code đáng tin cậy hơn.

“Thực hành tốt nhất” là gì?

Đó là những cách làm tốt nhất đã được biết đến để thực hiện một việc, giúp code an toàn hơn, dễ hiểu hơn và dễ bảo trì trong tương lai.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
41k
Vị trí xếp hạng
#6714
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự