A Custom Type is an element of the dynamic data model of a Structr application.

Custom types can be created and configured using the Schema Editor. A custom type has a set of default properties (depending on its Base Type), and can have zero or more dynamic properties of various types. The data model supports simple inheritance, so custom types can extend other custom types to share common properties and methods.

A Simple Data Model

Fig. 1: A base type (User) and two custom types

Remote Attributes

Custom types can be linked to other types, including base types, which can be seen in the above screenshot. Structr will automatically create Remote Attributes on either side of the link, which can then be used to create, update or remove the relationships between instances of the two types.


The properties of a custom type can be combined into named Views, which are accessible under an individual REST URL. Access to these URLs can be configured independently for each HTTP method using Resource Access Grants, which makes them an ideal tool to create specialized endpoints for different client applications (e.g. mobile clients etc.).

Business Logic

Custom types can be extended with scripted business logic, either through the standard Callback Methods, or through Custom Schema Methods. Custom schema methods can be executed from Web Frontend using Action Buttons.

Virtual Types

Custom types and their properties can be mapped and transformed to better support integration with external systems. See Virtual Types for more information about that.

Database Structure

The underlying database structure consists of five types: SchemaNode, SchemaRelationshipNode, SchemaProperty, SchemaView and SchemaMethod. Each custom type is represented by a SchemaNode instance. It can have relationships to other schema nodes via the SchemaRelationshipNode type.

The attributes of a custom type are represented by instances of SchemaProperty, which are linked to the schema node. Views are represented by SchemaView instances, and methods are likewise represented by SchemaMethod instances. Since Structr creates REST resources for all of its known types, schema nodes and all other schema-related types can be managed via REST.

Global Schema Methods

SchemaMethod instances that are not connected to a SchemaNode can be used to provide reusable functions. See the call() function for more information about that.


About this article
Last change 2017-05-04
Topics Structr 2.0