Data model

The Data model is the foundation of a solution. It contains a definition of how your data is structured and how it is connected. The data model is shared across all apps and services in a solution. A data model is made up of object classes and enumerated types (enums).

If you are new to the concepts of data modeling we recommend reading Data modeling 101.

An object class is a structured definition of a single business object. Often, this data is reflected in the real world somehow. If you have worked with a spreadsheet in Microsoft Excel this will be familiar. For example you might have a sheet for registering employees called Employees. In the sheet there are columns with the headers Employee Number, Firstname, Lastname, Department, Employed Date, Email Address. For each cell you can format what type of data it should contain, for example text (string), a date, or a number (integer).

To represent this structure in the data model you would create an object class Employee. You would then add object class properties for each column (Employee Number, Firstname, etc). Within an app you can create and modify Employee objects based on this definition and store them in the database. Objects represent the rows in your spreadsheet.

pageObject classes

An enum is a set of key-value pairs used to define constant values in a solution. Continuing the example above, you might create an enum called Departments to store the names of the different departments in the company. You can add this enum as an object class property and restrict the possible departments an Employee object can have to those you have defined.

pageEnumerated types

To expose an object class or enum to an app or service, it must be added as a data source. This approach allows you to create different views into your data by creating apps tailored to different roles and use cases. You can also read and manipulate data using GraphQL.

Data model designer

The data model designer is a visual tool to define and view your object classes. You can choose between a list view of your object classes or an entity-relationship diagram that visualizes how your object classes are related. To see the enums in your solution, you need to use the table view.

In the table view you can expand and collapse the object classes to view and add properties.

In the diagram view, you can drag and drop the object classes around the canvas. You can expand and collapse each object class to show or hide the properties. When expanded, tags are represented by a colored line at the bottom. The lines between the object classes indicate that they are connected with reference properties.


You can label object classes with tags and quickly filter by those tags to see a subset of your data model. This can be helpful as your solution grows and you have data which are only used by some or one of your apps. You can tag both object classes and enums.

To add a new tag to your data model:

  • Click the tags icon at the top of the data model designer.

  • Click Create new tag.

  • Enter a Tag name and select a color to represent the tag.

  • Click Add tag.

Filtering the Global Data Model

In the top section of the Global Data Model, you may filter the Object Classes - both from the diagram view and list view. You may filter by Tags, or choose to se the Data Model just for a single App or Service by selecting an App or Service in the App Scoped Data Model or Service Scoped Data Model, as seen below.

Note that downloading Apps from the Farmers Market, some of these Apps comes with a Scoped Data Model. A Scoped Data Model contains Object Classes that only exists in that App. Once the App is deleted, so are the Scoped Object Classes. A Scoped Object Class may be turned into a Global Object Class in order for other Apps to use these Object Classes as well.


The Appfarm platform has built-in support for querying your data through GraphQL. GraphQL can be used as a developer tool to view and modify data in your solution, as well as a method for exposing your data model to external parties for integration.

To access the GraphiQL IDE for your environments:

  • Click Explore GraphQL in the toolbar.

  • Click the relevant button for the environment you wish to access and the GraphiQL will open in a new tab.


Last updated