Scratch Orgs vs. Sandboxes
By the end of this lesson, you'll be able to:
- Distinguish scratch orgs from sandboxes
- Identify the different sandbox types and their use cases
- Choose the right environment type for a given development task
Prerequisites: "Salesforce DX Concepts: Projects and Org Authentication"
What Is a Scratch Org?
A scratch org is a fully-configured, disposable Salesforce org, created on demand from a project-scratch-def.json config file against a connected Dev Hub. It typically lives days to weeks before being deleted and recreated — the whole point is that its exact configuration lives in version-controlled JSON, reproducible by anyone on the team with a single command.
What Is a Sandbox?
A sandbox is a copy of an existing org (usually production), created through Setup rather than a config file. Several types exist:
- Developer — configuration only, no data, smallest limits
- Developer Pro — configuration only, larger limits
- Partial Copy — configuration plus a sample of real data
- Full — a complete copy of production, including all data
Sandboxes are persistent, not disposable, and each refresh has a cooldown period before it can be refreshed again.
Choosing the Right Environment
- Scratch orgs — ideal for individual feature development, CI/CD pipelines, and isolated testing. Fast to create, cheap to throw away, always a clean slate.
- Sandboxes — ideal for QA/UAT that needs realistic, production-like data, integration testing at real data volumes, and staging before a production release.
Why This Matters in Real Projects
Modern Salesforce DX teams typically develop features in scratch orgs — fast iteration, clean slate every time — then promote changes through sandbox stages (QA → UAT → Staging) before reaching production. Knowing which environment serves which purpose is core to any real deployment pipeline, a theme Module 20's capstone returns to.
Exercise
Explain, as a comment, the difference between "push/pull" and "deploy/retrieve" — and which environment type each applies to.
Show hint
One pair relies on automatic source tracking; the other doesn't.
Exercise
Challenge: a QA team needs to test a new feature against realistic customer data volumes before it reaches production. Which environment type should they use, and why?
Show hint
Think about which environment type includes real data.
Scratch Orgs vs. Sandboxes 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
Scratch orgs are disposable, config-driven environments built for fast individual iteration; sandboxes are persistent copies of production built for realistic testing — real projects use both, for different jobs.