On September 25th, 2024, we released v2 of the Apps SDK. To learn what’s new and how to upgrade, see Migration FAQ and Migration guide.

Digital Asset Management app

Retrieve content from a backend and make it available to a Canva app.

You can build a digital asset management (DAM) app that retrieves content from a backend and makes it available to a Canva app.

To help you get started, Canva has created a template DAM app that you can install and customize, using the @canva/create-app(opens in a new tab or window) command-line interface (CLI).

This article shows you how to install the example DAM app, run it locally on your machine, and start adding customizations.

Step 1: Install the DAM app

This step installs the DAM app and its dependencies in a new directory.

  1. Use the following command to install and run @canva/create-app(opens in a new tab or window):

    npx @canva/create-app@latest
    BASH
  2. Use the arrow keys to select Digital Asset Management, then press enter.

  3. The installation process guides you through the remaining settings:

    1. Enter your app's name.
    2. Choose whether to initialize a git repository for your project.
    3. Choose whether your project should use npm to install its dependencies.

After the installation process has completed, the output lists the steps for running the new app. For example:

cd example-dam-app
npm start
BASH
  • Replace example-dam-app with your app's name.

Step 2: Create a new Canva app

Create a new Canva app in the Developer Portal(opens in a new tab or window). For more information, see Creating apps.

Step 3: Configure the environment file

Open the .env file in your project's root directory and add your app's ID to the CANVA_APP_ID setting. To find this value, open Your apps(opens in a new tab or window), find the app you created in step 2, and copy the ID from the App ID column.

CANVA_APP_ID=<your App ID>
BASH

Step 4: Preview your app

Run the app locally to see a preview.

  1. Navigate to your app's directory and start the app. The example-dam-app directory name will vary based on your app's name.

    cd example-dam-app
    npm start
    BASH
  2. In Your apps(opens in a new tab or window), select your app, then Configure your app > App source > Development URL.

  3. In the Development URL field, enter the URL of the Development URL (Frontend).

  4. Click Preview. This opens a new tab in the Canva editor, with your app in the sidebar.

  5. Click Open. This message only appears when using an app for the first time.

Step 5: Customize the DAM app

The example DAM app should now be running locally. In the preview, you can see tabs called All, Collection, and Assets. This procedure demonstrates how to rename a tab.

To customize the view, container type, layout, search, and more, see the SearchableListView(opens in a new tab or window) component.

  1. In your IDE, open the canva-apps-sdk-starter-kit/examples/digital_asset_management/config.ts file.

  2. In your IDE, open the src/config.ts file and change label: "Folders", to label: "My Folders",

    containerTypes: [
    {
    value: "folder",
    label: "Folders",
    listingSurfaces: [
    { surface: "HOMEPAGE" },
    {
    surface: "CONTAINER",
    parentContainerTypes: ["folder"],
    },
    { surface: "SEARCH" },
    ],
    searchInsideContainer: {
    enabled: true,
    placeholder: "Search for resources inside this folder",
    },
    },
    ],
    TYPESCRIPT
  3. Save the changes to config.ts.

  4. Click to reload the app. The renamed tab should now be visible in the preview.

Screenshot featuring the reload button

Step 6: Connect to a backend

To retrieve digital assets, connect the app to your backend. For more information, see Using a backend.

Step 7: Add user authentication

Update your app to add user authentication. You can use frictionless or manual authentication:

  • Frictionless: To implement frictionless authentication, add App ID and JWT verification middleware to your app. This approach uses the auth.getCanvaUserToken() method to receive a JWT. For more information, see JSON Web Tokens. For an example, see the authentication demo(opens in a new tab or window) in the canva-apps-sdk-starter-kit repository.
  • Manual: Alternatively, you can configure your app for manual authentication with a third-party platform.

Localization

To localize this template for all supported locales:

  1. Ensure that the app has otherwise been localized in accordance with the recommended localization workflow.
  2. Use the latest version of the @canva/app-components package.

The literal strings in the SearchableListView component will be localized automatically as long as your app follows the localization workflow and uses the latest version of @canva/app-components.

Next steps

Once your app is ready, submit it on the Developer Portal. For more information, see Submitting apps.