Skip to content

快速开始

本文档帮助你在 5 分钟内完成 HealthGuard 的本地启动和首次 SDK 接入。

前提条件

本地源码运行

bash
# 克隆仓库
git clone https://github.com/Claud-Lu/healthguard.git
cd healthguard

# 安装依赖
yarn install

# 一键启动所有服务(Collector + Dashboard + Demo)
yarn dev:local

启动后访问:

服务地址
Dashboardhttp://127.0.0.1:5175
Collectorhttp://127.0.0.1:3100/health
Demohttp://127.0.0.1:5174

创建应用

  1. 打开 Dashboard(http://127.0.0.1:5175
  2. 注册账号并登录
  3. 点击"创建应用",选择应用类型(H5 / 微信小程序)
  4. 复制生成的 appKey

接入 H5 SDK

bash
npm install @healthguard/sdk-web
js
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
});

验证

  1. 在 Demo 页面或你的应用中触发一个 JavaScript 错误
  2. 返回 Dashboard,进入 Issue 列表
  3. 你应该能看到刚刚触发的错误已被聚合为一条 Issue

下一步

Released under the MIT License.