Understanding Client Extensions
Liferay provides extensive out-of-the-box features for building custom solutions, including low-code capabilities that empower users to implement data structures, define complex business logic, and design user interfaces without writing code. While these features offer a high degree of flexibility, there may be times when you need to go beyond OOTB features to customize or extend Liferay DXP to meet your unique requirements. For these circumstances, Liferay provides client extensions.
Client extensions are the go to solution for extending Liferay DXP, whether that's modifying its look and feel or adding custom functions. Essentially, client extensions are platform customizations that live outside the Liferay portal container. Unlike OSGi plugins and themes that modify or add functionality to Liferay itself, client extensions interface only with Liferay's APIs. This loose coupling makes them more flexible and easier to apply to environments after an upgrade, since they depend only on APIs that rarely change between versions. You can also create client extensions using whatever programming languages or technologies you wish, because they run outside of Liferay and integrate with objects, with no extra code required to connect them.
You can deploy client extensions to any Liferay environment, including Liferay SaaS, Liferay PaaS, and Liferay Self-Hosted.
Now let's take a look at the kinds of client extensions that are currently available.
Types of Client Extensions
There are four types of Liferay client extensions you can create:
- Batch: Batch client extensions provide data entities to your Liferay instance using headless batch endpoints, such as object and workflow definitions.
- Frontend: Frontend client extensions provide resources that affect Liferay's presentation layer. This includes custom CSS, JS, web components referencing external applications, and more.
- Microservice: Microservice client extensions are external applications that execute business logic in response to events in your Liferay instance. Examples include custom workflow actions, notifications, object actions, and validations.
- Configuration: Configuration client extensions set instance settings. For example, you can use an OAuth user agent client extension to authenticate other client extensions.
Client Extension Projects
Within your Liferay Workspace, you can create client extension projects. These projects reside in the [workspace-root]/client-extensions
folder. Each extension has its own sub-folder and includes a client-extension.yaml
file that defines the project's extensions. Building projects with Gradle produces deployable *.zip
archives called Liferay Universal File Format Archives (LUFFA).
You can group some client extensions in a single project and deploy them together as a unit. Here are the compatible combinations:
- Client extensions of the same type
- Configuration client extensions with batch client extensions
- Configuration client extensions with frontend client extensions
- Configuration client extensions with microservice client extensions
The Clarity workspace for this training includes four client extension projects:
clarity-distributor-mgmt-action
clarity-distributor-mgmt-batch
clarity-global-css
clarity-theme
You'll use these client extensions throughout the course.
Client Extensions vs Traditional OSGi Plugins
Client extensions are the recommended approach for building customizations on Liferay. By separating customizations from the Liferay core, client extensions simplify updates and free you to build solutions using your preferred technologies or deployment strategy. These are just some of the benefits of this development model.
- Simplified Upgrades and Maintenance: Since client extension maintenance events are decoupled from Liferay, they won't break when upgrading or updating Liferay and deployments can happen in any window. Also, since they are self-contained, one buggy extension won't effect the entire server.
- Improved Stability: Since they don't modify Liferay's core and use versioned headless APIs for integration, client extensions reduce the risk of breaking changes.
- Reduced Learning Curve: Client extensions reduce the need for specialized Liferay knowledge and empower developers to use their preferred technologies and frameworks.
- Accelerated Development: Due to their independence and flexibility, developers can enhance and iterate on client extensions quickly.
- Platform Deployment Support: Client extensions support all of Liferay's deployment models (i.e., Self-Hosted, Liferay PaaS, and Liferay SaaS).
While client extensions should be your first choice when extending Liferay DXP, they may not be sufficient for all your business needs. For example, you may need to change the default behavior of a service in Liferay Core, or you may need an integration or customization that doesn’t exist yet as a client extension. In such cases, you should consider OSGi plugins, which can interact with Liferay’s core services, giving you greater power and access to extending Liferay’s functionalities. Through OSGi plugins, you can override and extend how Liferay functions, both leveraging the existing frameworks present in the portal and adding custom business logic or behaviors.
When considering whether OSGi plugins are the right fit for your solution, keep these points in mind:
- Specialized Resources: Because OSGi plugins interact directly with Liferay’s core, developers will need to have familiarity with Liferay.
- Higher Risk of Breaking Changes: Since they run within Liferay and can modify its core, OSGi plugins may be affected by breaking changes in Liferay's APIs as updates are applied to the solution.
- Deployment Restrictions: Liferay SaaS does not support the deployment of custom OSGi plugins; they are only viable for Liferay Self-Hosted and Liferay PaaS deployments. Furthermore, if you could foresee your solution moving to SaaS in the future, having OSGi plugins may pose as a future cost for migration.
Both client extensions and OSGi serve as customization options for building out your business solution, offering you speed, flexibility, and power to extend Liferay. Clarity has evaluated its business needs and has determined that they can build out their current solution with client extensions, so we will not be diving into OSGi plugins in this course.
Conclusion
Congratulations! You've completed Module 3: Course Environment Setup. Throughout this module, you set up a Liferay developer environment and explored the benefits of Liferay workspaces and client extensions.
Here, you’ve explored client extensions at a high-level. To learn more about extending Liferay using client extensions, consider taking these courses:
- Foundations of Liferay Client Extensions
- Mastering Liferay Backend Client Extensions
- Mastering Liferay Frontend Client Extensions
In the next module, you'll learn about Liferay's identity management features.
Additional Resources
See official documentation to learn more about client extensions:
Capabilities
Product
Education
Contact Us