快速开始
本文档帮助你在 5 分钟内完成 HealthGuard 的本地启动和首次 SDK 接入。
前提条件
本地源码运行
bash
# 克隆仓库
git clone https://github.com/Claud-Lu/healthguard.git
cd healthguard
# 安装依赖
yarn install
# 一键启动所有服务(Collector + Dashboard + Demo)
yarn dev:local启动后访问:
| 服务 | 地址 |
|---|---|
| Dashboard | http://127.0.0.1:5175 |
| Collector | http://127.0.0.1:3100/health |
| Demo | http://127.0.0.1:5174 |
创建应用
- 打开 Dashboard(http://127.0.0.1:5175)
- 注册账号并登录
- 点击"创建应用",选择应用类型(H5 / 微信小程序)
- 复制生成的
appKey
接入 H5 SDK
bash
npm install @healthguard/sdk-webjs
import { createHealthGuardClient } from '@healthguard/sdk-web';
const client = createHealthGuardClient({
appKey: 'your-app-key',
endpoint: 'http://127.0.0.1:3100/api/events/batch',
autoCapture: true
});验证
- 在 Demo 页面或你的应用中触发一个 JavaScript 错误
- 返回 Dashboard,进入 Issue 列表
- 你应该能看到刚刚触发的错误已被聚合为一条 Issue