Drupal has been a very popular content management system since 2001 and has evolved into a large-scale used solution, having over 1 million websites that use it as a platform. Nowadays, Drupal 9 offers a variety of implementations, providing flexibility and customization at various levels, with the possibility of customizing its services to a perfectly tailored solution for the project’s needs.
This is mainly acquired by using Drupal as a decoupled back-end, thus allowing the front-end part to be developed in various technologies. While the future of web applications seems to be microservices, exposing content or entities to the front-end enables the use of any technology to render the application.
Services - how decoupled Drupal works
- Decoupled Drupal, or headless Drupal, stores and manages data and makes it available through web service APIs
- The administrative part remains in the Drupal back-office, where developers can fully benefit from the CMS aspect, creating fieldable entities, complex data structures, and vast editable content
- Any logic needed or functionality is developed in custom modules, which plug into Drupal’s core through services
- Using RESTful APIs (API that conforms to the REST-style architecture), we can send the data in JSON or XML formats
Drupal RESTful solution
Below we have Drupal’s core and contributed modules that can help develop a decoupled solution.
- REST views - this module enhances the REST export functionality by providing a link between views and REST, thus enabling us to expose any content type or entity defined in our backend
- Serialization - responsible for deserializing and serializing request-response data
- Simple Oauth 2 - this module allows users to log in and be authenticated using access tokens, thus removing the login layer and replacing it with secure, modern authentication
- REST UI - this module exposes our web services configuration via the admin UI - this applies, of course, for our many custom endpoints through which we use various HTTP methods
A custom REST resource is defined using a Resource Plugin. Plugins are small pieces of functionality that have a certain purpose. In this case, we have to extend the ResourceBase plugin, add the proper namespace, configure the endpoint using annotations, implement the needed static methods (get, post, patch, etc.) and define the route parameters.
Using Drupal as a headless back-end implementation allows us to serve content and complex flows, from user registration, authentication, and user groups, to a dynamic feed, tailored to various flags that the user chooses through the application, and a shop functionality that enables users to redeem prizes or products, and is always in sync with the back-end defined stock and options. In this way, we can serve this solution to many types of devices, including:
- Websites and native mobile apps
- Internet of Things apps
- CRM systems
Different services will use the most appropriate technology through this approach, fostering reusability, scalability, cost reduction, and continuous delivery.
Tremend has a highly experienced team of software engineers and a special-dedicated Drupal department specialized in this area. Having worked with multiple traditional Drupal implementations or decoupled solutions, we can offer modern solutions and strong, secure architectures that can be implemented in various front-end technologies, like React Native or Vue.js.