> For the complete documentation index, see [llms.txt](https://flignats.gitbook.io/full-stack-typescript/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://flignats.gitbook.io/full-stack-typescript/styleguide/single-responsibility-principle.md).

# Single-responsibility principle

The single-responsibility principle (SRP) is a computer programming principle that states that "A module should be responsible to one, and only one, actor."

* [Rule of one](#rule-of-one)

## Rule of one

Apply the [*single responsibility principle (SRP)*](https://wikipedia.org/wiki/Single_responsibility_principle) to all components, services, and other symbols. This helps make the application cleaner, easier to read and maintain, and more testable.

**Do** define one thing, such as a service or component, per file.

The goal is to make the code more reusable, easier to read, and less mistake-prone. As the application grows, this rule becomes even more important.
