DxpLife The practical Liferay DXP knowledge hub
Talk to us

Home/Knowledge Hub/Client extensions & integration

Client extensions & integration

Liferay 7.4 Client Extensions: Reference Notes

What they are, why they exist and how the extension types fit together

Q&A study setFoundation26 questions~9 min read
In this resource. Concise notes on what client extensions are, why they decouple custom code from Liferay’s OSGi runtime, and how frontend, configuration, microservice and batch types fit together.

Liferay 7.4 Client Extensions

Interview & Technical Reference Notes

Basic Concepts

Q1What is a Client Extension in Liferay 7.4?

A Client Extension is a mechanism for extending or integrating with Liferay while keeping much of the custom implementation outside the traditional Liferay OSGi runtime. Instead of modifying Liferay internals or deploying all customization logic as OSGi bundles, Client Extensions allow developers to connect external applications, frontend resources, services, OAuth clients, and other capabilities to Liferay through supported extension points. Conceptually:

Extension Without Tight Platform Coupling

This makes Client Extensions attractive for:

  • External microservices
  • React applications
  • JavaScript/CSS customization
  • Remote applications
  • OAuth integrations
  • External notification systems
  • Custom element applications
  • Headless architectures
Q2Why were Client Extensions introduced?

Traditional Liferay customization frequently relies on OSGi modules deployed directly into the Liferay runtime. This provides significant power but also creates tighter coupling:

Custom Code → Liferay APIs → Liferay Runtime
Liferay ←→ HTTP / OAuth / JS / CSS ←→ External Extension

The main architectural goals include:

  • Better separation of concerns
  • Easier platform upgrades
  • Reduced dependence on Liferay internals
  • Cloud-friendly deployment
  • Independent development lifecycles
  • Independent technology stacks
Q3What is the main difference between Client Extensions and OSGi modules?

An OSGi module executes inside the Liferay application runtime. A Client Extension generally integrates through supported external extension mechanisms rather than embedding all application logic inside that runtime.

OSGi ⇒ Inside Liferay
Client Extension ⇒ Loosely Coupled / External
Q4What are common Client Extension types?

Liferay 7.4 supports several Client Extension categories, depending on the product update and deployment environment. Important categories include:

  • Custom Element
  • Global CSS
  • Global JavaScript
  • OAuth 2 Application
  • Object Action
  • Object Validation
  • Notification Type
  • Theme CSS
  • Theme Favicon
  • Theme JavaScript
  • Theme Spritemap

Some Client Extension types are especially relevant to Liferay’s cloud and SaaS-oriented architecture.

Client Extension Project Structure

Q5What does a Client Extension project look like?

A Client Extension project commonly contains configuration describing the extension together with the resources or source code required by that extension. A simplified structure might look like:

Diagram
client-extensions/
|
+-- employee-dashboard/
   |
   +-- client-extension.yaml
   +-- package.json
   +-- src/
   |   +-- index.js
   |
   +-- assets/

The most important configuration file is typically:

Code
client-extension.yaml

It describes how Liferay should recognize and configure the extension.

Q6What is client-extension.yaml?

The client-extension.yaml file is the primary descriptor used to define Client Extensions. A simplified conceptual example is:

YAML
employee-dashboard:
   type: customElement
   name: Employee Dashboard
   htmlElementName: employee-dashboard
   urls:
      - index.js

The exact supported properties depend on the Client Extension type and the installed Liferay version. Therefore:

client-extension.yaml = Client Extension Descriptor

Intermediate Concepts

Q7What is a Custom Element Client Extension?

A Custom Element Client Extension allows a frontend application to be exposed inside Liferay as a browser custom element. For example:

XML / HTML
<employee-dashboard></employee-dashboard>

The implementation could be created using technologies such as:

  • React
  • JavaScript
  • TypeScript
  • Other frontend frameworks

Conceptually:

Liferay Page → Custom Element → Frontend Application

This allows the frontend application to evolve with less coupling to Liferay’s Java/OSGi implementation.

Q8What is a Global CSS Client Extension?

A Global CSS Client Extension loads custom CSS resources into configured Liferay contexts. It can be useful for:

  • Branding
  • Corporate styling
  • Common visual customization
  • Portal-wide CSS adjustments

For example:

Code
.portal-header {
   font-weight: 600;
}

.company-banner {
   border-radius: 8px;
}

Instead of modifying Liferay’s internal theme source directly, the custom CSS can be managed as an extension.

Q9What is a Global JavaScript Client Extension?

A Global JavaScript Client Extension allows custom JavaScript resources to be introduced into selected Liferay contexts. Typical use cases include:

  • Analytics integration
  • Client-side event handling
  • Third-party scripts
  • Common browser-side behavior

However, global JavaScript should be used carefully because code executed globally can affect multiple pages.

Q10What is an OAuth 2 Client Extension?

OAuth 2 Client Extensions are particularly important when an external application needs secure access to Liferay APIs. Instead of embedding credentials directly into application code, OAuth 2 can be used to establish controlled API access. Conceptually:

External Application
OAuth 2 Authentication
↓
Liferay Headless API

For example, a Spring Boot microservice may authenticate and then call:

HTTP
GET /o/headless-delivery/v1.0/sites/{siteId}/blog-postings

or a custom Object API such as:

HTTP
GET /o/c/employees

Client Extensions and Headless APIs

Q11How do Client Extensions fit into a Headless Liferay architecture?

Client Extensions work naturally with Liferay’s Headless APIs. A modern architecture might look like:

React Client Extension
↓
Liferay Headless REST API
↓
Liferay Objects / Content / Users

The frontend does not need direct access to Liferay’s internal Java services. Instead, it communicates through supported APIs.

Q12Can a Client Extension call Liferay Objects?

Yes. This is an important architectural combination. Suppose we have an Employee Object. The generated API could expose an endpoint similar to:

HTTP
GET /o/c/employees

A React-based Client Extension could retrieve the entries:

Code
fetch(’/o/c/employees’)
   .then(response => response.json())
   .then(data => {
      console.log(data.items);
   });

Conceptually:

React Client Extension → /o/c/employees → Employee Object

Advanced Concepts

Q13Can a Client Extension communicate with an external microservice?

Yes. One of the major advantages of the Client Extension architecture is the ability to integrate Liferay with independently deployed services. For example:

Liferay
↓
React Client Extension
↓
Spring Boot / FastAPI
↓
Database / AI / External System

The backend does not necessarily need to be implemented using Java. Possible technologies include:

  • Spring Boot
  • FastAPI
  • Node.js
  • .NET
  • Go
  • Serverless functions
Q14How is security handled?

Security depends on the Client Extension and integration architecture. Important mechanisms can include:

  • OAuth 2
  • Liferay permissions
  • API authorization
  • HTTPS
  • CORS configuration
  • Secure credential management
  • External service authentication

A common machine-to-machine pattern is:

Client → OAuth 2 Token → Liferay API

The key principle is:

Never expose privileged secrets in browser JavaScript

Sensitive credentials should be handled by trusted backend services.

Q15Can Client Extensions use Liferay permissions?

Yes, when the extension accesses Liferay resources through Liferay’s APIs, the API operation remains subject to the applicable authentication and permission checks. For example:

User → Client Extension → REST API → Permission Check → Resource

A frontend Client Extension should therefore not be considered a security boundary. Hiding a button does not remove the user’s backend permission.

Q16What are Object Action Client Extensions?

Client Extensions can be combined with Liferay Objects to execute external business logic. Consider:

Purchase Request Created
↓
Object Action
↓
External Microservice
↓
ERP / SAP / Email / Business System

This approach helps keep sophisticated integration logic outside the Liferay runtime.

Q17What is an Object Validation Client Extension?

An Object Validation Client Extension can support externally implemented validation behavior for Object entries where the corresponding Client Extension mechanism is available. For example, consider:

Purchase Amount = 2, 000, 000

The validation service could check:

  • Department budget
  • Vendor status
  • Spending policy

Conceptually:

Object Entry → Validation Extension → External Logic

This is valuable when validation is too sophisticated to represent using simple configuration.

Client Extensions vs OSGi Modules

Q18When should Client Extensions be used instead of OSGi?
FeatureClient ExtensionOSGi Module
ExecutionOften external/browser-basedInside Liferay JVM
CouplingGenerally lowerCan be tightly coupled to Liferay Java APIs
TechnologyReact, JS, Spring Boot, FastAPI, etc.Primarily Java/OSGi
DeploymentExtension-oriented deployment modelOSGi bundle deployment
Internal Ser-Normally uses APIs/integration con-Can directly use Liferay Java services
vicestracts
Upgrade IsolationGenerally strongerDepends on APIs used by custom code
MicroservicesNatural fitNot its primary purpose
Deep PlatformLimited compared with OSGiStrong
Logic

A useful rule is:

Remote / UI / Integration Requirement ⇒ Consider Client Extension

whereas:

Deep Liferay JVM Customization ⇒ Consider OSGi

Client Extensions vs Objects

Q19What is the difference between Liferay Objects and Client Extensions?

They solve different problems and are frequently used together.

ObjectsClient Extensions
Primary PurposeBusiness data modelingPlatform extension/integration
Database EntityYesNot inherently
CRUDGeneratedImplemented or consumed as required
REST APIGenerated for custom objectsCan consume or integrate with APIs
FrontendGenerated/admin interfacesCustom UI possible
External LogicCan trigger/integrate with itStrong integration mechanism

Therefore, a powerful pattern is:

Objects + Client Extensions + Headless APIs

Real-World Example: Employee Portal

Q20How would you build an Employee Portal using Client Extensions?

Suppose the requirement is:

Create an Employee Portal where employees can view their profile, submit leave requests and see their leave history.

Step 1: Create Liferay Objects

Create:

Code
Employee
LeaveRequest

Employee fields:

Code
employeeId
firstName
lastName
email
department
designation

Leave Request fields:

Code
startDate
endDate
leaveType
reason
status

Step 2: Create the Relationship

One employee may have many leave requests:

1:N
Employee −−→ LeaveRequest

Step 3: Use Generated APIs

The published Objects expose APIs conceptually similar to:

HTTP
GET  /o/c/employees
GET  /o/c/leaverequests
POST /o/c/leaverequests

Step 4: Create a React Client Extension

Create:

Code
employee-dashboard

The UI might contain:

Employee Dashboard
+----------------------------------+
| Welcome, Employee |
+----------------------------------+
| Profile |
| Leave Balance |
| Apply for Leave |
| Leave History |
+----------------------------------+
Diagram
+----------------------------------+

Step 5: Connect React to Objects

Conceptually:

React → Object REST API → Liferay Objects

Example:

Code
fetch(’/o/c/leaverequests’)
   .then(response => response.json())
   .then(data => {
      console.log(data.items);
   });

Step 6: Add Workflow

A Leave Request can follow:

Submitted → Manager Review → Approved / Rejected

Step 7: Add External Integration

Suppose approved leave must also reach an HR system. The architecture could become:

Leave Approved
↓
Object Action
↓
Client Extension / Webhook Integration
↓
HR Microservice
↓

Modern Liferay Architecture

A modern Liferay application can therefore combine:

React / Custom Element Client Extension
↓
Liferay Headless REST APIs
↓
Liferay Objects
↓
Workflow / Permissions
↓
Object Actions
↓
Spring Boot / FastAPI Microservices
↓
External Enterprise Systems

This architecture separates:

  • Presentation
  • Business data
  • Workflow
  • Security
  • Integration
  • External business logic

Common Interview Questions

Q21Does a Client Extension run inside the Liferay JVM?

Not necessarily. A major purpose of Client Extensions is to allow functionality to be implemented without placing all custom code inside the Liferay JVM.

Q22Can Client Extensions replace all OSGi modules?

No. Client Extensions are excellent for external integrations, frontend customizations and loosely coupled architectures. OSGi remains appropriate when deep access to Liferay’s Java services, runtime behavior, or internal extension points is required.

Q23Can Client Extensions use React?

Yes. Custom Element Client Extensions are commonly used to integrate modern frontend applications with Liferay.

Q24Can Client Extensions call external APIs?

Yes, provided that authentication, authorization, networking and CORS requirements are correctly configured.

Q25Can a Spring Boot application act as part of a Client Extension architecture?

Yes. A common pattern is:

Liferay ←→ Spring Boot Service

with communication through HTTP APIs and OAuth 2.

Q26Can FastAPI be used?

Yes. The external service does not have to use Java. For example:

Liferay Client Extension → FastAPI → AI/ML Service

This architecture is particularly useful for AI, machine learning, scientific computing and specialized Python workloads.

Architectural Decision Guide

Interview Takeaway

Prefer to read offline? Download the PDF edition (13 pages).