# Create an Entando Platform Capability
An Entando Platform Capability, or EPC, is a packaged component bundle that adds functionality and UX controls to the Platform. An EPC simplifies the addition of menu options, an API management page, or WCMS integration like Strapi, all from the App Builder. This tutorial demonstrates how to build a simple EPC from a React micro frontend (MFE) bundle.
# Prerequisites
- A working instance of Entando
- An existing React MFE
# Create a Simple EPC
Working with the React MFE Tutorial, the following steps convert the React bundle into an EPC by modifying the bundle descriptor and customizing the public path to serve static assets.
# Configure the Bundle Descriptor
Edit the simple-mfe
micro frontend in the bundle descriptor entando.json
in the root bundle directory.
- Change the
type
toapp-builder
:
"type": "app-builder"
Remove the
titles
attributeAdd the following attributes:
"slot": "content",
"paths": ["/YOUR-MFE-NAME"],
"nav": [
{
"label": {
"en": "YOUR EPC LABEL IN ENGLISH",
"it": "YOUR EPC LABEL IN ITALIAN"
},
"target": "internal",
"url": "/YOUR-MFE-NAME"
}
]
type
: EPCs requireapp-builder
type MFEslot
: Placement of the EPC on a pagepaths
: The URL path to the EPC in the App Builder. An external URL can be enterednav
: The visible label for the navigation name in the App Builder Menu
- Save the entando.json
For more details on attributes, see the Bundle Details page.
# Optional: Configure the Custom Element Paths
If you have static assets such as images or style sheets in your MFE, modify microfrontends/YOUR-MFE-NAME/src/custom-elements/public-path.js
.
Retrieve the bundle ID using your bundle name and Docker information:
ent ecr get-bundle-id https://registry.hub.docker.com/YOUR-DOCKER-ORGANIZATION/YOUR-BUNDLE-NAME
YOUR-BUNDLE-ID
will be an 8-digit string of numbers and letters.Determine the bundle and widget codes. The CODE is simply the concatenation of the bundle name, a dash, and
YOUR-BUNDLE-ID
.YOUR-BUNDLE-CODE:
YOUR-BUNDLE-NAME
-YOUR-BUNDLE-ID
YOUR-WIDGET-CODE:YOUR-WIDGET-NAME
-YOUR-BUNDLE-ID
e.g. With a bundle named
bundleOne
, a widget namedmfeTwo
, and a bundle ID of4986eb9c
: YOUR-BUNDLE-CODE:bundleOne-4986eb9c
YOUR-WIDGET-CODE:mfeTwo-4986eb9c
Using your CODEs, replace the contents of
public-path.js
with the following:
if (process.env.NODE_ENV === 'production') {
let publicpath = '/entando-de-app/cmsresources/bundles/YOUR-BUNDLE-CODE/widgets/YOUR-WIDGET-CODE/'
// eslint-disable-next-line no-undef
__webpack_public_path__ = publicpath || './';
}
e.g. for the example from Step 2:
publicpath = '/entando-de-app/cmsresources/bundles/bundleOne-4986eb9c/widgets/mfeTwo-4986eb9c/'
# Build and Install the EPC
From the bundle root directory, build and install the bundle:
ent bundle pack
ent bundle publish
ent bundle deploy
ent bundle install
Log in to your App Builder to see the new EPC:
- Go to
EPC
from the left menu and chooseUncategorized
- Click on your EPC
label
You should see the spinning React logo inside the App Builder.
- Go to
Congratulations!
You now have an EPC running on Entando!
Next Steps
- Learn how to utilize Entando MFE Context Parameters to extend your micro frontends.
- Use Plugin Environment Variables to Customize Microservices