Search code examples
alfrescocrafter-cms

How to access data from Crafter CMS repository in a remote application?


My use case is :

Authors uploads images and enter meta data about images (or blogs) such as image description in Crafter CMS. Admin approves/publishes the images. As soon as this is done, a separately developed Java web application ( public facing) not linked with Crafter CMS sees this new content which shows up in faceted search results as the end user is interacting with this Java web application.

How above can be achieved using Crafter CMS (Community Edition) ?

Crafter CMS components cannot be used in remote Java application (tomcat) which has direct access to content (originally coming from Crafter CMS) in cache memory. This remote Java application has its own solution for search based on elasticsearch. Better way to ask this question how Crafter CMS can store content in remote repository living in the same server running remote Java application.


Solution

  • There are two architectures that are possible to address this need.

    1. Deploy content from Crafter Studio to a remote Crafter Engine (co-located with the remote app.) Then have the remote application request content and assets via service. This is a decoupled CMS architecture with a headless content delivery strategy.

    2. Use the deployer to push content from the Studio into the remote application (disk, database, whatever you want.) The deployer has a simple Java interface that allows you to code actions that should be taken on a deployed changeset:

    This is the full deployer API: https://github.com/craftercms/deployer/tree/master/src/main/java/org/craftercms/deployer/api

    This is the interface you would implement: https://github.com/craftercms/deployer/blob/master/src/main/java/org/craftercms/deployer/api/DeploymentProcessor.java