Skip to main content


Models are just plain objects, without any specific built-in logic. Harmony doesn't provide a base model, as this is something delegated to every project.

The domain layer must contain its own models, that are decoupled from the framework and from the data layer.

Typically, a model would be something like:

data class User(val id: Int, val name: String) 

Why a domain model?

After several years developing backends, web apps and native apps, we have seen that there different type of models depending on the layer you operate.

On the domain layer, models tend to be immutable and are object representations of the information carried out by the different use cases. Quite often, these structures differ from the model of the data layer.

For example, data layer models may include meaningful attributes as created_at or updated_at, used in the data business logic, but useless at a domain (use case) logic. Therefore, domain's model objects would not include such attributes.