trails/apps/journal/package.json
Ullrich Schäfer 49aadd04a9
Add observability: health endpoints, structured logging, metrics, Grafana stack
Health endpoints:
- /api/health (Journal) and /health (Planner) with DB connectivity check
- Docker healthchecks updated to use app health endpoints

Structured logging:
- Pino with JSON output in production, pretty-print in dev
- Request logging middleware in Planner (method, path, status, duration)
- Replaced console.log/error with structured logger in email and auth flows

Prometheus metrics:
- prom-client with default Node.js metrics + custom histograms/gauges
- /metrics endpoints on both apps
- http_request_duration, planner_active_sessions, brouter_request_duration

Monitoring stack:
- Prometheus, Loki, Grafana containers in docker-compose
- Grafana provisioned with datasources, dashboards, and alert rules
- Caddy access logging (JSON to stdout for Loki)
- grafana.trails.cool with basic auth via Caddy

Dashboards and alerting:
- Overview: request rate, error rate, latency p50/p95/p99
- Planner: active sessions, connected clients, BRouter latency
- Infrastructure: memory, CPU, event loop lag
- Alerts: disk >80%, app down 2min, error rate >5%

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 22:59:44 +01:00

48 lines
1.4 KiB
JSON

{
"name": "@trails-cool/journal",
"private": true,
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "react-router dev",
"build": "react-router build",
"start": "react-router-serve ./build/server/index.js",
"typecheck": "react-router typegen && tsc",
"lint": "eslint ."
},
"dependencies": {
"@react-router/node": "catalog:",
"@react-router/serve": "catalog:",
"@sentry/node": "^10.45.0",
"@sentry/react": "^10.45.0",
"@simplewebauthn/browser": "^13.3.0",
"@simplewebauthn/server": "^13.3.0",
"@trails-cool/db": "workspace:*",
"@trails-cool/gpx": "workspace:*",
"@trails-cool/i18n": "workspace:*",
"@trails-cool/map": "workspace:*",
"@trails-cool/types": "workspace:*",
"@trails-cool/ui": "workspace:*",
"drizzle-orm": "catalog:",
"isbot": "^5.1.0",
"jose": "^6.2.2",
"nodemailer": "^8.0.4",
"pino": "^10.3.1",
"prom-client": "^15.1.3",
"react": "catalog:",
"react-dom": "catalog:",
"react-router": "catalog:"
},
"devDependencies": {
"@react-router/dev": "catalog:",
"@simplewebauthn/types": "^12.0.0",
"@tailwindcss/vite": "catalog:",
"@types/nodemailer": "^7.0.11",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"pino-pretty": "^13.1.3",
"tailwindcss": "catalog:",
"typescript": "catalog:",
"vite": "catalog:"
}
}