Collections & Data Modeling
Model your platform's data with collections, properties, and entities.
Concepts
- Collection: a type of record in your platform — for example, "Articles", "Customers", or "Events". A collection defines the shape of its records.
- Property: a single field on a collection, such as a title, a date, or an image. Each property has a name and a type.
- Entity: an individual record that belongs to a collection. If "Articles" is the collection, each article is an entity.
Open Collections from your project's side menu to get started.
Creating a Collection
- Go to Collections.
- Click Add, enter a name, and click Create.
- The new collection opens so you can define its properties.
Every new collection starts with a required Name property of type Text Input. It identifies each entity, so it can't be renamed, changed, or removed.
Defining Properties
Inside a collection you build its list of properties. Click Add Field to add a property, then set:
- Property Name: how the field is labelled.
- Type: the kind of value the field holds (see below).
- Required: whether a value must be provided.
- Regex Pattern: an optional regular expression the value must match.
- Repeats: how many values the property can hold.
1means a single value,0means unlimited. New properties start at1.
Nothing is stored until you click Save. Cancel leaves the collection without keeping your changes.
Property Types
The builder offers the following field types:
| Type | Use for |
|---|---|
| Text Input | Short single-line text |
| Text Area | Longer multi-line text |
| Number | Numeric values |
| Toggle | An on/off switch |
| Checkbox | A boolean check |
| Select | One choice from a set of options |
| Multi-Select | Several choices from a set of options |
| Date | A calendar date |
| An email address | |
| Phone Number | A phone number |
| Address | A postal address |
| Address (with Country) | A postal address including a country |
| Color | A color value |
| Image | An uploaded image |
| File | An uploaded file |
Select and Multi-Select properties draw their options from the entities of a collection, so you can link records together. When you pick one of these types, a second list appears under the type to choose the linked collection. The first collection in that list is linked automatically until you pick another.
Adding Entities
Once a collection's properties are defined, you can add records:
- Click Entities next to the collection in Collections, or open the collection and click View entities.
- Click Add, enter a name, and click Create. The new entity opens.
- Fill in the fields according to the collection's properties and click Save.
If you make a property required after entities already exist, any entity with no value for it is marked with an icon that reads "Does not match collection schema" so you can update it.
Using the CLI
An agent or script can model the same data without opening the builder:
devour syncwrites the project'scollectionsinto the configuration file, each with itspropertiesandentities.devour setup --config <file>applies them. It creates collections that are new in the file, updates the properties of existing ones, and deletes collections that exist only on the server after asking you (--yesskips the question). Deleting a collection that still holds entities also requires--allow-data-loss.- Entities in the file are seed data. An entity whose name already exists in the
collection is left as it is, so
setupnever overwrites live data.
See the CLI Reference for every option.