
Andrew Hanna

Andrew Hanna

TL;DR: A Salesforce unlocked package is a second-generation (2GP) package that bundles metadata into a versioned, upgradeable artifact built from source control, with no required namespace and no IP lock. Salesforce positions it as the right package type for most internal apps unless you plan to sell on AppExchange. It works best when you treat every version as an immutable release, not as metadata anyone can edit in production.
An unlocked package is a container for related metadata: objects, Apex, flows, Lightning components. You create it with Salesforce CLI from a source-format project, version it, and install it into any org you own. Version control is the source of truth, and the Dev Hub that created the package owns it.
The word unlocked is literal. Admins can change package metadata directly in a production org, which is handy for an emergency fix and dangerous for everything else. More on that below.
Most teams arrive at unlocked packages after years of org-to-org deployments. We argued in why every Salesforce DevOps tool ignores package development that the tooling category grew up around that org model, which is why packaging still feels bolted on.
More than before. In its developer guide to Winter '27, Salesforce added 2GP distribution for Multi-Framework apps, recommending unlocked packages for apps you want to keep editable and managed packages for locked, namespaced apps. React and Angular front ends now ship through the same packaging model as your Apex, so the package is becoming the unit of delivery for the whole stack.
sf package create --name Billing --package-type Unlocked --path force-app.
sf package version create --package Billing --code-coverage
--installation-key-bypass --wait 20. Versions start as beta.
sf package version report. Apex
must reach at least 75% coverage before a version can be promoted.
sf package version promote --package "[email protected]".
sf package install --package "[email protected]" --target-org prod --wait 20.
The
CLI reference
is strict on two points: you cannot promote a version created with
--skip-validation, and you cannot combine skip validation with code
coverage.
This is the part most guides skip. The failure modes are operational, not syntactic:
--installation-key-bypass means
anyone with the install link can install the package. Fine for internal pipelines,
risky if the link leaks.
None of these show up in a tutorial. All of them show up in the hidden risks in a Salesforce deployment process, and they are a big part of why Salesforce deployments still break.
Tools differ here, and it is worth checking how. Gearset, for example, has documented warnings when a deployment targets unlocked package components and a Packages affected column in change monitoring, so production edits are caught early.
Serpent treats the package as the release artifact. Its package development support covers 1GP, 2GP and managed packages on every plan, maps dependencies between packages so version conflicts surface before a target org sees them, resolves build and deploy order automatically, and tracks every version against every org it is installed in.
For the empty-org problem, Serpent seeds sample or masked data during environment setup and release pipelines, so scratch orgs and refreshed sandboxes come back populated without a manual script run. PII masking keeps that data production-shaped and usable under GDPR and similar rules. The steps are in the data migration and masking guide.
Do unlocked packages need a namespace?
No. A namespace is optional for unlocked packages, which is one reason they suit internal apps.
Can I edit an unlocked package in production?
Yes, but the next upgrade can overwrite that edit. Commit the fix to source control and release a new version.
What code coverage does an unlocked package need?
At least 75% Apex coverage before you can promote a version to released. Org-dependent unlocked packages are not measured.
Should an ISV use unlocked packages?
Not for AppExchange distribution. Use managed packages for IP protection and namespaced upgrades.
If your team is moving from change sets or another tool to package-based releases, see how a migration to Serpent works or compare plans. New to us? Start with our introduction to Serpent or the Serpent homepage.
Commitment free!