Skip to content

Architecture

HealthGuard uses a classic three-tier architecture: SDKs (collection), Collector (server), and Dashboard (UI). All data stays in your own infrastructure by default — no third-party monitoring service is required.

System Architecture

text
┌─────────────────────────────────────────────────────────────┐
│                        SDKs                                  │
│  ┌────────────┐  ┌──────────────────┐  ┌─────────────────┐  │
│  │ H5 / Web   │  │ WeChat Mini      │  │ uni-app         │  │
│  │ sdk-web    │  │ sdk-miniprogram  │  │ sdk-uniapp      │  │
│  └──────┬─────┘  └─────────┬────────┘  └────────┬────────┘  │
└─────────┼──────────────────┼────────────────────┼───────────┘
          │                  │                    │
          └──────────────────┼────────────────────┘

                  ┌──────────────────────┐
                  │   Collector (Server) │
                  │   Node.js + Fastify  │
                  │   REST API / Issue   │
                  │   aggregation        │
                  └──────────┬───────────┘

          ┌──────────────────┼──────────────────┐
          ▼                  ▼                  ▼
  ┌───────────────┐  ┌───────────────┐  ┌───────────────┐
  │  PostgreSQL   │  │   Dashboard   │  │  Repair Agent │
  │  persistence  │  │  Vue 3 + Vite │  │  (optional)   │
  └───────────────┘  └───────────────┘  └───────────────┘

Data Flow

  1. Capture: SDKs capture errors, HTTP requests, performance metrics, and breadcrumbs on the client.
  2. Validate: Events are validated against the Zod schemas in @health-guard/core and fingerprints are generated for issue aggregation.
  3. Report: SDKs batch events and send them to POST /api/events/batch on the Collector.
  4. Store: The Collector persists events to PostgreSQL.
  5. Aggregate: Similar events are grouped into Issues by fingerprint.
  6. Query: The Dashboard queries project, issue, and event data through authenticated APIs.

Technology Stack

LayerTechnologyNotes
SDKsTypeScript + tsupBrowser, WeChat mini-program, and uni-app
Event ProtocolZodUnified event schemas and validation
CollectorNode.js + FastifyHigh-performance REST API
DatabasePostgreSQL 16Events, issues, users, and projects
DashboardVue 3 + ViteResponsive admin UI with i18n
DeploymentDocker + Docker ComposeOne-command self-hosted deployment

Repository Layout

text
healthguard/
├── apps/
│   ├── dashboard/          # Vue 3 dashboard
│   └── server/             # Fastify collector API
├── packages/
│   ├── core/               # Shared event schemas and utilities
│   ├── sdk-web/            # H5 / Web SDK
│   ├── sdk-miniprogram/    # WeChat mini-program SDK
│   ├── sdk-uniapp/         # uni-app multi-end SDK
│   └── repair-agent/       # Local repair agent (optional)
├── examples/
│   └── vue3-demo/          # H5 demo app
├── docker-compose.yml      # One-click deployment
└── docs/                   # Operator guides and decisions

Security & Privacy

  • All query endpoints require a Bearer Token.
  • SDKs filter sensitive URL query parameters (authorization, token, password, etc.) by default.
  • Custom business fields can be passed through context / requestData, limited to 20 keys each.
  • Data is fully self-hosted; no dependency on third-party monitoring platforms.

Released under the MIT License.