How h4hash-ch/api-monitor works
API Monitor lets authenticated users configure endpoint monitors, then automatically checks them on a schedule and records results. The principal flow runs from the dashboard through the API to monitor storage; scheduled and manual checks then measure endpoint health, record checks, and apply incident transitions. Users can review check history, incidents, and historical statistics or generate PDF reports. The graph reflects the documented capabilities; some route and persistence details are based on README descriptions because source excerpts are partial.
Main entry points: api.ts REST API · scheduler-service.ts Cron scheduler · notification-service.ts Incident notifications · monitor-repository.ts Monitor repository
Components 20
User interface
- Dashboard
frontend/src.tsx
API and access
- Worker entry
src/index.ts - REST API
src/routes/api.ts - Authentication
src/lib/auth.ts - Rate limits
src/lib/limit.ts
Monitoring and incidents
- Cron scheduler
src/services/scheduler-service.ts - HTTP checks
src/services/monitoring-engine.ts - Incident transitions
src/services/incident-service.ts - Incident notifications
src/services/notification-service.ts
History and reporting
- Statistics
src/services/statistics-service.ts - Statistics cache
src/lib/cache.ts - PDF reports
src/services/report-service.ts
Persistence
- Monitor repository
src/repositories/monitor-repository.ts - PostgreSQL data
supabase/migration/0001_initial_schema.sql
Other components
- Monitor owner
- Monitored APIs
- Webhook destination
- Email provider
- Supabase Auth
- Cloudflare Cron
Connections 27
- Monitor owner → Dashboard: uses
- Dashboard → Supabase Auth: authenticates
- Dashboard → REST API: requests
- REST API → Authentication: authenticates
- Authentication → Supabase Auth: validates token
- REST API → Rate limits: limits requests
- REST API → Monitor repository: manages monitors
- Monitor repository → PostgreSQL data: reads and writes
- Cloudflare Cron → Worker entry: triggers
- Worker entry → Cron scheduler: runs scheduled jobs
- Cron scheduler → Monitor repository: claims and records
- Cron scheduler → HTTP checks: checks monitors
- HTTP checks → Monitored APIs: sends HTTP request
- Cron scheduler → Incident transitions: applies transitions
- REST API → HTTP checks: runs manual check
- REST API → Incident transitions: applies transitions
- Incident transitions → PostgreSQL data: calls transition function
- Cron scheduler → Incident notifications: dispatches events
- REST API → Incident notifications: dispatches events
- Incident notifications → Webhook destination: posts event
- Incident notifications → Email provider: sends event
- Incident notifications → Supabase Auth: looks up owner email
- REST API → Statistics: builds statistics
- REST API → Statistics cache: gets and puts
- Statistics cache → Statistics: caches series
- Statistics → Monitor repository: uses history inputs
- REST API → PDF reports: generates PDF