The basic workflow: generate the project, authenticate orgs, retrieve or deploy metadata, commit to git, iterate.
- Generate the project
Run sf project generate -n my-project. The CLI creates the folder structure with sfdx-project.json and the force-app directory.
- Authenticate against an org
Run sf org login web -a my-org-alias. The browser opens; complete the OAuth handshake. The org token is stored locally.
- Set the default org
Run sf config set target-org=my-org-alias. Subsequent commands default to this org without needing the -o flag.
- Retrieve metadata
Run sf project retrieve start to pull metadata from the org into the Local Project. Pick specific metadata types via the -m flag.
- Open in VS Code
Open the project folder in VS Code with the Salesforce Extensions Pack installed. The IDE recognizes the SFDX structure automatically.
- Edit, commit, deploy
Edit source files; commit changes via git; deploy with sf project deploy start. Iterate.
The root manifest declaring project structure.
Typically force-app, holding all metadata source files.
The command-line tool that operates against the project.
An org alias the CLI can deploy to.
Version control for the Local Project.
- Legacy Metadata API-format projects do not work with modern SFDX commands without conversion. Use sf project convert source to migrate.
- Source tracking is available only on scratch orgs and developer sandboxes. Production deployments need explicit manifest-based deploys.
- Salesforce CLI authentication is local. Loss of the developer machine means re-authenticating; tokens cannot be recovered remotely.
- The Salesforce CLI evolves quickly. Stay on the latest version to access new commands and bug fixes.