A quick introduction to Salesforce LWC Open Source

Kaustubh Labhe
Salesforce, and everything related
3 min readDec 17, 2019

A few weeks ago, I got an opportunity to introduce and show a quick demo on the newly introduced Lightning Web Components Open Source, to my team. Below are some of the points which we discussed:

Firstly, what is LWC?
A new Javascript framework, introduced by Salesforce, to build lightning components in your Salesforce org. This can be used along with your existing aura components. The LWC complies with the latest web standards, and driven by W3C and ECMASript technical commitee. As shown in the picture below, its built on the modern web stack, and leverages custom elements, decorators, modules, and templates available in ECMA 6 and beyond.

3 main attributes of LWC:
1. Salesforce Bindings
2. Base Lightning Components
3. Lightning Web Components

Base Lighting Components — a set of 70+ UI components built as custom elements
The Lightning Data Service — provides declarative access to Salesforce data and metadata, data caching, and data synchronization
The User Interface API — the underlying service that makes Base Lighting Components and the Lightning Data Service metadata-aware

“The Lightning Platform has long served millions of enterprise developers building the apps that underpin today’s connected experiences,
With Lightning Web Components now open source, we’re empowering the community to build standards-based applications on any platform, and inviting them to help us define what the future of enterprise software looks like.“ — Ryan Ellis, SVP of Product Management, Salesforce

Now, what is LWC OS?
Introduced in TrailheadX’19, Salesforce open-sourced the LWC framework. With this, developers can now build apps without being dependent on the Salesforce platform. Salesforce very well put this as, ‘one framework, any platform’. This move can now help companies innovate and scale rapidly, by having a larger talent pool, and have better adoption. It gives developers more freedom and resources to build web apps with or without using Salesforce specific features.

Getting started with LWC OS:
- Refer: https://lwc.dev/
- Install Node.js with at least npm 5.2+
- To install LWC run the following in cmd,
{npx lwc-create-app my-app}
- Post installation, run the following commands in cmd,
{cd my-app}
{npm run watch}
You can use any code editor with Prettier, to edit your code.
Do not forgot about the lwc oss recipes available for you to download and use in your apps: https://github.com/trailheadapps/lwc-recipes-oss

Sources:
https://siliconangle.com/2019/05/29/salesforce-open-sources-lightning-web-components-application-development/

https://developer.salesforce.com/docs/component-library/documentation/lwc

--

--