Page 0 — Prerequisites
Before You Start: Setting Up Your Development Environment
Series: Build a Salesforce Guide App with AI
Page: 0 of 10
Time to complete: 20–30 minutes
Who this is for: Anyone who hasn’t used VS Code or the Salesforce CLI before. If you already have both installed and have connected them to a Salesforce org, skip to Page 1.
What You’re Installing and Why
When you build Lightning Web Components or write Apex code, you can’t do it entirely inside Salesforce’s browser-based tools. You need two things on your computer:
Visual Studio Code is a free code editor made by Microsoft. It’s where you’ll write and manage all the files for your app. On its own it knows nothing about Salesforce — that’s where the next piece comes in.
The Salesforce CLI (command line interface) is a tool that lets your computer talk directly to your Salesforce org. It can push code you’ve written locally into Salesforce, pull existing code back down, and run tests — all from a single terminal command.
Together they give you a proper development workflow. You write code locally, deploy it to your org, test it, and iterate. This is how every Salesforce developer works.
Step 1 — Install VS Code
- Go to code.visualstudio.com
- Download the installer for your operating system
- Run the installer — all defaults are fine
- Open VS Code when it finishes
Step 2 — Install the Salesforce Extension Pack
This gives VS Code the ability to understand Salesforce code and syntax.
- In VS Code, click the Extensions icon in the left sidebar (it looks like four squares)
- Search for
Salesforce Extension Pack - Click Install on the result published by Salesforce
- Wait for it to finish — it installs several extensions at once
Step 3 — Install the Salesforce CLI
- Go to developer.salesforce.com/tools/salesforcecli
- Download the installer for your operating system
- Run the installer — all defaults are fine
- Restart VS Code completely after the CLI installs
To verify it worked, open the Terminal in VS Code (Terminal → New Terminal) and run:
sf --version
You should see a version number. If you get an error saying the command isn’t found, restart VS Code and try again.
Step 4 — Create Your SFDX Project
An SFDX project is a folder on your computer that holds all the code for your app, organised in the way Salesforce expects.
- Open the Command Palette:
Cmd+Shift+P(Mac) orCtrl+Shift+P(Windows) - Type
SFDX: Create Projectand select it - Choose Standard template
- Name the project
guide-hub - Choose a location — your Documents folder works well
- Click Create Project
VS Code opens your new project automatically. The folder you care about most is force-app/main/default/ — all your code lives here.
Step 5 — Connect to Your Salesforce Org
- Open the Command Palette again (
Cmd+Shift+PorCtrl+Shift+P) - Type
SFDX: Authorize an Organd select it - When asked for a login URL:
- If you’re using a Trailhead Developer Edition or production org, select Production
- If you’re using a sandbox, select Sandbox
⚠️ Common mistake: Trailhead Developer Edition orgs use the Production login URL, not Sandbox. This catches a lot of people out.
- Give the org an alias — type
guide-hub-organd press Enter - A browser window opens — log in with your Salesforce credentials and click Allow
- Switch back to VS Code — you should see a success message in the terminal
Verify the connection by running this in the terminal:
sf org display
You should see your org’s username, ID, and a status of Connected.
Windows Users: Two Things to Know
If you’re on Windows, two gotchas will save you significant frustration later.
PowerShell file writing
When writing files from PowerShell scripts, always use [System.IO.File]::WriteAllBytes() with base64-encoded content. The simpler Set-Content -Encoding UTF8 command writes a hidden character at the start of the file (called a BOM) that causes Salesforce to reject the file with a cryptic error.
All the PowerShell scripts in this tutorial use the correct approach — but if you ever write your own scripts, remember this.
Downloaded scripts are blocked by default
When you download a .ps1 script file, Windows blocks it from running. Before running any downloaded script, unblock it first:
Unblock-File -Path .\your-script.ps1
Then run it:
.\your-script.ps1
Key Terminal Commands
You’ll use these throughout the tutorial. Keep this page bookmarked.
# Deploy your code to Salesforce
sf project deploy start --source-dir force-app/main/default
# Deploy just Apex classes
sf project deploy start --source-dir force-app/main/default/classes
# Deploy just LWC components
sf project deploy start --source-dir force-app/main/default/lwc
# Run your Apex test class
sf apex run test --class-names GuideServiceTest --result-format human --wait 5
# Pull a class from the org into your local project
sf project retrieve start --metadata ApexClass:ClassName
# Re-authorise if your session expires (deploy hangs for 30+ seconds)
sf org login web --alias guide-hub-org
Check Your Work
Before moving to Page 1, confirm:
- ✅
sf --versionreturns a version number in the terminal - ✅
sf org displayshows your org connected - ✅ You can see the
force-app/main/default/folder structure in VS Code’s left panel
If all three are true, you’re ready. Move to Page 1.