---
schema_version: "1"
id: 97fd23fb3c15c193f28cba4252428e3d50b824ffc11d953b714e45b0d275a940
title: Installation and Deployment
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/industries/cme/guides/comms-t-installation-and-deployment.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-installation-and-deployment.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7b8d3ef752af1859e819a71974094a7628989e1c78f7a0e78c5a555e911c25e4
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# Installation and Deployment

To use the Digital Commerce SDK, you must first import the node_module for it. Follow the steps here:

1.  Add the digitalcommerce-sdk dependency in your package.json, as shown here:

    ```nolang
    "dependencies": {
    	// Existing dependencies
        "@vlocity-cme-sdk/digitalcommerce-sdk" : "^109.0.1"
      }
    ```

2.  Create an NPM configuration file called `.npmrc`. The `.npmrc` file is needed to authenticate with the private npm registry. Here is a sample:

    ```nolang
    email=you@example.com
    always-auth=true
    _auth=<password> (see Note, below)
    registry=https://repo.vlocity.com/repository/npm-public/
    ```

    **note:** To obtain the password for the .npmrc file:

    - Contact Salesforce Customer Support. Note that you must have purchased a CPQ License.

    For public access, use the default authorization token mentioned in the above example.

    ```nolang
    // To fetch the module you would need to run
    npm install
    ```

    The artifact can be found in the node_modules folder under the module name @vlocity-cme-sdk/digitalcommerce-sdk

3.  You can access digitalcommerce.sdk.js either from node_modules (inside the above-mentioned folder) or by moving it inside public/static resource of the application that is using it. Following is an example of what it should look like:

    ```nolang
    <script type="text/javascript" src="../digitalcommerce-sdk/digitalcommerce.sdk.js"></script>
    ```

    Once the digitalcommerce.sdk.js is added into the application, the following steps can be followed for using it.

4.  Instantiate DigitalCommerceSDK:

    ```nolang
    // Instantiate DigitalCommerceConfig for anonymous user
    const digitalCommerceConfig = VlocitySDK.digitalcommerce.createConfigForAnonymousUser();

    // Instantiate the SDK itself
    const digitalCommerce = VlocitySDK.digitalcommerce.getInstance(digitalCommerceConfig);

    OR

    // Instantiate DigitalCommerceConfig for login user
    const digitalCommerceConfig = VlocitySDK.digitalcommerce.createConfigForLoginUser(salesforceUrl, sessionToken);

    // Instantiate the SDK itself
    const digitalCommerce = VlocitySDK.digitalcommerce.getInstance(digitalCommerceConfig);

    // To override the default namespace with your custom namespace
    this.digitalCommerce.namespace = "vlocity_cmt"; // use your custom namespace

    Note:
    digitalCommerce is a Singleton object.  Calling getInstance(digitalCommerceConfig) repeatedly will return the same instance instantiated the first time when getInstance(digitalCommerceConfig) was called.

    To instantiate a new instance of digitalCommerce, set create to true in the digitalCommerceConfig object:
    digitalCommerceConfig.create = true;
    digitalCommerce = VlocitySDK.digitalcommerce.getInstance(digitalCommerceConfig);

    // To override the anonymous site url with your custom url
    digitalCommerce.apiURL =
      "https://myaws.execute-api.us-west-2.amazonaws.com/prod/dc"; // use your AWS gateway
    ```
