Create and Register Your Namespace for Second-Generation Managed Packages
With second-generation managed packaging (managed 2GP), you can share a single
namespace with multiple packages. Since sharing of code is much easier if your package shares
the same namespace, we recommend that you use a single namespace for all of your managed 2GP
packages.
To create a namespace:
- Sign up for a new Developer Edition org.
- In Setup, enter Package Manager in the Quick Find box, and select Package Manager.
- In Namespace Settings, click Edit.
- Enter a namespace and select Check Availability.
- (Optional) Select a package to associate with this namespace , or select None, then click Review.
- Review your selections, and then click Save.
To register a namespace:
- To link the namespace that you created with your Dev Hub, use Namespace Registry. See Link a Namespace to a Dev Hub Org for details.
- In the sfdx-project.json file, specify your namespace using the namespace attribute. When you create a new 2GP package, the package is associated with the namespace specified in the sfdx-project.json file.