# Adding services to domains

Copy as Markdown[View as Markdown](/docs/development/guides/domains/creating-domains/adding-services-to-domains.md)

***

Adding [services](/docs/development/guides/services/introduction.md) to your domains is a great way to group services within a particular domain.

When adding services to your domain EventCatalog will:

* Show the services in the domain sidebar
* Visualize all the services within that domain using the visualizer

## Adding services using frontmatter[​](#adding-services-using-frontmatter "Direct link to Adding services using frontmatter")

To add services within a domain you need to add them to the `services` array within your domain frontmatter API.

/domains/Orders/index.mdx (example)

```
---
id: PaymentDomain
... # other domain frontmatter
services:
    # id of the service you want to add
    - id: PaymentsService
    # (optional) The version of the service you want to add.
      version: 0.0.1

    # Note: version is optional. If no version is given the latest version of the service will be used.
    - id: NotificationsService
---

<!-- Markdown content... -->
```

The `services` frontmatter in your domain tells EventCatalog that these documented services belong to this domain.

In the example above we can see that the services `PaymentsService` and `NotificationsService` belong to the `PaymentDomain`.

### Using semver versioning[​](#using-semver-versioning "Direct link to Using semver versioning")

**Added in** `eventcatalog@2.4.0`

You can also use semver to match the version of the service you want to add.

Example of using semver versioning

/domains/Orders/index.mdx (example)

```
---
id: PaymentDomain
... # other domain frontmatter
services:
  # Latest minor version of PaymentsService will be added
  - id: PaymentsService
    version: 0.x.1
  # Minor and patches of this version will be linked
  - id: NotificationsService
    version: ^1.0.1
  # Latest version of this service will be shown by default.
  - id: PaymentsService
---

<!-- Markdown contents... -->
```

Although it's recommended to link to a version of a service it is now optional. If no version is given **latest** is used by default.

### Visualizing services within a domain[​](#visualizing-services-within-a-domain "Direct link to Visualizing services within a domain")

When you view your domain in EventCatalog, the services will be visualized for you.

![Example](/assets/images/visualiser-175c769dabf86629a16596eb4538882e.png)

## Making changes and versioning[​](#making-changes-and-versioning "Direct link to Making changes and versioning")

You can make as many changes as you want, but if you are adding/removing services you may want to consider versioning your domain. This allows you to keep historic changes, and let others understand why services are coming in/out of a particular domain.
