Suggest an editImprove this articleRefine the answer for “What is a repository?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)A **Repository** is an interface for accessing domain aggregates or entities that hides the details of data storage and behaves like an "in-memory collection", even though it actually talks to a database or an API. **Key point:** a repository is a bridge between the "clean" domain and the technical world of data storage, supporting the Dependency Inversion principle.Shown above the full answer for quick recall.Answer (EN)ImageA **Repository** is an **interface for accessing domain aggregates or entities** that **hides the details of data storage**. It behaves like an "in-memory collection," but actually talks to a database, an API, and so on. The repository's jobs: 1. **Encapsulate** the logic for loading and saving domain objects. 2. Let the domain work with models without knowing about SQL, an ORM, or files. 3. Support the *Dependency Inversion* principle: the domain depends on the interface, and infrastructure implements it. Example: ```python class OrderRepository: def get_by_id(self, id): ... def save(self, order): ... ``` **The point:** a repository is a bridge between the "clean" domain and the technical world of data storage.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.