Packaging Your Commerce App
Package your Commerce App into a CAP (Commerce App Package) for distribution.
Your packaged Commerce App must conform to the CAP structure defined in Architecture Overview. The ZIP must contain a single root directory named commerce-{app-name}-app-v{version}/ and contain only the recognized subdirectories.
commerce-app.jsonat the root of the package (see commerce-app.json Schema)README.mdat the root of the packageapp-configuration/tasksList.jsondefining the setup wizardicons/directory with at least one icon file named{isv-name}.{ext}(PNG, SVG, JPG, or JPEG)- At least one of:
cartridges/(back-end logic),storefront-next/(frontend extensions), orimpex/(configuration data)
This file defines the post-install configuration steps that appear in the Business Manager setup wizard. Each task has a task number, name, description, a deep link to the relevant BM page, and an initial status.
Example:
The impex/ directory contains site-scoped XML organized into install/ and uninstall/ subdirectories. The install/ directory is processed during app installation; the uninstall/ directory during removal.
Within install/, use standard Commerce Cloud IMPEX conventions:
jobs.xmlfor job definitionsservices.xmlfor service credentials, profiles, and definitionsmeta/system-objecttype-extensions.xmlfor system object attribute extensionsmeta/custom-objecttype-definitions.xmlfor custom object type definitionssites/SITEID/preferences.xmlfor site preferences
The install job automatically replaces SITEID and LIBRARYID placeholders in both file paths and file content during processing. Placeholder replacement applies to the following text file types: .xml, .csv, .txt, .json, .properties, .js. Binary files are copied as-is without replacement.
- Use
SITEIDin directory paths (for example,sites/SITEID/preferences.xml) and inside XML content for site-scoped data. - Use
LIBRARYIDfor content library references. The library ID is resolved from the target site’s content library at install time. - Empty text files are skipped during processing.
Example placeholder usage in preferences.xml:
Install IMPEX files are processed via Site Import in merge mode, meaning they add or update data without deleting existing resources. Use placeholder credentials in service definitions — merchants configure real credentials during the post-install setup tasks.
Example impex/install/services.xml:
Important: Use dotted notation for service IDs (for example,
myapp.api) and camelCase with an app prefix for attribute IDs (for example,myAppEnabled). Do not hardcode production credentials.
The impex/uninstall/ directory contains XML files that clean up resources when the app is removed. Uninstall IMPEX files should use mode="delete" to remove services, profiles, and credentials.
During installation, the platform serializes the contents of impex/uninstall/ and persists them in the CommerceFeatureState record. At uninstall time, the platform reconstructs these files from persisted state — the original CAP archive isn’t needed for uninstall.
Deletion order matters: Delete in this order to respect foreign key relationships: service → profile → credential.
Example impex/uninstall/services.xml:
Note: Uninstall IMPEX only runs when the last site uninstalls the app, because services and custom object definitions are instance-scoped resources shared across all sites. See Multi-Site Behavior for details.
| Resource | Convention | Example |
|---|---|---|
| Service IDs | Dotted notation | avalara.tax.api |
| Attribute IDs | camelCase with app prefix | avalaraTaxEnabled |
| Custom object IDs | camelCase with app prefix | avalaraTaxConfig |
| Credential IDs | Dotted notation | avalara.tax.api.cred |
| Profile IDs | Dotted notation | avalara.tax.api.profile |
The Commerce Apps repository includes Claude Code skills that automate packaging and validation. See the full skill catalog in Development Environment Setup — Claude Code Skills.
Typical packaging workflow:
/scaffold-app— Generate initial app structure- Build your app code and logic
/generate-service-impex,/generate-site-preferences-impex— Generate IMPEX files/validate-impex— Validate IMPEX files during development/package-app— Package app into ZIP/validate-app— Comprehensive pre-submission validation/submit-pr— Submit to the registry
If you aren’t using Claude Code, follow these steps:
-
Organize your project into the CAP directory structure.
-
Ensure
commerce-app.jsonfields (id,version,domain) match the App Registry root manifest entry. -
Run
b2c cap validateto verify structure, manifest, and file integrity. -
Run
b2c cap packageto produce the.zipartifact. The ZIP must contain a single root directory:commerce-{app-name}-app-v{version}/. -
Verify the ZIP contains no junk files (
.DS_Store,__MACOSX, hidden files). Use exclusion flags when creating the ZIP manually: -
Compute the SHA256 hash and verify it matches the manifest:
-
Test the packaged
.zipon a sandbox before submitting to the registry.