So far, it sounds great, but why should I as a Salesforce Developer care about Node.js? Well, let me tell you some of the cool things you can build with it and why it matters within the Salesforce Ecosystem.
As a Salesforce Developer, you might be using the Salesforce CLI (
sfdx); if not, I recommend you start learning how to use it to create Salesforce Applications. It will help you build applications faster and generally improve your development process. The Salesforce Extension pack for VS Code also uses the sfdx CLI behind the scenes.
Lightning Web Components
Even though LWC isn’t specifically Node.js, it uses npm as the package repository for distribution, and many different developer tools like Webpack and Rollup to build and compile LWC projects. So if you plan to create and distribute your web components, learning Node.js will help you through the process.
LWC can also be used as a standalone technology. You can create LWC applications using create-lwc-app, a command-line application written using oclif for Node.js. These applications can be deployed to any hosting provider (with or without Node.js support), though our recommended platform for deployment is, of course, Heroku, part of the Salesforce Platform.
Web applications & services
As I mentioned previously, Heroku is a great place to deploy web applications. One of the main supported Open Source runtimes is Node.js; you can deploy not only beautiful looking, pixel-perfect web applications written in any modern web technology (including LWC OSS) but also deploy highly scalable web services.
In the npm ecosystem, you can find multiple libraries and frameworks to write these types of applications. For example, our latest sample application eCars, is written using Node.js. Web frameworks like Express and Fastify are well known, battle-tested, and trusted by many Fortune 500 companies using Node.js for their backend needs. With them, you can write powerful REST APIs, backend-for-frontend layers, GraphQL APIs, and many more.
At Dreamforce 2019 we announced Salesforce Functions, a powerful serverless runtime to deliver connected experiences with elastic scale, our first planned supported runtime for Salesforce Functions is… you guessed it, Node.js – making it a must-learn technology to create pro-code applications on the Salesforce Platform.
Join me throughout the next few months in a series of blog posts, where you’ll learn how to write Node.js web applications that can be deployed to Heroku, how to access data services like Heroku Postgres, and how to integrate these applications with Salesforce Apps.
- Getting started on Heroku with Node.js on the Heroku Dev Center
About the author
Julián Duque is a Lead Developer Advocate at Salesforce. Connect with him on Twitter @julian_duque.