---
# System prepended metadata

title: Protocols

---

# Protocols

## Protocol Example

Every protocol document has a few basic keys to make note of:

- `labels` - Defines all the data types used in your document
- `records` - Used as a catch-all to define a list of properties
- `allow` - The key word used to denote the start of a permission definition

These terms are combined in a human-readable way to define both the data schema and permissions of your app.


### Basic Example, Social Network (open to  differnt title here, just like having a change in topic here)
Lets consider if we wanted to build a basic social networking application. In our social network, we want users to be able to post images with captions that can be replied to, as well as messages with replies.

This application has a data design of **two key objects: images and messages**. Images have caption and reply properties, while messages just have a replies property.

### Permissions
Now let’s imagine how we’d construct the permissions for such an app:

- Only the *author* should be able to post an image caption
- Only the *recipient(s)* of a message should be able to reply to it
- Only the *recipient(s)* of an image should be able to reply to it

### Let’s see what our protocol would look like (different title can go here):

[CODE SNIPPET]

*In the `labels` section, we can see how the data schema of each data type is defined (remove this sentence bc that's the definition of labels above).*

*While you’d ideally use a resolvable schema in this property, that is not a requirement.(what is a resolvable schema for folks who don't know this term)*

You’ll then notice how each of those `labels` is used in the large `records` object, which at a top level houses the `message` and `image` data types that we agreed were critical to our social network. *(can you make note of why?)*

Within `message`, you’ll notice we define `allow` permissions to let anyone write a message to anyone, but nest another `records` object to hold the child property of `reply` and define permissions on `reply`. Additionally (maybe say lastly?), you’ll notice the `image` object below it also defines `allow` permissions, along with more child properties and their permissions.

