Setting up Salesforce DaaS means enabling a Dev Hub, installing the Salesforce CLI, structuring a Git repository, and creating your first scratch org. From there, you build on the same primitives.
- Enable Dev Hub in production
Setup, then Dev Hub, then Enable Dev Hub. Confirm the warning (the feature cannot be disabled later) and save. The org is now your scratch-org quota provider.
- Install the Salesforce CLI
Download from developer.salesforce.com/tools/sfdxcli. Verify with sf --version. The CLI installs globally and updates monthly.
- Authenticate the CLI against your Dev Hub
Run sf org login web --alias DevHub --set-default-dev-hub. A browser opens; log in with the Dev Hub admin credentials. The CLI stores the authorization and uses it for every scratch-org operation.
- Create a Salesforce DX project
Run sf project generate --name MyProject. The CLI scaffolds a Git-friendly directory structure with force-app/main/default, sfdx-project.json, and config/project-scratch-def.json.
- Spin up your first scratch org
From the project directory, run sf org create scratch --definition-file config/project-scratch-def.json --alias myorg --duration-days 7. In about 60 seconds you have a fresh org you can deploy to.
- Deploy and test against the scratch org
Run sf project deploy start --target-org myorg to push metadata. Run sf apex test run --target-org myorg --result-format human to execute tests. Both commands work the same way against any org the CLI knows about.
The production org that authorizes scratch-org creation. Required for any DaaS workflow.
The unified command-line tool. Authenticates against orgs, deploys metadata, manages scratch orgs.
Disposable Salesforce orgs, defined by project files. Default 7-day lifespan.
The DaaS packaging model. Versioned, dependency-aware, deployable via the CLI.
- Dev Hub cannot be disabled. Enabling it on a sensitive production org is a one-way door; consider enabling it on a dedicated sandbox parent org if you have one.
- Scratch orgs are NOT sandboxes. They cannot accept Change Sets and they expire automatically. Long-running QA environments still need actual sandboxes.
- CLI authentication tokens expire. Refresh them with sf org login web when you start a new day or move to a new machine.
- DaaS workflows fall apart without Git discipline. Source-driven development assumes the source IS the truth; orgs are projections of the source. Treating sandboxes as the truth is the pre-DaaS pattern.