Marketplace apps often interact with Contentstack APIs. Apps Permissions ensure apps only have defined access to the resources they need; improving security, trust, and governance.
Benefits for different roles:
In this guide, we will walk through building an app example for a Quick Info Dashboard App. We will demonstrate how an app can leverage Apps Permissions to securely interact with Contentstack APIs.
This example app highlights a real-world scenario where stack-level statistics (content types, entries, and assets) are displayed in a Dashboard location.
The Quick Info Dashboard App displays stack-level statistics (for example, Content Types, Entries, and Assets).

The best place to start a new project is by cloning the Marketplace App Boilerplate. It has all the components you need for rapid dashboard UI Location development.
Clone the Marketplace Boilerplate repository and run the following commands:
npm install npm run dev
To register an app in Developer Hub, perform the steps given below:
Additional Resource: Refer to the Creating an App in Developer Hub documentation to know more about Standard and Machine to Machine app categories.



Note: The name for each UI Location is optional, and can be used to override the default app name.

Note: The Save button becomes active once all required fields are completed.
After development, you can host your application using Contentstack Launch.

Permissions control which Contentstack APIs your app can access.
For the Quick Info App, configure the following permissions in Developer Hub. To do so, follow the steps below:


| Module | Access | Endpoint |
|---|---|---|
| Content Types | /v3/content_types | |
| Entries | /v3/content_types/{uid}/entries | |
| Assets | /v3/assets |
Run the following command to navigate to the Dashboard Widget folder:
cd src/containers/DashboardWidgetCreate a new file named StackMetrics.tsx and add the following code snippet.
This component fetches stack statistics for Content Types, Entries, and Assets using the Contentstack Management SDK and displays them in a widget format.
import { useState, useEffect, useCallback } from "react";
import { useAppSdk } from "../../common/hooks/useAppSdk";
import { useManagementClient } from "../../common/hooks/useManagementClient";
export const StackMetrics = () => {
const appSdk = useAppSdk();
const managementClient = useManagementClient();
const [stats, setStats] = useState({ contentTypes: 0, entries: 0, assets: 0 });
const fetchStackStats = useCallback(async () => {
if (!appSdk || !managementClient) return;
const stack = managementClient.stack({ api_key: appSdk.ids.apiKey });
const { count: contentTypeCount } = await stack.contentType().query({ include_count: true }).find();
const { count: assetCount } = await stack.asset().query({ include_count: true }).find();
// Fetch all content types and count total entries
const contentTypes = await stack.contentType().query().find();
const entryCounts = await Promise.all(
contentTypes.items.map(async (ct) => {
const res = await stack.contentType(ct.uid).entry().query({ include_count: true }).find();
return res.count ?? 0;
})
);
setStats({
contentTypes: contentTypeCount,
entries: entryCounts.reduce((a, b) => a + b, 0),
assets: assetCount,
});
}, [appSdk, managementClient]);
useEffect(() => {
fetchStackStats();
}, [fetchStackStats]);
return (
<div>
<h3>Stack Metrics</h3>
<ul>
<li>Content Types: {stats.contentTypes}</li>
<li>Entries: {stats.entries}</li>
<li>Assets: {stats.assets}</li>
</ul>
</div>
);
};Note: For the complete implementation, refer to the StackMetrics GitHub repo.
Import your component:
Open ./src/containers/DashboardWidget/StackDashboard.tsx and import your component. You need to replace the entire code with the following code snippet:
import "../index.css";
import "./StackDashboard.css";
import { StackMetrics } from "./StackMetrics";
const StackDashboardExtension = () => {
return (
<div className="layout-container">
<StackMetrics />
</div>
);
};
export default StackDashboardExtension;
Warning: Without the Content Types: Read permission, this call will fail with a 403 permission denied error.
To install and test the app, follow the steps below:
npm run dev




If you do not use the example app configuration, the Marketplace App Boilerplate shows the following configuration on the Stack Dashboard.

The app is now available as a Stack Dashboard app that utilizes the Permissions feature in conjunction with Management SDK and the AppSDK Adapter.
Full permissions test:
Limited permissions test: