What is LWR, for real?

LWR Unmasked: A Comprehensive Guide to Lightning Web Runtime

9/24/20233 min read

This marks another crucial discussion in my ongoing exploration of Lightning Web Components (LWR). Today, I had the opportunity to delve deeper into LWR, conducting some swift experiments that yielded valuable insights worth sharing. What makes this discussion particularly intriguing is its relevance to Salesforce Architects and Consultants, where the topics goes beyond LWC components. Let's dive right in.

Lightning Web Runtime (LWR), crafted by Salesforce, is a Node.js based solution that empowers developers to construct Static or Single Page Web Applications. Beneath its surface, LWR seamlessly integrates with Lightning Locker Service, Lightning Data Service which works as a platform to develop LWC or Web Component based site. Notably, LWR-powered sites can find a home on platforms like Heroku or reside on your enterprise servers, such as Amazon EC2. What's more, several Digital Experience Templates within Experience Cloud harness the power of LWR. But why? The answer lies in its promise of enhanced performance, scalability, and control – all wrapped in a package that simplifies optimization efforts. After all, continuous optimization is the path to progress!


So Shubham, can I build my experience sites using LWR, will I need Node.js developers for this? Not Exactly.

Much like the transition from Visualforce sites to Lightning, we're now witnessing a similar shift in some Digital Experience templates towards LWR. This transition means that under the hood, these templates leverage the power of LWR. The best part? You can continue using the Experience Site builder in the same familiar way with these templates. You have the freedom to harness existing components or create your own Lightning Web Components (LWC) to craft captivating experiences for partners, customers, employees, and prospects.

But wait, then what is "Build your own LWR" template?

That's a great question. This template is unique in its own right, as it's based on LWR technology. However, it doesn't come pre-loaded with the ready-made pages and components tailored for specific experiences like Sales or E-Commerce. So when should you consider using it? Allow me to clarify. Imagine you have meticulously crafted branded design mockups using tools like Adobe or Figma, and they're pixel-perfect, following a different design system. The components you need are intricate and don't quite align with the Salesforce Lightning Design System. Using this template gives you a level of control over the user experience of your site. During my initial trial, I even managed to inject the Bootstrap Design System. But design is just one aspect. This template also includes generic helper components to support your development, alongside some Salesforce feature-specific Lightning Web Components (LWC). Keep in mind that Salesforce may introduce more of these components in the future (just an observation, so please don't base any purchase decisions solely on this).

But then what is that Node.js part you said and all those AWS server things?

Hey hey, your questions are really on point today! So, here's the scoop: the LWR Node.js package is now available for preview via npm (Node Package Manager). Imagine you're building a Single Page Application that needs to interact with third-party services or your own on-premise services and databases, and it's all quite complex. You want maximum control over the application for various technical or non-technical reasons. Well, this might just be the path forward (fingers crossed, it's still in preview). It's a pretty new addition to the scene, so the documentation primarily focuses on examples of Static Sites and Single Page Applications. I gave it a whirl myself, and one thing to note is that the URL routing (mapping) and the file structure might not be as scalable for highly complex websites at the moment.

Shubham, is there any use-case of LWR Node that comes into your mind?

Alright, so let's say you already have a multitude of configured Enterprise Applications and Micro-Services that function as a SAAS extension for your core business operations. Take, for instance, an insurance company aiming to process new applications within a 30-minute window, leveraging their proprietary image recognition, AI, and extensive third-party integrations. With substantial traffic and a dedicated team continuously monitoring operations, their goal is to continually enhance the user experience and fine-tune the infrastructure to push the boundaries in their business domain. Well, here's where you can explore your options (keep in mind it's still in preview).

Thanks for reading, ΰ€§ΰ€¨ΰ₯ΰ€―ΰ€΅ΰ€Ύΰ€¦ πŸ™Œ

Follow me