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
- Capture: SDKs capture errors, HTTP requests, performance metrics, and breadcrumbs on the client.
- Validate: Events are validated against the Zod schemas in
@health-guard/coreand fingerprints are generated for issue aggregation. - Report: SDKs batch events and send them to
POST /api/events/batchon the Collector. - Store: The Collector persists events to PostgreSQL.
- Aggregate: Similar events are grouped into Issues by fingerprint.
- Query: The Dashboard queries project, issue, and event data through authenticated APIs.
Technology Stack
| Layer | Technology | Notes |
|---|---|---|
| SDKs | TypeScript + tsup | Browser, WeChat mini-program, and uni-app |
| Event Protocol | Zod | Unified event schemas and validation |
| Collector | Node.js + Fastify | High-performance REST API |
| Database | PostgreSQL 16 | Events, issues, users, and projects |
| Dashboard | Vue 3 + Vite | Responsive admin UI with i18n |
| Deployment | Docker + Docker Compose | One-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 decisionsSecurity & 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.