The Single Responsibility Principle (SRP) is the first software design principle in the well-known SOLID acronym introduced by Bob Martin. SRP is a guiding principle for designing classes and their corresponding functions so that they change only for one reason. In other words, the functionality of a class should be implemented to satisfy a single actor, as defined in a use case UML diagram.
Similarly, there is another principle called the Common Closure Principle (CCP), which states that classes with similar behavior should be grouped within the same component or package. This principle is clearly reflected in the Java API packages, as well as in other well-structured programming language APIs.
From an architectural point of view, there is also the concept of a Context Boundary, borrowed from Eric Evans’ book Domain-Driven Design (DDD).
Both CCP and Context Boundaries can be seen as higher-level design principles that stem from SRP. Microservices, too, should follow the same guiding principles. That is, a microservice should focus on a narrow subset of a given business domain. In fact, when designing a microservices architecture, we should approach the system from a domain-driven design perspective: first delineating the different context boundaries, and then designing the microservices accordingly.
Therefore, SRP is a principle that applies not only to class-level design but also to the design of microservices architectures.