Dashboard API
Extend the DrakoBot dashboard with custom pages, navigation items, and API endpoints.
β¨ Features
Custom Pages β Add your own React pages to the dashboard
Navigation Integration β Seamlessly add items to the sidebar
API Routes β Create custom backend endpoints for your addon
Full React Support β Use hooks, state, and all React features
Tailwind CSS β Style with the dashboard's existing design system
Authentication β Automatic auth handling for protected endpoints
Hot Reload β Changes reflect instantly during development
π Quick Start
Folder Structure
addons/
βββ my-addon/
βββ my-addon.js # Main addon file (events, etc.)
βββ dashboard/
βββ config.js # Dashboard configuration
βββ pages/
βββ index.jsx # Main page component
βββ settings.jsx # Additional pagesExample: Complete Dashboard Addon
addons/my-addon/dashboard/config.js
addons/my-addon/dashboard/pages/index.jsx
π Configuration Reference
Pages
Register custom pages in your addon:
path
string
β
URL path for the page
component
string
β
Filename in pages/ (without extension)
title
string
β
Browser tab title
requiredRoles
string[]|null
β
Discord role IDs required to access
Navigation Items
Add items to the dashboard sidebar:
name
string
β
Display name in sidebar
path
string
β
Navigation destination
emoji
string
β
Emoji to display
icon
string
β
FontAwesome icon name
requiredRoles
string[]|null
β
Discord role IDs required to see item
order
number
β
Sort priority (lower = higher)
API Routes
Create custom backend endpoints:
method
string
β
get, post, put, delete, patch
path
string
β
Endpoint path (prefixed with /api/addons/{addonname})
handler
function
β
Express route handler
middleware
array
β
Additional middleware functions
requiredRoles
string[]|null
β
Discord role IDs required to access
π¨ Styling Guide
Available CSS Classes
The dashboard uses Tailwind CSS with custom utility classes:
Responsive Design
π API Endpoint Patterns
Accessing Your API
Your API routes are available at:
Example:
Addon name:
MyAddonRoute path:
/statsFull URL:
/api/addons/myaddon/stats
Making API Calls
Handler Examples
π Authentication & Permissions
Using requiredRoles
The requiredRoles property accepts an array of Discord role IDs. Users must have at least one of the specified roles to access the resource.
Complete Example with Permissions
Getting Role IDs
Enable Developer Mode in Discord:
Settings β Advanced β Developer Mode
Copy the role ID:
Right-click the role β Copy Role ID
Checking User in API Handler
π§© Complete Examples
Stats Dashboard
Settings Panel
π Requirements Summary
Minimum Required
config.js Template
Page Component Template
π Integration with Event API
Combine dashboard with event handlers:
addons/my-addon/my-addon.js
The dashboard config is automatically loaded from dashboard/config.js when the addon initializes.
π‘ Tips & Best Practices
Use meaningful addon names β The addon name becomes part of the API URL
Handle loading states β Always show loading indicators
Error handling β Catch and display errors gracefully
API validation β Always validate request data on the backend
Permission checks β Use permissions for sensitive features
Troubleshooting
Last updated