> For the complete documentation index, see [llms.txt](https://docs.hormo.studio/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hormo.studio/models/relations.md).

# Relations

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

![](https://1434969913-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lz6ftDBTtRLCbMQB7xS%2F-Lz72H37CU1js7uzKXbW%2F-Lz79H_glw47h_mpc9oL%2Fassets--LLJWqvJtjL4p5b0wMai--LLWYNmAO3uE6uMriRUM--LLWZGeFSlG5kAwBFwiq-Screen%20Shot%202018-09-04%20at%203.02.23%20AM.png?alt=media\&token=b4f01609-8dbb-418c-a3d8-78e81fe759ba)

| 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="/pages/-Lz7-hWbuZz4HAVvUyuY" %}
[Built-in User model](/models/built-in-user-model.md)
{% endcontent-ref %}
