Admin dashboard plugin for Medusa e-commerce platform providing web interface for managing products, orders, customers, and store configuration.
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Core plugin functionality for integrating @medusajs/admin with Medusa server instances. Provides Express routes, static file serving, and automatic build management.
Provides custom webpack configuration integration with @medusajs/admin-ui.
/**
* Custom webpack configuration function
* Re-exported from @medusajs/admin-ui
*/
function withCustomWebpackConfig(): any;Creates Express router for serving the admin dashboard and handling production/development modes.
/**
* Creates Express routes for admin dashboard
* @param rootDirectory - Application root directory
* @param options - Plugin configuration options
* @returns Express Router instance
*/
function createAdminRoutes(
rootDirectory: string,
options: PluginOptions
): Router;Implementation details:
Automatic setup and build management for admin dashboard during server startup.
/**
* Setup admin dashboard during server startup
* Automatically builds if autoRebuild is enabled and changes detected
*/
function setupAdmin(): Promise<void>;Setup process:
Loads plugin configuration from Medusa config file.
/**
* Load plugin configuration from medusa-config.js
* @param isDev - Whether running in development mode
* @returns Plugin options or null if not configured
*/
function loadConfig(isDev?: boolean): PluginOptions | null;Configuration resolution:
Discovers other plugins with admin UI extensions enabled.
/**
* Get paths of plugins with admin UI enabled
* @returns Array of plugin paths with UI extensions
*/
function getPluginPaths(): Promise<string[]>;Discovery process:
interface PluginOptions extends AdminOptions {
/** Whether to serve the admin dashboard */
serve?: boolean;
/**
* Re-build admin automatically when options change
* Memory intensive - use carefully in production
*/
autoRebuild?: boolean;
}
interface AdminOptions {
/** Path to serve admin dashboard (default: "/app") */
path?: string;
/** Output directory for build files (default: "build") */
outDir?: string;
/** Backend URL for API calls (default: "/") */
backend?: string;
/** Development server configuration */
develop?: DevelopmentOptions;
}
interface DevelopmentOptions {
/** Development server port (default: 7001) */
port?: number;
/** Development server host (default: "localhost") */
host?: string;
/** Auto-open browser (default: true) */
open?: boolean;
/** Allowed hosts configuration (default: "auto") */
allowedHosts?: string;
/** WebSocket URL for hot reload */
webSocketURL?: string;
}// medusa-config.js
module.exports = {
plugins: [
{
resolve: "@medusajs/admin",
options: {
serve: true,
path: "/admin",
autoRebuild: false
}
}
]
};// medusa-config.js
module.exports = {
plugins: [
{
resolve: "@medusajs/admin",
options: {
serve: true,
autoRebuild: true,
develop: {
port: 3001,
open: false
}
}
}
]
};// medusa-config.js
module.exports = {
plugins: [
{
resolve: "@medusajs/admin",
options: {
serve: true,
path: "/dashboard",
outDir: "admin-build",
backend: "https://api.mystore.com",
autoRebuild: false
}
}
]
};The plugin uses a build manifest system to determine when rebuilds are necessary:
.cache/admin-build-manifest.jsonRebuilds are triggered when:
When admin build files are missing in production:
Could not find the admin UI build files. Please run "medusa-admin build" or enable "autoRebuild" in the plugin options.process.env.COMMAND_INITIATED_BY === "develop" to detect development mode