Digital Asset Management 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/cli(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: Create a new app using the DAM app template
-
Install the Canva CLI(opens in a new tab or window) globally:
npm install -g @canva/cli@latestSHELL -
Log in to the Canva CLI. This command opens an access request page in your browser:
canva loginSHELL -
Click Allow to grant the Canva CLI permission to manage your Canva apps.
-
Copy the confirmation code from your browser and paste it into the Canva CLI input.
-
Use the following command to create a new app using the DAM template:
canva apps create --template "dam"BASH -
The setup process guides you through the remaining settings:
- Choose the audience your app.
- Enter a name for your app.
- Choose whether to initialize a git repository for your project.
- Choose whether your project should use npm to install its dependencies.
After the setup process has completed, the output lists the steps for running the new app. For example:
cd example-dam-appnpm start
- Replace
example-dam-app
with your app's name.
Step 2: Preview your app
Run the app locally to see a preview.
-
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-appnpm startBASH -
In Your apps(opens in a new tab or window), select your app, then Configure your app > App source > Development URL.
-
In the Development URL field, enter the URL of the Development URL (Frontend).
-
Click Preview. This opens a new tab in the Canva editor, with your app in the sidebar.
-
Click Open. This message only appears when using an app for the first time.
Step 3: 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.
-
In your IDE, open the
canva-apps-sdk-starter-kit/examples/digital_asset_management/config.ts
file. -
In your IDE, open the
src/config.ts
file and changelabel: "Folders",
tolabel: "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 -
Save the changes to
config.ts
. -
Click ↻ to reload the app. The renamed tab should now be visible in the preview.
Step 4: Connect to a backend
To retrieve digital assets, connect the app to your backend. For more information, see Using a backend.
Step 5: 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 thecanva-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:
- Ensure that the app has otherwise been localized in accordance with the recommended localization workflow.
- 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.