Configurable headless CMS for complex content structures.
npm install
in the repo directory.env
. Use the .env.example
file as a template: cp .env.example .env
and
enter configuration details.npm run db migrate
tailor.config.js.example
into tailor.config.js.
. For more details about the custom schema configuration
please refer to this guide.npm run add:admin <email> <password>
.brandrc.js
.
Use the .brandrc.js.example
file as a template: cp .brandrc.js.example .brandrc.js
and enter configuration details (Optional).npm run dev:server
npm run dev:client
This project uses a monorepo setup. In order to contribute to packages following commands should be executed:
npm run packages:setup
- initial setup, dependency installation, package linking, etc. This command should be executed only a single time. npm run packages:build
- build all packages. Run this command after altering the package's code.npm run packages:build --package=<package-name>
to build only specified package. For example: npm run packages:build --package=core-components
.npm run build
npm run start
Repository structure can be altered using tailor configuration file, which must be placed inside the root
directory and named tailor.config.js
.
Use the tailor.config.js.example
file as a template:
$ cp tailor.config.js.example tailor.config.js
and enter the configuration details. At the current time, it is not possible to override the filename or location of the configuration file.
Content repository structures are defined using the following properties:
SCHEMAS
An array of Schema objects.
String
- Schema identifier.String
- Schema display name.String
- Workflow identifier.Array<Metadata>
- An array of objects defining repository metadata.Array<ActivityConfig>
- An array of objects which define
schema structure.Array<ContentContainer>
- Array of content container
configs.Array<ElementMetaConfig>
- An array of objects defining
content element metadata.Configuration for schema structure nodes (activities). Contains the following properties:
String
- Const for marking activity type.Boolean
- Used to define first level (root) activity typesArray<String>
- An array of sub-types.String
- Display label.String
- Display color in hexadecimal notation.Boolean
- Defines whether the workflow status will be tracked for this activity type.Array<String>
- Array of content container types that
define which content containers can be added.Boolean
- Activity allows adding exam activities to it.Object
- Configuration for activity exams.Array<ActivityRelationship>
- Defines what relationships this
activity has to other activities.Array<Metadata>
- An array of objects defining activity metadata.Defines the structure of the activity relationship field.
String
- Defines the name of the relationship. The relationship
will be published under this value.String
- Display label.String
- Display label for the select picker.Boolean
- Defines if the relationship can have multiple
associations chosen. True by default.Boolean
- Defines if the list of activities can be searched.
True by default.Boolean
- Defines if the member list can be empty. True by
default.Boolean
- Defines if a member of the relationship
instance can set the owner of that instance as a member of its own instance of
that relationship. Example, activity X sets activity Y as its prerequisite. If
allowCircualLinks
is set to true then activity Y can set activity X as its
prerequisite. False by default.Boolean
- Defines if an ancestor or a descendant can
be a member of the relationship. False by default.Array<String>
- Defines activity types that can be associated in a relationship.Defines the structure of the activity metadata field.
String
- Unique key for the field.String
- Type of the input component used on the client.String
- Display label.String
- Input component placeholder.MetadataValidator
- Validator object.*
- Default field value.Defines validation rules on an activity metadata field.
Object
- Contains the following properties:Number
- Maximum character count.Boolean
- Defines if the field is required.CONTENT_CONTAINERS
An array of ContentContainer objects.
Configuration for content containers. Contains the following properties:
String
- const-cased
string for marking ContentContainer
type.String
- const-cased
string that defines which custom
ContentContainer
is used to display this container. Needs to match the
templateId
property of the desired custom ContentContainer
. If not
specified the default ContentContainer
is used to display this container.String
- String used for referencing ContentContainer
on the UI.Boolean
- Defines if there can be multiple instances of the
ContentContainer
inside a single Activity
. False by default.Array<String>
- An array of possible content element types that
can exist inside a ContentContainer
. If not specified all types of elements
are allowed.Boolean
- Defines if a heading is displayed on top of the
ContentContainer
. False by default.Boolean
- Defines if elements inside a ContentContainer
instance can be placed two in a row. True by default.Object
- Defines ContentContainer
specific properties.Boolean
- Defines if an instance of the ContentContainer
is
created if non exist. True by default.String
- Defines the name of the file under which the
container will be published. Defaults to container
. The name of the
structure component used is the kebab-cased
version of the type
property.
(example: ABC_DEF -> abc-def)Defines the structure of an content element metadata.
String
- Type of content element (example: "IMAGE", "HTML").Array<ElementMeta>
- Defines what meta fields content element has.Array<ElementRelationship>
- Defines what relationship
metadata content element has (relationships with content elements from the same
or other activities in the repository).Defines the structure of an content element relationship field.
String
- Defines the name of the relationship. The relationship
will be published under this value.String
- Display label.String
- Label for relationship add button and modal title.Boolean
- Defines if the relationship can have multiple
associations chosen. True by default.Array<String>
- Defines to what type of content elements
given content element can have relationship with (example: ['VIDEO']
).Defines what meta fields content element has.
String
- Unique key for the field.String
- Type of the input component used on the client.String
- Display label.String
- Description of meta field.Array<Object>
- Options for certain types of input component.
For example, for select component, options would be:
"type": "SELECT"
"options": [{
"label": "First",
"value": "first"
}, {
"label": "Second",
"value": "second"
}]
PREVIEW_URL
A string template that will be interpolated on the client using two route
params, repositoryId
and activityId
, into a preview URL for each activity.
Example:
https://my.url.com/#/repository/{repositoryId}/activity/{activityId}/preview
For each schema, workflow can be defined to enable users to track and assign activities which are flagged for tracking. Each workflow is defined by a set of statuses that the activity can have.
Workflows are assigned to schemas through schema's workflowId
option in tailor configuration file.
Workflows are configured with the following options in the tailor configuration file:
WORKFLOWS
An array of Workflow objects.
Defines activity statuses for repository workflow. Workflow can be reused across multiple schemas by assigning the same workflow ID to schema's workflowId
option.
String
- Workflow identifier.Array<ActivityStatus>
- An array of possible activity statuses.Object
- Defines threshold (in days, weeks or months) relative to activity's due date, after which the warning of upcoming due date is displayed.String
- Activity status identifier.String
- Display label.String
- Display color.Boolean
- Defines that the status is the default, which the activity has when it's created.Tailor supports creation of custom content elements and custom containers. These extensions can have unique content and structure that the default content elements and containers do not support. The template for creating custom content elements can be found here while the template for creating custom containers can be found here.
extensions/content-<elements or containers>/<my-extension-name>
extensions/content-<elements or containers>
directorymodule.exports = ['my-extension-name'];
Note that module.exports
is an array and you can add as many extensions and just include their folder names in this array to include all of them.
After installation, the extension is ready for use and should be listed in tailor.config.js
file.