App Plugin Development
App plugins allow you to create complete applications within Grafana, including custom pages, navigation, and bundled data sources or panels. This guide covers building app plugins.Overview
App plugins can include:- Custom pages: Full-page React applications
- Navigation items: Custom menu entries
- Bundled plugins: Include data source or panel plugins
- Dashboards: Pre-built dashboards
- Backend components: Server-side logic and APIs
- Plugin extensions: Extend other plugins’ functionality
Creating an App Plugin
Plugin Entry Point
App plugins extend theAppPlugin class from @grafana/data:
Root Page Component
The root page handles routing and navigation:Configuration Page
Provide settings for your app:Navigation Configuration
Define navigation inplugin.json:
Include Types
page: Custom page routedashboard: Bundled dashboarddatasource: Bundled data source pluginpanel: Bundled panel plugin
Include Properties
name: Display name in navigationpath: URL path or file path (for dashboards)role: Minimum required role (Viewer,Editor,Admin)action: RBAC action required (overrides role)addToNav: Add to navigation menudefaultNav: Make this the default pageicon: Icon name from@grafana/uiuid: Dashboard UID (for dashboard includes)
Backend Implementation
App plugins can include backend components for custom APIs:Frontend API Calls
Call backend resources from the frontend:Plugin Extensions
Extend other plugins’ functionality:Registering Extensions
Inplugin.json:
Implementing Extension Components
Role-Based Access Control
Define custom roles and permissions:Bundling Other Plugins
Include data source or panel plugins:Plugin.json Configuration
Complete app plugin configuration:Key Configuration Options
autoEnabled: Auto-enable plugin on installationbackend: Has backend componentexecutable: Backend binary nameincludes: Bundled pages, dashboards, and pluginsroles: RBAC role definitionsextensions: Plugin extensions configuration
State Management
Use React hooks and context for state:Routing
Use React Router for navigation:Best Practices
- Follow Grafana conventions: Use consistent URL paths (
/a/plugin-id/page) - Implement proper RBAC: Use roles and actions for access control
- Handle plugin lifecycle: Implement enable/disable functionality
- Provide configuration UI: Make setup easy for users
- Bundle useful dashboards: Include pre-built visualizations
- Document extensions: Clearly document extension points
- Test thoroughly: Test all pages and navigation paths
- Support theming: Use
@grafana/uicomponents for theme compatibility
Common Patterns
Loading States
Error Handling
Data Fetching
Resources
- Build an app plugin tutorial
- Plugin examples
- Grafana UI components
- Source:
pkg/plugins/and example app plugins in Grafana repository