Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
Full Project entry
How-to guide

How to create a Salesforce DX project

You create a Salesforce DX project from the command line, not from the Setup UI. Install the Salesforce CLI first, then generate the project folder and open it in your editor. These steps produce a tracked, ready-to-develop project.

By Dipojjal Chakrabarti · Founder & Editor, Salesforce DictionaryLast updated Jun 16, 2026

You create a Salesforce DX project from the command line, not from the Setup UI. Install the Salesforce CLI first, then generate the project folder and open it in your editor. These steps produce a tracked, ready-to-develop project.

  1. Install and verify the CLI

    Install the Salesforce CLI, then run sf --version to confirm it resolves. The unified sf CLI replaced the original sfdx executable, so make sure you are on a current build before you start.

  2. Generate the project

    Run sf project generate --name my-app from the folder where you want the project to live. The CLI scaffolds sfdx-project.json, a force-app directory, config, and manifest folders inside a new my-app directory.

  3. Put it under version control

    Change into the new folder and run git init, then commit the generated files. Tracking the project from the first commit means every later change shows up cleanly in history and code review.

  4. Authorize an org and start the loop

    Authorize a Dev Hub or sandbox with sf org login web, then create a scratch org or set a default org. Now you can deploy source into the org, retrieve changes back, and commit your work.

Mandatory fields
Project namerequired

Passed with --name; becomes both the new folder name and the project name recorded in sfdx-project.json.

sfdx-project.jsonrequired

Generated automatically; its packageDirectories array with one default path is required for the CLI to treat the folder as a project.

Default package directoryrequired

The force-app folder created by default; exactly one directory must carry default true so retrieved metadata has a home.

Gotchas
  • Running CLI commands that expect a project from outside the project root fails, because the CLI cannot find sfdx-project.json. Run them from the folder that holds that file.
  • Keep the .sf or .sfdx state directory out of Git by leaving it in .gitignore. It holds local, machine-specific data that should not be shared.
  • Exactly one package directory can be the default. Marking two with default true is a configuration error the CLI will reject.
  • The --template flag picks the starting layout. Use the standard template for general work; the empty template skips the sample force-app structure if you want to build it yourself.

See the full Project entry

Project includes the definition, worked example, deep dive, related terms, and a quiz.