# Data Rules

{% hint style="success" %}
**Data Rules vs Sync Rules**

Data rules are a combination [sync rules](https://docs.journeyapps.com/reference/build/data-model-configuration/data-rules/sync-rules-v2) and [Access Control Lists](https://docs.journeyapps.com/reference/build/data-model-configuration/data-rules/data-acls-limit-access-to-data) (ACLs), specified in a single XML document. If your app is currently using [sync rules v2](https://docs.journeyapps.com/legacy-docs/sync-rules-v2-legacy-docs), we recommend migrating to data rules. Please see [this guide](https://docs.journeyapps.com/reference/build/data-model-configuration/data-rules/migrate-to-data-rules) which outlines the migration process.
{% endhint %}

{% hint style="warning" %}
**Details matter with data rules**

Data rules is an advanced feature where implementation details can have a significant impact on [app performance](https://docs.journeyapps.com/reference/technical/improving-app-performance), sync performance, as well as the design of your [data model](https://docs.journeyapps.com/reference/get-started/journeyapps-fundamentals/what-is-the-data-model).

*Please be sure to understand the constraints and implications of your data rules before deploying them to an environment with active users.*
{% endhint %}

### Overview

Data rules allow developers to determine programmatically (1) what data should sync to devices for offline access, and (2) what kind of read and write access a user should have to data (applies to online and offline access).&#x20;

To define data rules, you need to understand the concept of data buckets:

{% content-ref url="data-rules/data-buckets" %}
[data-buckets](https://docs.journeyapps.com/reference/build/data-model-configuration/data-rules/data-buckets)
{% endcontent-ref %}

To limit data synched to devices, developers can specify sync rules. Read more about sync rules here:

{% content-ref url="data-rules/sync-rules-v2" %}
[sync-rules-v2](https://docs.journeyapps.com/reference/build/data-model-configuration/data-rules/sync-rules-v2)
{% endcontent-ref %}

To limit user read/write access to data (whether that data is on the user's device or accessed via [`OnlineDB`](https://docs.journeyapps.com/reference/get-started/journeyapps-fundamentals/accessing-the-database#onlinedb)), developers can specify data ACLs. Read more about them here:

{% content-ref url="data-rules/data-acls-limit-access-to-data" %}
[data-acls-limit-access-to-data](https://docs.journeyapps.com/reference/build/data-model-configuration/data-rules/data-acls-limit-access-to-data)
{% endcontent-ref %}

Data rules combine the above two objectives by letting developers specify both sync rules and data ACLs in one XML file, namely `data_rules.xml`, which is available in OXIDE once your app has data rules enabled.&#x20;

![Default data\_rules.xml file](https://2865107717-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9TCHLR67eLHBOjPvHhud%2Fuploads%2F23FbpN8eIwewcNUnolee%2Fdata-rules-oxide.png?alt=media\&token=e26d906b-a67d-40fd-a911-41986f47faf6)
