Definition
A Scratch Org is a temporary, fully configurable Salesforce environment that developers create from a Dev Hub using Salesforce DX. Scratch Orgs are designed for development and testing, can be spun up in seconds with a specific configuration defined in a JSON file, and are automatically deleted after a maximum of 30 days.
Real-World Example
A developer at Cirrus Labs starts her morning by running "sf org create scratch" to spin up a fresh Scratch Org configured with Service Cloud features enabled. She pushes her source code, runs all Apex tests, and verifies the new Flow works correctly. After merging her pull request, the Scratch Org is no longer needed and will auto-expire in a few days.
Why Scratch Org Matters
A Scratch Org is a temporary, fully configurable Salesforce environment created from a Dev Hub using Salesforce DX. Unlike traditional sandboxes that are copies of production, Scratch Orgs are built from scratch based on a JSON configuration file that specifies which features and settings to enable. They spin up in seconds, can be customized for specific development tasks, and automatically expire after a maximum of 30 days. This approach supports modern source-driven development workflows where the source of truth lives in a version control system like Git rather than in a persistent Salesforce org.
Scratch Orgs transform how development teams work by enabling isolated, disposable environments for each feature branch or developer. This eliminates the common problems of shared development sandboxes where multiple developers overwrite each other's work or deal with polluted test data. Each developer can spin up a clean Scratch Org, push their source code, run tests, and validate their changes in isolation. When the work is merged, the Scratch Org can be discarded. Organizations that adopt Scratch Orgs as part of their Salesforce DX workflow see faster development cycles, fewer environment-related bugs, and more confident deployments because every change is tested in a clean, known state.
How Organizations Use Scratch Org
- Cirrus Labs — A developer at Cirrus Labs starts each morning by running the sf org create scratch command to spin up a fresh Scratch Org with Service Cloud features enabled. She pushes her source code from the Git branch, runs all Apex tests, and verifies the new Flow works correctly. After merging her pull request, the Scratch Org auto-expires in a few days.
- NovaBuild Software — The QA team at NovaBuild spins up dedicated Scratch Orgs for each release candidate. Testers get clean environments with only the features under test enabled, ensuring that test results are not contaminated by leftover data or configurations from previous testing cycles.
- Stratosphere Consulting — Consultants at Stratosphere create Scratch Orgs configured to match each client's org features and settings. This allows them to develop and demo customizations in an environment that closely mirrors the client's production setup without needing access to the actual client org during the build phase.