Use cases and usage guidelines

The Component Service is flexible and can be used in various ways.

There are, however, some circumstances when the Component Service should not be used or is not supported.

Suitable use cases

The Component Service is designed for the following key use cases:

  • Creating structured design elements that editors can add to a content page.

  • Implementing design systems that will be used across one or many sites.

  • Components that require more complex server-side code to render a section of a web page.

  • Components that load data from other sources, such as an API, and render it server side.

  • Interactive components that render both HTML and JSON end points and that interact with other services client-side. For example, a carousel slideshow or a video player.

  • Components that package up some useful features and are deployed to other third-party websites.
    For example, a course finder added to a portal that is not built on the Squiz DXP.

General limitations

You should be aware of the following general limitations of the Component Service. Some limitations are by design, while others will be resolved as features are rolled out to the service.

  • The service is read-only.

  • Output is always cached.

  • Request execution time is limited to five-seconds. Read Five-second process execution limitations for specific caveats.

  • The Component Service is not designed to manage inter-component dependencies. Dependency chains should be avoided in components.

  • Squiz Content Management Service keywords and other service-specific syntax are not supported inside the Component Service.

  • Customizing the editing interface generated from your manifest.json is impossible. For example, there is no equivalent to custom edit layouts.

Unsuitable use cases

Basic text formatting

The WYSIWYG editor in your CMS should handle the output when the output is simple. For example, basic text formatting. The Component Service is not intended to implement your design system’s more atomic style elements.

Completely bespoke editing interface requirements

The service is not designed to serve custom editing interfaces.

Chaining multiple components together

Loading components from within other components is not supported.

Using server-side code to write data to a persistent datastore

The Component Service is designed to be cacheable and read-only. Any write actions, for example, submitting a form or sending data through an API to be stored, must only be performed client-side if implemented using the Component Service.

Using Content Management Service implementation patterns through the UI

Component Service uses APIs and JavaScript to render your components. With the move to more industry-standard approaches, Squiz Content Management Service keywords, asset listings, and other low-code features are incompatible. Data is loaded through APIs and processed through code. This approach also requires developers be able to work on code locally and deploy it.

Components that need to return an uncached response

The Component Service has a five-minute minimum cache timeout.

Five-second process execution limitations

The Component Service has a hard five-second limit on server scripts and processes. This execution limit makes the service unsuitable for use as either:

  • a Node.js application platform; or

  • a workload runner system.

The time limit also means the following use cases will not work reliably, and are therefore considered unsupported configurations.

Loading data from several sources in the same process

The more sources from which your component ingests data, the longer the potential execution time. Consider implementing a method that pre-loads data for your component so you do not encounter the hard execution time limit.

Performing significant computation

If you are doing more intensive computation, consider using another system to generate your output and store it somewhere. Squiz Data Services is worth exploring as a way of storing data so Component Service can retrieve it within the five-second execution window.

Generating large amounts of output

If your component generates a lot of dynamic output, you might need to use another system to generate your output and store it somewhere, such as Squiz Data Services, so the Component Service can retrieve it quickly.