Scratch Orgs
By the end of this lesson, you'll be able to:
- Explain what a scratch org is and how it differs from a traditional sandbox
- Recognize the disposable, source-driven nature of scratch orgs
- Understand why this fits naturally with Module 14's branching workflow
Prerequisites: "What Is Salesforce DX?"
Disposable, not persistent
A traditional sandbox is a long-lived copy of production, manually maintained over time. A scratch org is deliberately temporary — created fresh from source-controlled metadata in minutes, used for a specific piece of work, then deleted entirely once that work is done. Nothing about it is meant to persist.
Created entirely from source
sf org create scratch --definition-file config/project-scratch-def.json --alias my-feature-org
sf project deploy start --target-org my-feature-org
A scratch org's configuration (project-scratch-def.json) and its actual metadata both come from source-controlled files — this is the direct, practical consequence of Module 40's opening lesson: the org is generated from code, not the other way around.
Why this fits Module 14's branching workflow naturally
git checkout -b feature/loyalty-discount
sf org create scratch --alias loyalty-feature-org
# develop and test entirely in this disposable org
git push origin feature/loyalty-discount
sf org delete scratch --target-org loyalty-feature-org
One scratch org per feature branch (Module 14's branching pattern) means a developer's in-progress work is fully isolated — not just at the code level, but at the actual Salesforce environment level too — with zero risk of one feature's half-finished configuration leaking into another's testing.
Exercise
As a comment, explain why a scratch org is well suited to Module 14's "one feature, one branch" workflow specifically.
Show hint
Think about what a persistent, shared sandbox would risk instead.
Scratch Orgs Quiz
My Notes
Log in to keep private notes on this lesson.
Questions about this lesson
No questions yet — be the first to ask.
Log in to ask a question about this lesson.
Summary
A scratch org is a temporary, disposable Salesforce environment created entirely from source — the natural environment for developing and testing one specific branch of work.