Create Developer Hub and Namespace Orgs
Link a Developer Hub to a namespace org to use the Salesforce Developer Experience to develop a second-generation package.
-
Create an org with Dev Hub features enabled.
-
Create a Developer Edition org.
-
Enable Lightning Experience.
-
Enable Dev Hub features: From Setup, enter
Dev Hubin the Quick Find box and select Dev Hub. Then, click Enable. After you enable Dev Hub, you can’t disable it. -
Enable Unlocked Packages and Second-Generation Managed Packages.
-
-
Create a namespace org.
-
Create a Developer Edition org.
-
Enable Lightning Experience.
-
Choose your namespace carefully. If you’re trying out this feature or need a namespace for testing purposes, choose a disposable namespace. Don’t choose a namespace that you want to use in the future for a production org or some other real use case. After you associate a namespace with an org, you can’t change it or reuse it.
-
In the Dev Hub org, use Namespace Registry to register the namespace that you created. To learn more, see Link a Namespace to a Dev Hub Org.
-
In the
sfdx-project.jsonfile, specify your namespace using the namespace attribute.
-
-
Create an external client app in your Dev Hub org for authorization. The app allows you to set the refresh token timeout, specify IP ranges, and more. Use any name; for example, Dev Hub ECA.
We recommend using an external client app for authorization instead of a connected app. Starting in Spring ’26, customers can’t create a connected app unless they request the ability to create connected apps from Salesforce Support. To migrate a preexisting connected app, see Create an External Client App from a Connected App.
-
To authenticate into the dev hub, use the following Salesforce CLI command. For HUB_ORG_ALIAS, choose any name. For CLIENT_ID, use the consumer key. For INSTANCE_URL, use https://login.salesforce.com. (To find the consumer key, see Step 5.)
-
You are prompted for the external client app secret. To retrieve it and the consumer key:
-
From Setup, enter
External Client App Managerin the Quick Find box and click External Client App Manager. -
Select the external client app for your integration.
-
On the Settings tab, open the OAuth Settings section and click Consumer Key and Secret.
-
Verify your identity with the verification code sent to the email address of your Salesforce account.
-
Copy the consumer key and secret.
-