What are Mappers and where do they belong?

Updated Apr 28, 2026

Short answer

Mappers translate data between different representations (e.g., Entity to DTO, DB Row to Entity) and belong in the Interface Adapter layer.

Deep explanation

Mappers isolate the internal domain models from external changes. There are usually two types: 1. Persistence Mappers (Entity <-> DB Row). 2. Presentation Mappers (Entity <-> DTO/View Model). By using Mappers, we ensure that if a database column name changes, only the Mapper needs an update.

Real-world example

Mapping a snake_case database row to a camelCase JavaScript object.

Common mistakes

  • Using the same class for both a database model and a business entity.

Follow-up questions

  • Does using Mappers cause code duplication?

More Clean Architecture interview questions

View all →