backend-patterns

Design backend application patterns for Node.js, Express, and Next.js APIs.

Updated May 17, 2022
One-click install
npx skills add https://github.com/kanade0404/dotfiles --skill backend-patterns-kanade0404
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backend-patterns
Source: https://github.com/kanade0404/dotfiles/tree/main/.claude-plugin/skills/backend-patterns
Command: npx skills add https://github.com/kanade0404/dotfiles --skill backend-patterns-kanade0404

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you design and harden server-side applications when APIs, data access, authentication, caching, and background processing need to be structured cleanly and operate reliably.

Core Features & Use Cases

  • API Architecture: Shapes REST and GraphQL endpoints with clear resource boundaries, pagination, filtering, and controller or service separation.
  • Database Performance: Reduces slow queries by encouraging selective reads, batching, transactions, indexing awareness, and N+1 prevention.
  • Operational Resilience: Adds practical patterns for error handling, retries, rate limiting, logging, authorization, and queued background work.
  • Use Case: Use it when building a Next.js API route that needs authentication, validation, cached reads, and safe failure handling without becoming tightly coupled.

Quick Start

Ask for a backend design or refactor plan for your Node.js, Express, or Next.js API and include the endpoint goals, data model, and performance constraints.

Frequently Asked Questions about backend-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure Next.js API routes for authentication and database access without tight coupling?

Structure Next.js API routes by separating controller, service, and repository layers to handle authentication and database access without tight coupling. This pattern ensures maintainable server-side architecture and predictable operational behavior across your endpoints.

What is the best way to prevent N+1 queries and optimize database performance in a Node.js backend?

Prevent N+1 queries and optimize database performance in a Node.js backend by applying selective reads, batching, transactions, and indexing awareness. These patterns reduce slow queries and ensure efficient data access across your application.

How do you implement rate limiting and error handling in Express applications?

Implement rate limiting and error handling in Express applications using middleware patterns that intercept requests to control traffic flow and catch failures. This operational resilience approach provides safe failure handling and predictable server behavior.

Can I apply repository and service patterns to existing Node.js backend projects?

Yes, you can apply repository and service patterns to existing Node.js backend projects to refactor and harden server-side architecture. These patterns structure data access and business logic cleanly for maintainable production applications.

When do I need background job patterns for API design and caching?

You need background job patterns for API design and caching when handling asynchronous tasks like queued work and retries that decouple processing from request cycles. This operational resilience pattern ensures safe failure handling and reliable cached reads.

Why should I use middleware patterns for authorization in Next.js API routes?

Use middleware patterns for authorization in Next.js API routes to intercept requests and enforce access control before reaching business logic. This separation maintains clean architecture boundaries and adds operational resilience for production use.