Use Components Outside Salesforce with Lightning Out (Beta)

To run components outside of Salesforce servers, use a Lightning Out app, a special type of standalone Aura app. Whether it’s a Node.js app running on Heroku or a department server inside the firewall, add your components as dependencies to the Lightning Out app. Then run the Lightning Out app wherever your users are.

This feature is a Beta Service. Customer may opt to try such Beta Service in its sole discretion. Any use of the Beta Service is subject to the applicable Beta Services Terms provided at Agreements and Terms.

Developing Lightning web components that you can deploy anywhere is generally the same as developing them to run within Salesforce. Everything that you know about component development still applies. The difference is how you embed your app in the remote web container, or origin server.

To configure your Lightning Out app, include the Lightning Out JavaScript library in the page on the origin server. Then add markup that loads your Lightning Out app and its components. Your Lightning Out app initializes over a secure connection and is inserted into the DOM of the page. Then your component code takes over and runs the show.

This approach is different from embedding an app using an iframe. Components running via Lightning Out are full citizens on the page. If you choose to, you can enable interaction between your standalone Lightning Out app and the page or app you’ve embedded it in. This interaction is handled using Lightning events.

In addition to some straightforward markup, there’s a modest amount of setup and preparation within Salesforce to enable the secure connection between Salesforce and the origin server. And, because the origin server is hosting the app, you need to manage authentication with your own code.

This setup process is similar to what you’d do for an application that connects to Salesforce using the Lightning Platform REST API, and you should expect it to require an equivalent amount of work.

See Also