# Relations

The `relations` key defines relationships between models. Haska managing relations in you back-end services by set options as relations configs easily as below:

![](https://4224935670-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLJWqvJtjL4p5b0wMai%2F-LLWYNmAO3uE6uMriRUM%2F-LLWZGeFSlG5kAwBFwiq%2FScreen%20Shot%202018-09-04%20at%203.02.23%20AM.png?alt=media\&token=abeb8c73-cc2d-4a5a-897a-45206a8cd55d)

| Key        | Type            | Description                                                                                                         |
| ---------- | --------------- | ------------------------------------------------------------------------------------------------------------------- |
| foreignKey | String          | Optional foreign key used to find related model instances.                                                          |
| ref(model) | String          | Name of the related model. Required.                                                                                |
| type       | String          | <p>Relation type. Required. </p><p><strong>hasMany</strong></p><p><strong>hasManyThrough and belongsTo</strong></p> |
| Filter     | Object/Function | You can filter a relationship field using the filters option. `{ "type": "user" }`                                  |

{% content-ref url="../database" %}
[database](https://hormo.gitbook.io/docs/database)
{% endcontent-ref %}
