Sub topic 1
The problem: one big org, one big deployment
Prerequisites
This chapter assumes you know:
- Basic Salesforce metadata: objects, fields, Apex classes, and permission sets.
- Salesforce DX basics: scratch orgs and the Salesforce CLI.
- Git and source-driven development.
- Apex tests and code coverage.
How orgs grow into one big deployment
Most orgs start small. A few custom objects, some Apex classes, and a handful of flows are enough. Over the years, more teams add more metadata. After a while, nobody can say which pieces belong together.
Without structure, the whole org behaves like a single unit. Every change travels with every other change. This is the "one big org, one big deployment" problem.
Symptoms you will recognise
- Unclear ownership. A custom field is used by three teams. No one knows who may change it or delete it.
- Large, risky deployments. A change set or a
force-appdeployment carries many unrelated components. One failing component blocks the rest. - No version history in the org. The org holds the current metadata only. You cannot ask it "what did the billing feature look like last quarter?"
- Hidden dependencies. An Apex class refers to a field that sits in another team's area. The link shows up only when a deployment fails.
- Slow validation. Deploying to production runs many tests, even for a small change.
Why change sets and a single source folder fall short
Change sets move a selected group of components between connected orgs. They have no version number, no dependency declaration, and no way to be rebuilt from source. A single force-app directory in Git improves the situation, because history now lives in version control. However, it still describes one undivided blob. Git cannot tell you where one feature ends and the next one starts.
What packaging changes
Packaging splits metadata into named units. Each unit has its own directory, its own version numbers, and its own declared dependencies. Unlocked packages are the form aimed at this goal. You will compare them with unmanaged and managed packages in the next chapter.
The diagram shows the shift in how metadata moves to an org.
With packages, a team builds and installs only the unit it changed. Dependencies tell the installer the right order.
What you will build
By the end of this tutorial you will define packages in sfdx-project.json, build and promote versions, and install them in an org. You will also plan a move of existing metadata into packages and automate the process in CI/CD.
Exercise
An org keeps all its metadata in one force-app folder in Git and deploys it with change sets. Name two problems this setup still has, even though the code is in version control.
Show answer
Any two of these: there is no declared grouping of metadata, so ownership is unclear. Dependencies between components are hidden until a deployment fails. Change sets have no version numbers, so you cannot install a specific earlier release. Deployments are large, so one failing component can block unrelated changes.