u/Informal_External_55

Repositories vs Gateways

I've been studying different architectures like Clean Architecture & Hexagonal Architecture. I noticed that use cases define gateways for data access. This helps separate implementation details from business logic. However, in clean architecture codebases I've found in Github, most data access seems defined by Repositories, which usually live within the Domain. I understand that this seems to be related to Domain Driven Design principles, but I'm just wanting some guidance on the similarities or differences between the two.

In, DDD, do repositories represent data access interfaces, or am I mistaken. Can a CA codebase utilize both Gateways and Repositories?

See the following screenshots from the book for reference.

https://preview.redd.it/l6yozt6bp0wg1.jpg?width=3024&format=pjpg&auto=webp&s=11efe27b5468ad78dafb6d5a271bd0739cb9d494

https://preview.redd.it/j4kcm250p0wg1.jpg?width=3024&format=pjpg&auto=webp&s=feab2d260e33d30cb83ced888891a45c2b998a02

reddit.com
u/Informal_External_55 — 3 days ago