Extend Strapi 5 admin panel with a custom plugin
Learn step‑by‑step how to create a Strapi 5 admin plugin that adds a new main‑menu link, a dedicated settings page, and a role‑controlled side‑panel in the Content Manager, using the admin panel API and Content Manager APIs.
By the Revisionary team · · 3 min read

You can add a new menu entry, a dedicated settings page, and a side‑panel that only appears for users with a specific permission by creating a Strapi 5 admin plugin. The plugin registers itself in the admin lifecycle, uses app.addMenuLink and app.addSettingsLink to create navigation items, and injects a side‑panel through the Content Manager APIs.
Below is a complete, production‑ready walkthrough that covers project scaffolding, the required admin‑panel hooks, role‑based visibility, and TypeScript tips. The example assumes Strapi 5, Node 18+, and a PostgreSQL database, matching the official requirements.
1. Scaffold the plugin
Strapi provides a CLI command to generate a plugin skeleton:
# From the Strapi project root
npm run strapi generate
# Choose "plugin" and name it, e.g. "my-admin-plugin"The command creates a folder ./src/plugins/my-admin-plugin with the following structure (relevant parts only):
my-admin-plugin/
├─ admin/
│ ├─ src/
│ │ ├─ index.js # admin entry point
│ │ └─ components/ # React components used by the plugin
│ └─ package.json
└─ server/
└─ ... # backend code (optional for this tutorial)All admin code lives under admin/src. We will edit index.js and add a few components.
2. Register the plugin in the admin lifecycle
Strapi 5 admin plugins expose three lifecycle functions: register, bootstrap, and registerTrads. The register function runs once when the admin loads, making it the right place for navigation registration.
// my-admin-plugin/admin/src/index.js
export default {
// Called before the admin UI is rendered
register(app) {
// 1️⃣ Register a main‑menu link
app.addMenuLink({
to: '/plugins/my-admin-plugin',
icon: 'plug', // any FontAwesome icon name
intlLabel: {
id: 'my-admin-plugin.menu.link',
defaultMessage: 'My Plugin',
},
// Show the link only to users with the custom permission
permissions: [{ action: 'plugin::my-admin-plugin.read', subject: null }],
Component: async () => import('./pages/MainPage'),
position: 3, // position in the menu (optional)
});
// 2️⃣ Register a settings section under the Settings page
app.addSettingsLink('global', {
id: 'my-admin-plugin.settings',
intlLabel: {
id: 'my-admin-plugin.settings.link',
defaultMessage: 'My Plugin Settings',
},
to: '/settings/my-admin-plugin',
Component: async () => import('./pages/SettingsPage'),
permissions: [{ action: 'plugin::my-admin-plugin.settings', subject: null }],
});
// 3️⃣ Add a reducer if you need custom state (optional)
// app.addReducers([{ name: 'myPlugin', reducer: myReducer }]);
},
// Called after the UI is ready – good for injection zones
bootstrap(app) {
// Inject a side‑panel into the Content Manager edit view
const contentManager = app.getPlugin('content-manager');
if (contentManager) {
contentManager.apis.addEditViewSidePanel([
{
name: 'my-admin-plugin.side-panel',
Component: async () => import('./components/SidePanel'),
// The panel will appear only for users with the permission below
permissions: [{ action: 'plugin::my-admin-plugin.side-panel', subject: null }],
},
]);
}
},
// Provide translations for the UI labels
registerTrads(app) {
return import('./translations/en.json').then(({ default: data }) => {
app.addTranslations(data);
});
},
};2.1 Permissions are only for visibility
The permissions arrays above hide the navigation items from users lacking the specified RBAC action. They do not protect the underlying route. Inside each React component you must still call useRBAC or check useFetchClient responses to enforce server‑side security.
3. Create the React components
3.1 Main page component
// my-admin-plugin/admin/src/pages/MainPage.tsx
import React from 'react';
import { Box, Typography } from '@strapi/design-system';
export default function MainPage() {
return (
<Box padding={8}>
<Typography variant="alpha">My Plugin Dashboard</Typography>
<Typography>Here you can manage whatever your plugin needs.</Typography>
</Box>
);
}3.2 Settings page component
// my-admin-plugin/admin/src/pages/SettingsPage.tsx
import React from 'react';
import { useState } from 'react';
import { Box, Button, TextInput, Switch, Typography } from '@strapi/design-system';
import { useFetchClient } from '@strapi/helper-plugin';
export default function SettingsPage() {
const { get, put } = useFetchClient();
const [enabled, setEnabled] = useState(false);
const [apiKey, setApiKey] = useState('');
// Load existing settings from the backend (optional)
React.useEffect(() => {
get('/my-admin-plugin/settings').then(({ data }) => {
setEnabled(data.enabled);
setApiKey(data.apiKey);
});
}, []);
const handleSave = async () => {
await put('/my-admin-plugin/settings', { enabled, apiKey });
// Show a notification (Strapi helper omitted for brevity)
};
return (
<Box padding={8}>
<Typography variant="beta">Plugin settings</Typography>
<Switch
label="Enable feature"
selected={enabled}
onChange={() => setEnabled(!enabled)}
/>
<TextInput
label="API key"
name="apiKey"
placeholder="Enter key"
value={apiKey}
onChange={e => setApiKey(e.target.value)}
/>
<Button onClick={handleSave}>Save</Button>
</Box>
);
}The settings page uses useFetchClient to talk to a backend route you would implement under server/routes. The route should be protected by the same RBAC permission defined earlier (plugin::my-admin-plugin.settings).
3.3 Side‑panel component
// my-admin-plugin/admin/src/components/SidePanel.tsx
import React from 'react';
import { Box, Typography, Button } from '@strapi/design-system';
import { useRBAC } from '@strapi/helper-plugin';
export default function SidePanel() {
const { isAllowed } = useRBAC();
// Guard against users without the permission (defensive)
if (!isAllowed({ action: 'plugin::my-admin-plugin.side-panel', subject: null })) {
return null;
}
const handleAction = () => {
// Custom logic, e.g., call a backend endpoint
console.log('Side panel action executed');
};
return (
<Box padding={4} background="neutral0" borderRadius={2}>
<Typography variant="pi">My Plugin Panel</Typography>
<Button onClick={handleAction}>Run custom action</Button>
</Box>
);
}The side‑panel appears on the right side of the edit view when a user opens any entry in the Content Manager, provided they have the required permission.
4. Define the RBAC permissions
Create a permissions.json file in the plugin root. Strapi reads it automatically.
{
"actions": [
{
"action": "plugin::my-admin-plugin.read",
"section": "plugins",
"displayName": "Read My Plugin",
"description": "Access the main plugin page"
},
{
"action": "plugin::my-admin-plugin.settings",
"section": "plugins",
"displayName": "Manage My Plugin Settings",
"description": "Access the settings page"
},
{
"action": "plugin::my-admin-plugin.side-panel",
"section": "plugins",
"displayName": "View side panel",
"description": "Show side‑panel in the Content Manager"
}
]
}After restarting Strapi, these actions appear in the Roles & Permissions UI under Plugins → my‑admin‑plugin. Assign them to the appropriate roles.
5. Backend routes (optional but recommended)
If your plugin needs to store data or perform server‑side work, create API routes under server/routes.
// my-admin-plugin/server/routes/index.js
module.exports = {
type: 'admin', // admin routes are only reachable from the admin UI
routes: [
{
method: 'GET',
path: '/settings',
handler: 'settings.getSettings',
config: {
policies: ['admin::hasPermissions'],
middlewares: [],
// The policy checks the same permission defined above
auth: { scope: ['plugin::my-admin-plugin.settings'] },
},
},
{
method: 'PUT',
path: '/settings',
handler: 'settings.updateSettings',
config: {
policies: ['admin::hasPermissions'],
auth: { scope: ['plugin::my-admin-plugin.settings'] },
},
},
],
};Corresponding controller methods would read/write from a config file or a database table. The important part is the auth.scope that mirrors the RBAC action.
6. TypeScript support (optional)
Strapi’s admin APIs are typed as unknown. To get proper IntelliSense, cast the plugin API object:
// my-admin-plugin/admin/src/index.ts
import type { ContentManagerPlugin } from '@strapi/types';
export default {
register(app) {
const cm = app.getPlugin('content-manager') as ContentManagerPlugin;
cm.apis.addEditViewSidePanel([
{
name: 'my-admin-plugin.side-panel',
Component: async () => import('./components/SidePanel'),
},
]);
},
// ...bootstrap and registerTrads remain the same
} as unknown as { register: any; bootstrap: any; registerTrads: any };Using a cast does not affect runtime behavior but gives you compile‑time safety.
7. Test the plugin locally
- Run Strapi in development mode:
npm run develop. - Open the admin UI (
http://localhost:1337/admin). - The new My Plugin link should appear in the left menu for users with the
readpermission. - Click the link – the dashboard page loads.
- Open Settings → My Plugin Settings – the settings page appears.
- Open any content entry in the Content Manager. If your role includes
side-panelpermission, the custom side‑panel shows on the right.
If any component does not appear, check the console for permission‑related warnings and verify that the actions are assigned to the current role.
8. Deploying the plugin
When you are ready for production:
- Build the admin assets with
npm run build– Strapi bundles the plugin into the admin UI. - Ensure the
permissions.jsonis part of the packaged zip. - Upload the zip to the Revisionary marketplace (if you want versioning) or install it manually by placing the folder in
./src/pluginson the server. - Restart Strapi so the plugin registers.
When to use Revisionary
If your plugin introduces new content types or modifies existing ones, you might want to keep a history of those changes. Revisionary, the paid versioning plugin, records every field‑level edit, which can be useful for auditing custom data introduced by your plugin.
9. Checklist for a production‑ready admin plugin
| ✅ Item | Description |
|---|---|
| Navigation | addMenuLink and addSettingsLink registered with proper to paths and icons |
| RBAC | Permissions defined in permissions.json and enforced both in UI (useRBAC) and backend (auth.scope) |
| Side‑panel | Added via content-manager.apis.addEditViewSidePanel with a permission guard |
| Translations | registerTrads loads JSON files for each locale |
| Backend security | Admin routes use admin::hasPermissions policy |
| Type safety | Cast app.getPlugin('content-manager') to the correct type if using TypeScript |
| Testing | Verify UI for users with and without permissions, and run npm test if you have unit tests |
| Documentation | Include README with install steps and a link to the plugin’s admin page |
Following this checklist ensures your plugin behaves predictably, respects role‑based access, and integrates cleanly with Strapi 5’s admin architecture.
TL;DR
- Generate a plugin skeleton.
- In
admin/src/index.js, useapp.addMenuLink,app.addSettingsLink, andcontentManager.apis.addEditViewSidePanelinsideregister/bootstrap. - Create React components for the main page, settings page, and side‑panel.
- Define RBAC actions in
permissions.jsonand assign them to roles. - (Optional) Add admin‑only backend routes protected by
admin::hasPermissions. - Test, build, and deploy.
You now have a fully functional Strapi 5 admin extension that respects permissions and can be packaged for distribution.
Sources
The Revisionary team
Developers who build Revisionary, a version history plugin for Strapi 5. We write about Strapi, web development, AI and application security.
This article was written with the help of AI.