Use Components Outside Salesforce with Lightning Out (Beta)

Use Lightning Out to run components outside of Salesforce servers. Whether it’s a Node.js app running on Heroku or a department server inside the firewall, add your Lightning web components to a standalone Aura dependency app. Then, run them wherever your users are.

This release contains a beta version of Lightning Out, which means it’s a high-quality feature with known limitations. You can provide feedback and suggestions for Lightning Out on the IdeaExchange.

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.

Add Lightning Out to external apps in the form of a JavaScript library you include in the page on the origin server. Add markup to configure and activate your standalone Aura app. When initialized, Lightning Out pulls in your Lightning components app over a secure connection, spins it up, and inserts it into the DOM of the page it’s running on. After it reaches this point, your Lightning web component code takes over and runs the show.

This approach is different from embedding an app using an iframe. Lightning web components running via Lightning Out are full citizens on the page. If you choose to, you can enable interaction between your standalone Aura 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