# Add data stores to services

Copy as Markdown[View as Markdown](/docs/development/guides/resources/services/add-resources-to-services/add-data-stores-to-services.md)

***

In EventCatalog a [data store](/docs/development/guides/resources/data/introduction.md) is a persistent storage system (e.g database, cache, index) that holds information used by one or resources.

Your service can **read** and/or **write** to any data store documented in your catalog.

## Specifying read/write relationships[​](#specifying-readwrite-relationships "Direct link to Specifying read/write relationships")

To document the read/write relationship from a service to a data store you use the **writesTo** or **readsFrom** array within your service frontmatter API.

In the example below the `OrderService` writes to the `OrdersDatabase` and reads from the `ProductRedisCache`.

/services/Orders/index.mdx (example)

```
---
id: OrderService
... # other service frontmatter
writesTo:
    # id of the data store this service writes to
    - id: OrdersDatabase
readsFrom:
    # id of the data store this service reads from
    - id: ProductRedisCache
      # optional version of the data store if none provided latest will be used
      # also supports sever matching (0.x.x)
      version: 0.0.1
---
```

You can choose not to provide a version for a data store. If no version is given **latest** is used by default.

### Visualizing data stores within a service[​](#visualizing-data-stores-within-a-service "Direct link to Visualizing data stores within a service")

When your service reads/writes to a data store, EventCatalog will visualize this relationship [(see example)](https://demo.eventcatalog.dev/visualiser/services/OrdersService/0.0.3)

![Example](/assets/images/visualiser-with-data-16a711072efee53b2480d1a2153aa450.png)
