Appnigma

How to Create a Managed Package in Salesforce (2GP)

create managed package

May 27, 2026

5 min read

How to Create a Managed Package in Salesforce (2GP)

To create a managed package in Salesforce, you enable Dev Hub, register a unique namespace, build your components, and assemble them as a second-generation (2GP) managed package using the Salesforce CLI. For AppExchange distribution, you then pass the security review and list it. The traditional path needs Apex and CLI skills; a no-code platform generates the same package from a description.

Pro Tip

TL;DR: Create a managed package by enabling Dev Hub, registering a namespace, building components, and packaging with 2GP via the Salesforce CLI (Salesforce 2GP Guide). For the AppExchange, add the security review and listing. No-code platforms generate the package without the CLI.

How do you create a managed package?

The modern way is second-generation packaging (2GP), which Salesforce recommends for all new managed packages. The core sequence:

  1. Enable Dev Hub in your org. This feature lets you create and manage 2GP packages, versions, and scratch orgs (Salesforce).

  2. Register a namespace in a namespace org and link it to your Dev Hub's Namespace Registry. The namespace is the unique prefix on all your components.

  3. Build your components (objects, fields, Apex, Lightning Web Components, flows) as source.

  4. Create the package and a version with the Salesforce CLI, then install and test it in a scratch org.

  5. Promote the version to released so it can be installed by customers.

What you need before you start

Three prerequisites gate the build: an org with Dev Hub enabled, a registered namespace, and the Salesforce CLI set up for source-driven development. These are exactly the pieces that make this a developer task, because each step runs through the CLI and Setup rather than a point-and-click flow.

Pro Tip

Our finding: The namespace and Dev Hub setup is where non-developers get stuck. It is not conceptually hard, but it assumes comfort with the Salesforce CLI and scratch orgs that admins and founders usually do not have.

Creating a managed package for the AppExchange

For AppExchange distribution, the package itself is the same; you add two steps. After you have a released managed package version, you submit it for the security review ($999 per submission for paid apps) and create your listing in the Partner Console. The packaging work does not change between an internal managed package and an AppExchange one; the review and listing are what make it distributable. See our guide on getting your app on the AppExchange.

The no-code way to create a managed package

If you do not write Apex or use the Salesforce CLI, a no-code platform creates the managed package for you. You describe the app, and the platform generates the components, registers the namespace, and assembles a 2GP managed package, handling Dev Hub and the CLI steps in the background. Appnigma AI does this and prepares the output for the security review. See building a managed package without a Salesforce developer.

Frequently Asked Questions

What are the steps to create a managed package in Salesforce?

Enable Dev Hub, register a namespace, build your components, create a 2GP package and version with the Salesforce CLI, test in a scratch org, and promote the version to released (Salesforce 2GP Guide).

How do I create a managed package for the AppExchange?

Build the managed package the same way (2GP), then submit it for the security review ($999 per submission for paid apps) and create your listing in the Partner Console. The packaging is identical; the review and listing make it distributable.

Do I need the Salesforce CLI to create a managed package?

For the traditional 2GP path, yes. No-code generation platforms remove that requirement by handling Dev Hub, the namespace, and the CLI steps for you, producing the managed package from a description.

What is the difference between 1GP and 2GP packaging?

1GP ties the namespace to one packaging org and uses Setup. 2GP is source-driven, uses Dev Hub and a namespace registry, and supports multiple packages per namespace. Salesforce recommends 2GP for all new managed packages.

About the author. Sunny Chauhan is the founder and CEO of Appnigma AI, a no-code platform that generates Salesforce AppExchange-ready managed packages. He helps SaaS teams create packages without an engineering build.

Key Takeaway

To create a managed package in Salesforce, enable Dev Hub, register a namespace, build your components, and assemble a second-generation (2GP) package with the Salesforce CLI, then test and promote the version. For the AppExchange, add the security review and listing. Appnigma AI generates the managed package no-code, handling Dev Hub, namespace, and CLI steps automatically.

Sources

  1. Salesforce 2GP Developer Guide

  2. Salesforce, Enable Dev Hub and Second-Generation Managed Packaging

  3. Salesforce Trailhead, ISV Security Review (fee)

Ready to transform your Salesforce experience?

Start exploring the Salesforce Exchange today and discover apps that can take your CRM efficiency to the next level.

decorative section tag

Blog and News

Our Recent Updates