Beginner 15 min read

Salesforce DX Concepts: Projects and Org Authentication

By the end of this lesson, you'll be able to:

  • Explain what a Salesforce DX project is and its key config file
  • Authenticate the CLI and VS Code to a Salesforce org
  • Understand org aliases and the default org concept

Prerequisites: "Salesforce CLI and VS Code Setup"

What Is a Salesforce DX Project?

A Salesforce DX project is a folder structured for source-driven development, anchored by an sfdx-project.json file at its root, which declares the project's package directories (commonly a folder named force-app). This is called source format — a human-readable, file-per-component layout — as opposed to the older metadata format (a single zipped package.xml bundle) that legacy tools like Change Sets still use.

Authenticating to an Org

sf org login web --alias myDevOrg

This opens a browser window for Salesforce's standard OAuth login flow. Once you log in, the CLI stores an authenticated session locally under the alias you chose. No password is ever stored in your project folder or committed to source control — authentication lives as local CLI session data on your machine, entirely separate from your codebase.

Org Aliases and the Default Org

sf config set target-org=myDevOrg
sf org list
sf org display

Setting a default org means CLI commands don't need --target-org repeated on every call. sf org list shows every org you've authenticated to on this machine; sf org display shows details of your currently-set default.

Why This Matters in Real Projects

Enterprise teams routinely work across multiple orgs at once — a personal scratch org, a shared QA sandbox, and eventually production. Aliases and explicit --target-org flags exist specifically to prevent a very real, very costly mistake: deploying to the wrong org because you forgot which one was set as default.

Exercise

Write the command to authenticate to a new org and give it the alias "teamSandbox".

Show hint

Use the --alias flag.

BASH

Exercise

Challenge: explain, as a comment, the real risk of not checking your default org before running a deploy command on a team that shares a QA sandbox.

Show hint

Think about what happens if the wrong org silently receives a deploy.

BASH

Salesforce DX Concepts: Projects and Org Authentication Quiz

1. What file anchors a Salesforce DX project at its root?

2. What does sf org login web do?

3. Org authentication credentials are stored inside your project folder and get committed to source control.

4. What is "source format" as opposed to "metadata format"?

5. Why does an org alias matter on a team working across multiple orgs?

Log in to submit the quiz and save your score.

My Notes

Log in to keep private notes on this lesson.

Questions about this lesson

No questions yet — be the first to ask.

Log in to ask a question about this lesson.

Summary

A Salesforce DX project is a source-driven, Git-friendly folder structure anchored by sfdx-project.json, and org authentication is local CLI credential storage — never something committed to source control.