Creating Project, DevHub and Scratch Org – Lightning Web Components

Reading Time: 2 minutes

Creating Project DevHub and Scratch Org - Lightning Web Components

Create a Project
Create a DevHub Org
Create a Scratch Org
Get to know about some basic commands

In this unit, We will be creating a project, DevHub Org and scratch org.

A. Create a Project
1. Press Command+Shift+P (Mac), Ctrl+Shift+P( Windows)
2. Here type SFDX: Create Project
3. Enter LWCSession1 as the project name and press enter
4. After giving the name, It will ask you to save your project in the folder. Specify the folder here. ( I would suggest you to first create a folder name MyLwcLearning) and store the project in this folder. as we will be wiring more session examples here.)
5. Click on the Create Project button. Now you can see the folder hierarchy.

B. Create a Dev Hub Org
1. First signup for a pre-release org. Goto here:
2. After creating the org, You will receive an email to activate your org and password setup.
3. After successful login, Goto Setup(Top-Right).
4. Here search for Dev Hub in the sidebar.
5. Here enable the DevHub feature.

Till now, You have an Org. Now we need to connect this to our IDE.
6. Goto VS code. Press Command+Shift+P (Mac), Ctrl+Shift+P( Windows)
7. Here type SFDX: Authorize a Dev Hub.
8. It will open the login page in the browser. Here enter detail of the org that you have created above and do the login.

Cool, You have authorized your dev hub.

C. Create a Scratch Org
1. Again, Goto the VS Code and Press Command+Shift+P (Mac), Ctrl+Shift+P( Windows)
2. Here type SFDX: Create a Default Scratch Org.
3. Just hit the enter. Now provide the scratch org name. ( You can give LWCLearningScratch)
4. Wait for a few minutes, Salesforce will create a new org for you. All of the development will go here.

D. Commands that you should know:
1. Open your scratch org by the following command.
sfdx force:org:open

2. You can see all of your org lists by the following command:
sfdx force:org:list

3. Push your code to scrap org:
sfdx force:source:push

Nice, We are reaching there…

Read more blogs on Lightning Web Components here

Leave a Reply