Replace a component of the InStore POS with a micro-frontend that you build and host, registered as an external module.
How POS UI module replacement works
The InStore POS is a host application that loads each of its components as a separate micro-frontend using Module Federation. Module Federation calls each loaded micro-frontend a remote. In InStore, you register a replacement as an external module.
An external module is a record that tells the POS to load your replacement module in place of a built-in component. You register the external module once for your tenant. Then assign it to a location or to a workstation. When a workstation starts, InStore resolves which external modules apply to it. It returns them with the rest of the workstation configuration. The POS loads your replacement module from the address in the record.
Registration and assignment are configuration. The replacement module itself is code that you build, host, and serve.
Component you can replace
An external module record describes where your replacement module lives and how to load it. The record contains the following fields:
| Field | Data type | Description |
|---|---|---|
default | Boolean | Whether the module is the tenant-wide fallback for its type. At most one module per type can be the default. |
key | String | Unique identifier for the module within your tenant. Accepts 2 to 256 letters, digits, underscores, and hyphens. |
module | String | Path that the replacement module exposes for the component, such as ./CartApp. |
scope | String | Module Federation container name that the replacement module exposes, such as instoreCart. |
type | String | Component that the replacement module provides. See Component you can replace for supported values. |
url | String | Address of the remoteEntry.js file for the replacement module. Accepts http and https addresses up to 2048 characters. |
The following request body registers a Cart replacement module:
{
"key": "external-cart-component",
"url": "https://modules.example.com/InStore_Example_Cart/remoteEntry.js",
"type": "Cart",
"scope": "instoreCart",
"module": "./CartApp",
"default": true
}
A replacement module runs inside the POS host and shares the host React instance. It renders within the same providers as a built-in module. Build the replacement module against the Module Federation contract of the component it replaces. Expose the container name and module path that you register.
Due to its hosted nature, the InStore POS loads a replacement module only through the Module Federation contract described on this page. A replacement module that does not expose the registered container name and module path fails to load. The component is then unavailable at every workstation the module is assigned to.
Assignments follow three rules:
- Each location and each workstation accepts at most one external module per type. To swap an assigned module, remove the existing assignment first.
- An external module that is still assigned to a location or a workstation can't be deleted. Remove every assignment first.
- At most one external module per type can be the tenant default.
The InStore State module
instoreState and consumed through Module Federation. That module owns the active Cart, localization, workstation configuration, the API client, and the theme. Every built-in component reads from it rather than holding its own copy.instoreState as a Module Federation remote and reads what it needs from there instead of calling the InStore backend on its own. This keeps a replaced component and the rest of the POS aligned on one Cart, one locale, and one session.Module resolution model
InStore consults three tiers to decide which external modules apply to a workstation. It uses the first tier that yields an assignment:
- Assignments on the workstation.
- Assignments on the parent location.
- External modules marked as the tenant default.
Tiers apply as a whole rather than merging by type. If a workstation assigns any external module, that assignment set answers in full. The workstation inherits nothing from its location. If no tier yields an external module, the POS loads the module bundled with it.
Changes take effect the next time the POS loads at that workstation.
Relationship to POS theming
Next steps
Use the following resources to continue developing your replacement module:
- Build a replacement module to build a replacement module against the InStore State module and register it.
- Implement the Cart module to read Cart state and render a replacement Cart.
- Run POS API requests to set the API host, Project, and tenant, get an access token, and send requests to InStore POS APIs.
- Use Modules overview to review the InStore modules and the customization each one supports.
- Customize the InStore POS UI to learn how tenant theming applies across the POS.
- Customize styles and behavior to change palette tokens, MUI component overrides, and responsive layout settings.