backend-service-patterns

Implements layered backend architectures with dependency injection, middleware, and service patterns in TypeScript.

3|Updated Aug 26, 2026
One-click install
npx skills add https://github.com/Fabric-Pro/fabric-oss --skill backend-service-patterns-fabric-pro
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: backend-service-patterns
Source: https://github.com/Fabric-Pro/fabric-oss/tree/main/.cursor/skills/backend-service-patterns
Command: npx skills add https://github.com/Fabric-Pro/fabric-oss --skill backend-service-patterns-fabric-pro

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Backend codebases often become tangled when business logic, data access, and HTTP handling are mixed together, making services hard to test, scale, and maintain. This Skill provides concrete architectural patterns and TypeScript code templates for structuring server applications with clear separation of concerns. ## Core Features & Use Cases - Layered Architecture Templates: Ready-to-use route, controller, service, and repository layer implementations with dependency injection for testability. - Design Pattern Library: Repository, Factory, Strategy, Observer, and Circuit Breaker patterns with working TypeScript examples. - Microservices & Serverless Guidance: API gateway setup, message queue communication with BullMQ, cold start optimization, and background job processing. - Use Case: When building a new Express API for order processing, apply the controller-service-repository structure, queue payment jobs with BullMQ, and wrap external payment calls in a circuit breaker to prevent cascading failures. ## Quick Start Ask the AI to scaffold a user service using the layered architecture pattern with dependency injection and a repository for data access.

Frequently Asked Questions about backend-service-patterns

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

FAQPage Schema
How do I structure a Node.js backend with layered architecture?▼

Separate code into routes, controllers, services, and repositories. Routes define endpoints, controllers handle request/response, services contain business logic, and repositories abstract data access with Prisma or another ORM.

How to implement dependency injection in TypeScript services?▼

Use constructor injection by passing dependencies like repositories and services as constructor parameters. This makes classes easy to mock in unit tests and decouples implementations from their consumers.

What is the circuit breaker pattern in microservices?▼

The circuit breaker pattern prevents cascading failures by stopping calls to a failing external service after an error threshold is reached. Libraries like opossum wrap the call, provide fallback responses, and retry after a reset timeout.

How do I process background jobs with BullMQ and Redis?▼

Create a Queue to add jobs with retry and backoff options, then run a Worker that consumes jobs with configurable concurrency. BullMQ also supports scheduled recurring jobs using cron expressions.

When should I use the repository pattern over direct ORM calls?▼

Use the repository pattern when you need to swap data sources, centralize query logic, or mock data access in tests. For simple CRUD apps with a single database, direct ORM calls may be sufficient.