
parseplatform/parse-dashboardParse Dashboard 是一个独立的仪表板工具,用于管理 Parse Server 应用。它提供可视化界面,支持数据浏览、用户管理、推送通知配置、GraphQL 调试等核心功能,适用于开发和生产环境中对 Parse Server 应用的集中管理。
通过 npm 全局安装:
bashnpm install -g parse-dashboard
直接通过命令行参数启动,适用于快速测试:
bashparse-dashboard --appId 你的AppId --masterKey 你的MasterKey --serverURL "[***]" --appName "应用名称"
注意:
--dev参数会禁用生产环境安全特性,仅用于本地开发,生产环境切勿使用。
Parse Dashboard 支持通过配置文件或环境变量进行配置,推荐生产环境使用配置文件。
创建 JSON 格式配置文件(如 parse-dashboard-config.json),支持单应用或多应用配置。
单应用配置示例
json{ "apps": [ { "serverURL": "http://localhost:1337/parse", // Parse Server 地址 "appId": "myAppId", // 应用 ID "masterKey": "myMasterKey", // Master Key "appName": "MyApp", // 应用名称(显示用) "production": false // 是否为生产环境(默认 false) } ] }
通过配置文件启动:
bashparse-dashboard --config parse-dashboard-config.json
多应用配置示例
在 apps 数组中添加多个应用配置:
json{ "apps": [ { "serverURL": "http://localhost:1337/parse", "appId": "app1Id", "masterKey": "app1MasterKey", "appName": "应用1" }, { "serverURL": "http://localhost:1337/parse2", "appId": "app2Id", "masterKey": "app2MasterKey", "appName": "应用2" } ] }
仅支持通过 parse-dashboard 命令启动时使用,分为单应用和多应用两种模式。
单应用环境变量
| 环境变量 | 说明 | 示例值 |
|---|---|---|
HOST | 绑定主机地址 | 0.0.0.0 |
PORT | 监听端口 | 4040 |
MOUNT_PATH | 访问路径前缀 | /dashboard |
PARSE_DASHBOARD_SERVER_URL | Parse Server 地址 | http://localhost:1337/parse |
PARSE_DASHBOARD_APP_ID | 应用 ID | myAppId |
PARSE_DASHBOARD_MASTER_KEY | Master Key | myMasterKey |
PARSE_DASHBOARD_APP_NAME | 应用名称 | MyApp |
PARSE_DASHBOARD_USER_ID | 基本认证用户名(单用户) | admin |
PARSE_DASHBOARD_USER_PASSWORD | 基本认证密码(单用户) | securePassword |
多应用环境变量
通过 PARSE_DASHBOARD_CONFIG 环境变量传入完整 JSON 配置(与配置文件格式一致):
bashexport PARSE_DASHBOARD_CONFIG='{"apps":[{"serverURL":"http://localhost:1337/parse","appId":"app1","masterKey":"key1","appName":"应用1"},{"serverURL":"http://localhost:1337/parse2","appId":"app2","masterKey":"key2","appName":"应用2"}]}' parse-dashboard
应用图标配置
iconsFolder,相对于配置文件路径)iconName(包含文件扩展名)json{ "apps": [ { "serverURL": "http://localhost:1337/parse", "appId": "myAppId", "masterKey": "myMasterKey", "appName": "MyApp", "iconName": "app-icon.png" // 图标文件名 } ], "iconsFolder": "icons" // 图标目录(存放 app-icon.png 等文件) }
应用背景色配置
通过 primaryBackgroundColor 和 secondaryBackgroundColor 配置应用列表中的背景色(支持 CSS 颜色格式):
json{ "apps": [ { "serverURL": "http://localhost:1337/parse", "appId": "myAppId", "masterKey": "myMasterKey", "appName": "MyApp", "primaryBackgroundColor": "#FFA500", // 主背景色(橙色) "secondaryBackgroundColor": "#FF4500" // 次背景色(橙红色) } ] }
若 Parse Server 启用了 GraphQL API,可通过以下方式在 Dashboard 中集成 GraphQL Playground:
--graphQLServerURL "[***]"PARSE_DASHBOARD_GRAPHQL_SERVER_URL="[***]"graphQLServerURL 字段json{ "apps": [ { "serverURL": "http://localhost:1337/parse", "graphQLServerURL": "http://localhost:1337/graphql", // GraphQL API 地址 "appId": "myAppId", "masterKey": "myMasterKey", "appName": "MyApp" } ] }
启动后可通过 http://localhost:4040/apps/应用名称/api_console/graphql 访问 Playground。
通过 columnPreference 配置特定数据类的列是否允许排序(preventSort: true 禁用排序):
json{ "apps": [ { "appId": "myAppId", "columnPreference": { "_User": [ // 对 _User 类配置 { "name": "createdAt", // 字段名 "visible": true, // 是否显示 "preventSort": true // 禁用排序 }, { "name": "updatedAt", "visible": true, "preventSort": false // 允许排序 } ] } } ] }
可将 Parse Dashboard 集成到现有 Express 应用中,作为中间件运行:
javascriptconst express = require('express'); const ParseDashboard = require('parse-dashboard'); // 配置 Dashboard const dashboard = new ParseDashboard({ "apps": [ { "serverURL": "http://localhost:1337/parse", "appId": "myAppId", "masterKey": "myMasterKey", "appName": "MyApp" } ] }); const app = express(); app.use('/dashboard', dashboard); // 将 Dashboard 挂载到 /dashboard 路径 // 启动服务 const httpServer = require('http').createServer(app); httpServer.listen(4040, () => { console.log('Parse Dashboard 运行在 http://localhost:4040/dashboard'); });
若需同时运行 Parse Server 和 Dashboard,可将两者作为中间件挂载到同一 Express 应用:
javascriptconst express = require('express'); const ParseServer = require('parse-server').ParseServer; const ParseDashboard = require('parse-dashboard'); // 配置 Parse Server const api = new ParseServer({ databaseURI: 'mongodb://localhost:27017/dev', appId: 'myAppId', masterKey: 'myMasterKey', serverURL: 'http://localhost:4040/parse' }); // 配置 Dashboard const dashboard = new ParseDashboard({ "apps": [{"appId": "myAppId", "masterKey": "myMasterKey", "serverURL": "http://localhost:4040/parse", "appName": "MyApp"}] }); const app = express(); app.use('/parse', api); // Parse Server 挂载到 /parse app.use('/dashboard', dashboard); // Dashboard 挂载到 /dashboard httpServer.listen(4040);
parseplatform/parse-dashboard通过命令行参数直接启动,适用于快速测试:
bashdocker run -d -p 4040:4040 \ parseplatform/parse-dashboard \ --appId 你的AppId \ --masterKey 你的MasterKey \ --serverURL "[***]" \ --appName "应用名称"
挂载本地配置文件到容器中,支持复杂配置(多应用、认证等):
parse-dashboard-config.json(参考上文配置文件格式)bashdocker run -d -p 4040:4040 \ -v /本地路径/parse-dashboard-config.json:/src/Parse-Dashboard/parse-dashboard-config.json \ parseplatform/parse-dashboard \ --config /src/Parse-Dashboard/parse-dashboard-config.json
生产环境需注意:
--dev 参数示例(指定端口和生产配置):
bashdocker run -d -p 80:8080 \ -v /本地路径/parse-dashboard-config.json:/src/Parse-Dashboard/parse-dashboard-config.json \ parseplatform/parse-dashboard \ --config /src/Parse-Dashboard/parse-dashboard-config.json \ --port 8080 # 容器内端口,映射到主机 80 端口
通过配置文件添加用户,支持明文密码或 bcrypt 加密密码(useEncryptedPasswords: true 启用加密):
json{ "apps": [{"...": "..."}], "users": [ { "user": "admin", // 用户名 "pass": "$2b$10$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" // bcrypt 加密密码 }, { "user": "viewer", "pass": "viewer123" // 明文密码(不推荐生产环境) } ], "useEncryptedPasswords": true // 启用 bcrypt 加密验证 }
限制用户可管理的应用,通过 apps 字段指定用户可访问的应用 ID:
json{ "apps": [ {"appId": "app1", "masterKey": "key1", "appName": "应用1"}, {"appId": "app2", "masterKey": "key2", "appName": "应用2"} ], "users": [ { "user": "admin", "pass": "admin123", "apps": [{"appId": "app1"}, {"appId": "app2"}] // 可管理 app1 和 app2 }, { "user": "app1-viewer", "pass": "viewer123", "apps": [{"appId": "app1"}] // 仅可管理 app1 } ] }
使用 Parse Server 的 readOnlyMasterKey(需 Parse Server ≥ 2.6.5),在 Dashboard 配置中替换 masterKey 为 readOnlyMasterKey:
json{ "apps": [ { "serverURL": "http://localhost:1337/parse", "appId": "myAppId", "masterKey": "只读MasterKey", // 使用只读 Key "appName": "只读应用" } ] }
在用户配置中添加 readOnly: true,限制该用户对所有应用的写操作:
json{ "users": [ { "user": "viewer", "pass": "viewer123", "readOnly": true, // 只读用户 "apps": [{"appId": "app1"}, {"appId": "app2"}] } ] }
指定用户对特定应用的只读权限(需应用配置中提供 readOnlyMasterKey):
json{ "apps": [ { "appId": "app1", "masterKey": "完整权限Key", "readOnlyMasterKey": "只读Key", // 应用级只读 Key "serverURL": "http://localhost:1337/parse" } ], "users": [ { "user": "viewer", "pass": "viewer123", "apps": [{"appId": "app1", "readOnly": true}] // 对 app1 只读 } ] }
--sslKey 和 --sslCert 参数)--trustProxy=1 以正确识别客户端连接(依赖 X-Forwarded-* 头)manifest unknown 错误
TLS 证书验证失败
DNS 解析超时
410 错误:版本过低
402 错误:流量耗尽
身份认证失败错误
429 限流错误
凭证保存错误
来自真实用户的反馈,见证轩辕镜像的优质服务