# frshaad/vigil architecture

> Architecture diagram of the GitHub repository frshaad/vigil, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/frshaad/vigil
- Repository: https://github.com/frshaad/vigil

## Overview

Vigil is a full-stack website and API uptime-monitoring service. Users authenticate, create and manage monitors, and inspect dashboard metrics and check history. Scheduled or manual checks contact monitored endpoints; results update monitor state and history, status transitions create or resolve incidents, and notifications are delivered in-app or by email. The graph reflects documented product flows and sampled imports; unsampled subsystem links are included only where the README explicitly describes them.

Main entry points: [`src/lib/prisma.ts`](https://github.com/frshaad/vigil/blob/main/src/lib/prisma.ts) (Prisma data access), [`src/features/monitoring/run-monitor-check.ts`](https://github.com/frshaad/vigil/blob/main/src/features/monitoring/run-monitor-check.ts) (Check orchestration), [`src/app/(application)/dashboard/page.tsx`](https://github.com/frshaad/vigil/blob/main/src/app/(application)/dashboard/page.tsx) (Dashboard), [`src/app/(application)/dashboard/monitors`](https://github.com/frshaad/vigil/tree/main/src/app/(application)/dashboard/monitors) (Monitor pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and dashboard"]
  node_auth_pages["Sign-in pages<br/>[page.tsx]"]
  node_auth_service["Authentication<br/>[index.ts]"]
  node_session["Session and ownership<br/>[session.ts]"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
end

subgraph group_monitoring["Monitor management"]
  node_monitor_pages["Monitor pages"]
  node_monitor_list["Monitor list UI"]
  node_monitor_actions["Monitor mutations"]
  node_monitor_dal["Monitor data access<br/>[dal.ts]"]
end

subgraph group_runtime["Check and incident runtime"]
  node_cron["Scheduled check route<br/>[route.ts]"]
  node_scheduler["Due monitor scheduler"]
  node_check_runner["Check orchestration"]
  node_checker["HTTP checker<br/>[check-monitor.ts]"]
  node_history["Check history and metrics"]
  node_incidents["Incident transitions"]
end

subgraph group_notify["Notifications and delivery"]
  node_notification_dispatch["Notification dispatch"]
  node_notification_data["Notification data<br/>[dal.ts]"]
  node_notification_ui["Notification inbox UI"]
  node_email["Email delivery"]
end

subgraph group_persistence["Persistence"]
  node_prisma["Prisma data access<br/>[prisma.ts]"]
  node_database[("PostgreSQL")]
end

node_user(("User"))
node_endpoint(("Monitored endpoint"))
node_resend["Resend"]

node_user -->|"signs in"| node_auth_pages
node_auth_pages -->|"authenticates"| node_auth_service
node_auth_service -->|"provides session"| node_session
node_user -->|"views"| node_dashboard
node_dashboard -->|"requires session"| node_session
node_dashboard -->|"opens monitors"| node_monitor_pages
node_monitor_pages -->|"renders list"| node_monitor_list
node_monitor_pages -->|"loads monitor data"| node_monitor_dal
node_monitor_list -->|"deletes monitor"| node_monitor_actions
node_monitor_actions -.->|"persists changes"| node_monitor_dal
node_cron -->|"runs due checks"| node_scheduler
node_scheduler -->|"runs checks"| node_check_runner
node_monitor_actions -.->|"runs first check"| node_check_runner
node_check_runner -->|"checks endpoint"| node_checker
node_checker -->|"sends HTTP request"| node_endpoint
node_check_runner -->|"stores check result"| node_history
node_check_runner -->|"updates status"| node_incidents
node_incidents -->|"dispatches on transition"| node_notification_dispatch
node_notification_dispatch -.->|"creates in-app alerts"| node_notification_data
node_notification_dispatch -.->|"sends email alerts"| node_email
node_email -.->|"delivers email"| node_resend
node_notification_ui -->|"marks read"| node_notification_data
node_dashboard -.->|"reads dashboard data"| node_prisma
node_monitor_dal -->|"queries monitors"| node_prisma
node_prisma -->|"reads and writes"| node_database
node_history -.->|"stores history"| node_prisma
node_incidents -.->|"stores transitions"| node_prisma
node_notification_data -.->|"stores notifications"| node_prisma

click node_auth_pages "https://github.com/frshaad/vigil/blob/main/src/app/(auth)/login/page.tsx"
click node_auth_service "https://github.com/frshaad/vigil/blob/main/src/lib/auth/index.ts"
click node_session "https://github.com/frshaad/vigil/blob/main/src/lib/auth/session.ts"
click node_dashboard "https://github.com/frshaad/vigil/blob/main/src/app/(application)/dashboard/page.tsx"
click node_monitor_pages "https://github.com/frshaad/vigil/tree/main/src/app/(application)/dashboard/monitors"
click node_monitor_list "https://github.com/frshaad/vigil/blob/main/src/features/monitors/components/monitor-list-client.tsx"
click node_monitor_actions "https://github.com/frshaad/vigil/tree/main/src/features/monitors/actions"
click node_monitor_dal "https://github.com/frshaad/vigil/blob/main/src/features/monitors/dal.ts"
click node_cron "https://github.com/frshaad/vigil/blob/main/src/app/api/cron/monitoring/route.ts"
click node_scheduler "https://github.com/frshaad/vigil/blob/main/src/features/monitoring/scheduler/run-due-monitors.ts"
click node_check_runner "https://github.com/frshaad/vigil/blob/main/src/features/monitoring/run-monitor-check.ts"
click node_checker "https://github.com/frshaad/vigil/blob/main/src/features/monitoring/checker/check-monitor.ts"
click node_history "https://github.com/frshaad/vigil/tree/main/src/features/monitoring/history"
click node_incidents "https://github.com/frshaad/vigil/blob/main/src/features/monitoring/incidents/handle-monitor-status.ts"
click node_notification_dispatch "https://github.com/frshaad/vigil/blob/main/src/features/notifications/dispatch-notification.ts"
click node_notification_data "https://github.com/frshaad/vigil/blob/main/src/features/notifications/dal.ts"
click node_notification_ui "https://github.com/frshaad/vigil/blob/main/src/features/notifications/components/notification-bell-client.tsx"
click node_email "https://github.com/frshaad/vigil/blob/main/src/features/notifications/email/send-email-notification.ts"
click node_prisma "https://github.com/frshaad/vigil/blob/main/src/lib/prisma.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_auth_pages,node_auth_service,node_session,node_dashboard,node_user toneBlue
class node_monitor_pages,node_monitor_list,node_monitor_actions,node_monitor_dal toneAmber
class node_cron,node_scheduler,node_check_runner,node_checker,node_history,node_incidents toneMint
class node_notification_dispatch,node_notification_data,node_notification_ui,node_email toneRose
class node_prisma,node_database,node_endpoint,node_resend toneIndigo
```

## Components

### Access and dashboard

- [Sign-in pages](https://github.com/frshaad/vigil/blob/main/src/app/(auth)/login/page.tsx): `src/app/(auth)/login/page.tsx`
- [Authentication](https://github.com/frshaad/vigil/blob/main/src/lib/auth/index.ts): `src/lib/auth/index.ts`
- [Session and ownership](https://github.com/frshaad/vigil/blob/main/src/lib/auth/session.ts): `src/lib/auth/session.ts`
- [Dashboard](https://github.com/frshaad/vigil/blob/main/src/app/(application)/dashboard/page.tsx): `src/app/(application)/dashboard/page.tsx`

### Monitor management

- [Monitor pages](https://github.com/frshaad/vigil/tree/main/src/app/(application)/dashboard/monitors): `src/app/(application)/dashboard/monitors`
- [Monitor list UI](https://github.com/frshaad/vigil/blob/main/src/features/monitors/components/monitor-list-client.tsx): `src/features/monitors/components/monitor-list-client.tsx`
- [Monitor mutations](https://github.com/frshaad/vigil/tree/main/src/features/monitors/actions): `src/features/monitors/actions`
- [Monitor data access](https://github.com/frshaad/vigil/blob/main/src/features/monitors/dal.ts): `src/features/monitors/dal.ts`

### Check and incident runtime

- [Scheduled check route](https://github.com/frshaad/vigil/blob/main/src/app/api/cron/monitoring/route.ts): `src/app/api/cron/monitoring/route.ts`
- [Due monitor scheduler](https://github.com/frshaad/vigil/blob/main/src/features/monitoring/scheduler/run-due-monitors.ts): `src/features/monitoring/scheduler/run-due-monitors.ts`
- [Check orchestration](https://github.com/frshaad/vigil/blob/main/src/features/monitoring/run-monitor-check.ts): `src/features/monitoring/run-monitor-check.ts`
- [HTTP checker](https://github.com/frshaad/vigil/blob/main/src/features/monitoring/checker/check-monitor.ts): `src/features/monitoring/checker/check-monitor.ts`
- [Check history and metrics](https://github.com/frshaad/vigil/tree/main/src/features/monitoring/history): `src/features/monitoring/history`
- [Incident transitions](https://github.com/frshaad/vigil/blob/main/src/features/monitoring/incidents/handle-monitor-status.ts): `src/features/monitoring/incidents/handle-monitor-status.ts`

### Notifications and delivery

- [Notification dispatch](https://github.com/frshaad/vigil/blob/main/src/features/notifications/dispatch-notification.ts): `src/features/notifications/dispatch-notification.ts`
- [Notification data](https://github.com/frshaad/vigil/blob/main/src/features/notifications/dal.ts): `src/features/notifications/dal.ts`
- [Notification inbox UI](https://github.com/frshaad/vigil/blob/main/src/features/notifications/components/notification-bell-client.tsx): `src/features/notifications/components/notification-bell-client.tsx`
- [Email delivery](https://github.com/frshaad/vigil/blob/main/src/features/notifications/email/send-email-notification.ts): `src/features/notifications/email/send-email-notification.ts`

### Persistence

- [Prisma data access](https://github.com/frshaad/vigil/blob/main/src/lib/prisma.ts): `src/lib/prisma.ts`
- **PostgreSQL**

### Other components

- **User**
- **Monitored endpoint**
- **Resend**

## Connections

- User → Sign-in pages: signs in (evidence: `README.md`)
- Sign-in pages → Authentication: authenticates (evidence: `src/app/(auth)/login/page.tsx`)
- Authentication → Session and ownership: provides session (evidence: `src/lib/auth/session.ts`)
- User → Dashboard: views (evidence: `README.md`)
- Dashboard → Session and ownership: requires session (evidence: `src/app/(application)/dashboard/page.tsx`)
- Dashboard → Monitor pages: opens monitors (evidence: `src/app/(application)/dashboard/page.tsx`)
- Monitor pages → Monitor list UI: renders list (evidence: `src/features/monitors/components/monitor-list-client.tsx`)
- Monitor pages → Monitor data access: loads monitor data (evidence: `src/app/(application)/dashboard/monitors/[monitorId]/page.tsx`)
- Monitor list UI → Monitor mutations: deletes monitor (evidence: `src/features/monitors/components/monitor-list-client.tsx`)
- Monitor mutations → Monitor data access: persists changes
- Scheduled check route → Due monitor scheduler: runs due checks (evidence: `src/app/api/cron/monitoring/route.ts`)
- Due monitor scheduler → Check orchestration: runs checks (evidence: `README.md`)
- Monitor mutations → Check orchestration: runs first check (evidence: `README.md`)
- Check orchestration → HTTP checker: checks endpoint (evidence: `README.md`)
- HTTP checker → Monitored endpoint: sends HTTP request (evidence: `README.md`)
- Check orchestration → Check history and metrics: stores check result (evidence: `README.md`)
- Check orchestration → Incident transitions: updates status (evidence: `README.md`)
- Incident transitions → Notification dispatch: dispatches on transition (evidence: `README.md`)
- Notification dispatch → Notification data: creates in-app alerts
- Notification dispatch → Email delivery: sends email alerts (evidence: `README.md`)
- Email delivery → Resend: delivers email (evidence: `README.md`)
- Notification inbox UI → Notification data: marks read (evidence: `src/features/notifications/components/notification-bell-client.tsx`)
- Dashboard → Prisma data access: reads dashboard data (evidence: `README.md`)
- Monitor data access → Prisma data access: queries monitors (evidence: `src/features/monitors/dal.ts`)
- Prisma data access → PostgreSQL: reads and writes (evidence: `README.md`)
- Check history and metrics → Prisma data access: stores history (evidence: `README.md`)
- Incident transitions → Prisma data access: stores transitions (evidence: `README.md`)
- Notification data → Prisma data access: stores notifications (evidence: `README.md`)
