Skip to content
StackDecode
System Design
15. Software Design PatternsAnimated walkthrough

Service Layer Pattern

A layer that defines the application's operations.

The idea

Services coordinate use cases, transactions and repositories, keeping controllers thin.

Watch it work

The steps light up one at a time. Use the controls to pause or step through.

  1. 1Controller receives the request
  2. 2Calls a service method
  3. 3Service coordinates repositories
  4. 4Returns the result
1/4

Step by step

  1. 1Controller receives the request
  2. 2Calls a service method
  3. 3Service coordinates repositories
  4. 4Returns the result

Where it is used

Business applications.

Watch out for

Anaemic services that only forward calls.

Related