Sub topic 1
The Org Landscape: Sandboxes and Scratch Orgs
Prerequisites
This chapter assumes that you know basic Salesforce administration, metadata deployment, command-line use, and Git. You should also understand that production is the live org, while non-production orgs are used for development and testing.
The Org Landscape
A Salesforce production org is the live environment that serves users and stores business data. A sandbox is a copy of production metadata, and sometimes production data, used for safer development and testing. A scratch org is a temporary, configurable org created from a Dev Hub. A Developer Edition org is a separate, free Salesforce org with fixed limits. It is useful for learning and small experiments, but it is not a copy of your production org.
Sandbox Types
Choose a sandbox by the data and testing fidelity you need.
| Type | Data | Typical use |
|---|---|---|
| Developer | No production records | Metadata and code development |
| Developer Pro | No production records | Larger development and integration tests |
| Partial Copy | Template-selected records | User acceptance testing with representative data |
| Full | All production records | Realistic performance and end-to-end testing |
Developer and Developer Pro sandboxes contain production configuration, but records must be created or loaded separately. Partial Copy and Full sandboxes require careful data protection.
Creating and Refreshing Sandboxes
An administrator creates a sandbox from Setup or the Salesforce CLI. A refresh replaces the sandbox with a newer copy of its source. Refreshing can remove work and data in the target sandbox, so teams should export anything they need first. Typical refresh intervals are about one day for Developer and Developer Pro, five days for Partial Copy, and 29 days for Full sandboxes.
Scratch Orgs and the Dev Hub
A Dev Hub is a production org feature that manages scratch org creation. Scratch orgs are source-driven: the definition file describes the starting configuration, and Git remains the source of truth. They usually last from one to 30 days and are disposable.
sf org login web --set-default-dev-hub --alias devhub
sf org create scratch --definition-file config/project-scratch-def.json \
--alias my-scratch --duration-days 7 --set-default
sf project deploy startScratch org allocation limits depend on the Dev Hub edition and licensing. Use them for focused development and automated tests, not as permanent shared environments.
Exercise
Which environment is the best default for a short-lived feature branch: a Full sandbox or a scratch org?
Show answer
A scratch org, because it is temporary, reproducible, and designed for source-driven development.