Skip to content
Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
Full Local Project entry
How-to guide

Create a Local Project with the Salesforce CLI

You create a Local Project with the Salesforce CLI, then connect it to an org. These steps produce a source-format project ready for git and deployment.

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

You create a Local Project with the Salesforce CLI, then connect it to an org. These steps produce a source-format project ready for git and deployment.

  1. Generate the project

    Run sf project generate --name MyProject in the folder where you keep your code. The CLI scaffolds a source-format project with sfdx-project.json, a force-app package directory, a config folder, a manifest folder, and a .forceignore file. In VS Code you can run SFDX: Create Project from the Command Palette for the same result.

  2. Open it and authorize an org

    Open the new folder in VS Code, then authenticate with sf org login web. Pick the org as your default so commands target it. For scratch-org work, create the org from config/project-scratch-def.json with sf org create scratch.

  3. Bring in metadata or build new

    Pull an existing org's metadata with sf project retrieve start, or generate new components such as Apex classes and Lightning Web Components into the package directory. Source tracking on a scratch org tells you what changed on each side.

  4. Commit and deploy

    Initialize git, commit the project, and open pull requests for review. Deploy to an org with sf project deploy start, and let DevOps Center or a CI pipeline handle promotion to production.

--namerequired

The project name, which becomes the folder name and the name value inside sfdx-project.json. Required by sf project generate.

--templaterequired

The project template to scaffold. The standard template produces the force-app source-format layout used for most work; defaults to standard if omitted.

--output-dirrequired

The directory where the project folder is created. Defaults to the current working directory when not supplied.

--default-package-dirrequired

The name of the default package directory, force-app unless you change it. New components land here and it is flagged default in sfdx-project.json.

Gotchas
  • The project, not the org, is the source of truth. Treat any org as rebuildable from the committed project, and pull org-made changes back before you forget them.
  • Do not bulk-convert a large metadata-format project to source format in one shot if you care about git history; convert by metadata type in chunks instead.
  • Keep sfdx-project.json and .forceignore in version control. They define the project shape and what gets deployed, so a teammate who clones the repo needs both.

See the full Local Project entry

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