How to install a Microfrontend Plugin on a tenant and use it in an app?
Tags: microfrontends, plugin, iot, cumulocity
Published: 2023-03-01 12:15:49

---
title: How to install a Microfrontend Plugin on a tenant and use it in an app?
published: true
date: 2023-02-08 15:20:33 UTC
tags: microfrontends, plugin, iot, cumulocity
canonical_url: https://tech.forums.softwareag.com/t/how-to-install-a-microfrontend-plugin-on-a-tenant-and-use-it-in-an-app/268981
---

## How to install a Microfrontend Plugin on my tenant?

With the release of version 1016 of the WebSDK, you can officially install Microfrontend plugins on your tenant. For older tenants (starting with 1013) it is possible too. While there is a comprehensive guide around the [whole plugin concept already available](https://tech.forums.softwareag.com/t/the-power-of-micro-frontends-how-to-dynamically-extend-cumulocity-iot-frontends/266665), we want to focus here just on the part **how to install and activate plugins on a tenant.**

## How to know that the repository contains a plugin?

![Bildschirm­foto 2023-02-08 um 12.21.06](https://global.discourse-cdn.com/techcommunity/original/3X/5/c/5cf391931e7d190f31d5195f2684b8d87156d9fa.png)

Usually repositories containing plugins will state that either in their name, readme file, or have tags pointing out that this repository contains features in a plugin format. If you are not sure, then checkout the package.json file of the project. If the c8y configuration there contains a `"package": "plugin"` definition, you can be pretty sure that the project in front of you contains a plugin.

[![Bildschirm­foto 2023-02-08 um 12.05.07](https://global.discourse-cdn.com/techcommunity/optimized/3X/1/c/1c0fa9d43326d0afcedd9fd143e1e34d8db1b6ae_2_690x398.png)](https://global.discourse-cdn.com/techcommunity/original/3X/1/c/1c0fa9d43326d0afcedd9fd143e1e34d8db1b6ae.png "Bildschirm­foto 2023-02-08 um 12.05.07")

## I found a plugin repo. How do I get the plugin installed?

Our open source projects sometimes can differ a bit. While it is always recommended to create downloadable release packages, not all projects offer that. In case the project contains an already packaged zip file, you can directly jump to b). If no zip files are offered, than let’s create and deploy the projects plugin on our own!

## a) No release package found? - Build and upload the plugin on your own!

### Let’s build

![](https://global.discourse-cdn.com/techcommunity/original/3X/b/5/b5ceb21c336cf8ccb97152e0a2e44ca967426bbd.gif)

If you already have the zip file, then just skip this and go ahead with the deployment. Otherwise makes sure to have node.js version 14 installed and install the [c8ycli](https://www.npmjs.com/package/@c8y/cli).

Then download the code of the project, open a terminal an cd into the project, so that you are on the level where the package.json is located. Then run `npm i` which will install all the dependencies that the project needs. After that create a build by running `c8ycli build`.

### Upload to the tenant using c8ycli

If the build was successful, you can then either go into the directory of the created dist folder and zip and upload the file manually, or keep it simple and just use the c8ycli again to deploy via command line too. Just run `c8ycli deploy -u https://your.target.tenant.com`.

Once run, you need to provide your credentials with which you login on the tenant (and you need appropriate rights to create a new app on the tenant you are targeting). If the deployment was successful, it means that the plugin was successfully uploaded and installed!

## b) Download zip from the repository and upload it to the tenant

If you have the opportunity to download a zipped release of a plugin then you can just go to your tenant and open the Administration app. Once opened, go to Ecosystem > Applications. In the tabs you should see All Applications, Packages, Features.

![:warning:](https://emoji.discourse-cdn.com/twitter/warning.png?v=12 ":warning:") If you do not see the Packages tab, that means that your tenant uses an older version of the Administration application than 1016. If that is the case, simply add beta=true before the # in the url, e.g. [https://your.tenant.com/apps/administration/index.html?beta=true#/ecosystem/package-list](https://your.tenant.com/apps/administration/index.html?beta=true#/ecosystem/package-list).

You should see the following screen:

[![Bildschirm­foto 2023-02-08 um 12.27.16](https://global.discourse-cdn.com/techcommunity/optimized/3X/1/8/18c3b579c7137c34156b20caec7ea1e680f4f3f7_2_690x272.png)](https://global.discourse-cdn.com/techcommunity/original/3X/1/8/18c3b579c7137c34156b20caec7ea1e680f4f3f7.png "Bildschirm­foto 2023-02-08 um 12.27.16")

There just click on add package and upload your zipped plugin.

## How to use the installed plugin on an app?

Congratulations! You just successfully added your first plugin to the tenant! 
 
With the first milestone being done let’s now face the next step - we of course want to use the installed plugin on one of the apps.

Basically it is now up to you for which app you want to install the plugin. You could either create clones of the Cockpit, Device-Management or Administration apps, or use it on already installed custom apps. But there is one thing you need to keep in mind:

**Check that the WebSDK versions match!**![:warning:](https://emoji.discourse-cdn.com/twitter/warning.png?v=12 ":warning:")

With version 1016 this part will be way easier, as plugins will get a versioning. That way it is then clear that version 1 of a plugin will for example work with 1016 of the Cockpit clone and version 2 will work with version 1017 of the Cockpit clone.

[![Bildschirm­foto 2023-02-08 um 15.40.10](https://global.discourse-cdn.com/techcommunity/optimized/3X/8/8/88c14d59c34a2ad13d3e2fc447b04be641b241ed_2_690x143.png)](https://global.discourse-cdn.com/techcommunity/original/3X/8/8/88c14d59c34a2ad13d3e2fc447b04be641b241ed.png "Bildschirm­foto 2023-02-08 um 15.40.10")
  
<sub>Example plugin showing required version</sub>

If your tenant is using older versions of the WebSDK than 1016, this versioning feature will not yet be available and WebSDK versions between plugins and the target apps where you want to install these need to match fully (e.g. versions need to equal 1016.0.59). From version 1016, the compatibility is more forgiving - there just the major version needs to match (e.g. 1016).

If the versions do not match, you can prevent compatibility issues by just quickly generating clones with the correct version like this:

## Create, build and upload Cockpit, Administration or Device Management clones with the same version as the plugin

First of all, check the version that the plugin uses. Open the _package.json_ and search for “[@c8y](https://tech.forums.softwareag.com/groups/c8y)/…” prefixed dependencies. Copy the version of these dependencies.

[![Bildschirm­foto 2023-02-08 um 13.45.27](https://global.discourse-cdn.com/techcommunity/optimized/3X/b/8/b88599480cd13dbf7686428cd5ca99dc9b5545e6_2_345x69.png)](https://global.discourse-cdn.com/techcommunity/original/3X/b/8/b88599480cd13dbf7686428cd5ca99dc9b5545e6.png "Bildschirm­foto 2023-02-08 um 13.45.27")
  
<sub>In this example the WebSDK version of the plugin is 1016.0.59.</sub>

We now want to create a clone of the app that shall use this plugin where the WebSDK version will be exactly the same. Open a command prompt and type c8ycli new. The terminal now wants you to provide a name. If you want to create a clone that overrides the subscribed standard apps, pick either:

- cockpit,
- devicemanagement, or
- administration.

After that, the WebSDK version can be picked. Select other and paste the version that you copied before from the package.json of the plugin:

[![Bildschirm­foto 2023-02-08 um 13.50.32](https://global.discourse-cdn.com/techcommunity/optimized/3X/d/8/d8e9eeb63cbaf0f4fcd470008dad8d6bcbbfd7f6_2_345x44.png)](https://global.discourse-cdn.com/techcommunity/original/3X/d/8/d8e9eeb63cbaf0f4fcd470008dad8d6bcbbfd7f6.png "Bildschirm­foto 2023-02-08 um 13.50.32")

After that, select the app you want to clone, in this example it would be _cockpit_. After that, a new clone will be created locally on your computer. Wait until the script finishes, then cd into the app and run `npm i`. After the installation of the dependencies, just do the same build steps as in the chapter before - run `c8ycli build` and after that `c8ycli deploy -u https://your.tenant.com/`.

Done! You uploaded a clone of an app that exactly matches the version of the plugin!

## Install the plugin on an app

The moment is finally there! You are seconds away before opening up a new world of adding new content to your apps with the simple click of a mouse.

![](https://global.discourse-cdn.com/techcommunity/original/3X/6/b/6b10ff18b14ab3de00ee4ef808f9783a2edf7e22.gif)

Open the administration app again (with the beta=true flag if WebSDK version is below 1016).  
Click on the All applications tab and click the app you want to extend. In my example I will extend an Administration clone:

[![Administration clone](https://global.discourse-cdn.com/techcommunity/optimized/3X/1/f/1f0094aa3e3548cec554f8abfebebd157589da65_2_690x139.png)](https://global.discourse-cdn.com/techcommunity/original/3X/1/f/1f0094aa3e3548cec554f8abfebebd157589da65.png "Bildschirm­foto 2023-02-08 um 15.59.13")

Clicking on my custom Administration app will open the _Properties_ tab of that application. A second tab is available - the _Plugins_ tab. Click on that and you will see an empty list of _Installed Plugins_ on the right. It’s simply empty as no plugin has been installed for that app yet. We change that now by clicking on _Install plugins_.

[![click-on-plugin-tab](https://global.discourse-cdn.com/techcommunity/optimized/3X/b/f/bfc4a2d9ee020ce961d79756eef71a58b07fcd85_2_690x372.png)](https://global.discourse-cdn.com/techcommunity/original/3X/b/f/bfc4a2d9ee020ce961d79756eef71a58b07fcd85.png "Bildschirm­foto 2023-02-08 um 16.03.19")

This will open up a modal showing the compatible plugins for your app. If you have followed the previous steps about creating a clone with matching version, there should be no issues now and you should see the plugin that you installed in the first chapter.

[![Install-Plugin](https://global.discourse-cdn.com/techcommunity/optimized/3X/5/7/57ad5c9dd283ee20fc79dae5c853303c077974dd_2_690x249.png)](https://global.discourse-cdn.com/techcommunity/original/3X/5/7/57ad5c9dd283ee20fc79dae5c853303c077974dd.png "Bildschirm­foto 2023-02-08 um 16.08.34")
  
<sub>Example of a plugin that could potentially be installed.</sub>

Select your plugin and click _Install_. **That’s it! Your app now uses the plugin!**

![](https://global.discourse-cdn.com/techcommunity/original/3X/0/8/08412cb3ad3827c6077d757265ee1812fdd973ae.gif)  
<sub>I knew you could do it!</sub>


[Read full topic](https://tech.forums.softwareag.com/t/how-to-install-a-microfrontend-plugin-on-a-tenant-and-use-it-in-an-app/268981)