# sameerk27/vigil365 architecture

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

- Interactive diagram: https://gitdiagram.com/sameerk27/vigil365
- Repository: https://github.com/sameerk27/vigil365

## Overview

Vigil365 is a self-hosted Microsoft 365 security monitoring dashboard. Administrators configure Graph access, then scheduled collection brings tenant security and activity data into the dashboard; users investigate alerts, posture, trends, recommendations, and reports, and can manage alert policies and notifications. The React client calls the ASP.NET API, which persists operational data in SQL Server. The README documents the product capabilities and collection schedule; source excerpts show API hosting, Graph access, database entities, and selected workers. Many endpoint and worker details were not sampled, so uncertain implementation links are omitted or dashed.

Main entry points: [`src/M365SecurityDashboard.Api/Data/AppDbContext.cs`](https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Data/AppDbContext.cs) (Database context), [`src/M365SecurityDashboard.Api/Program.cs`](https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Program.cs) (API host), [`src/m365-security-dashboard-client/src/services/api.ts`](https://github.com/sameerk27/vigil365/blob/master/src/m365-security-dashboard-client/src/services/api.ts) (API client), [`src/m365-security-dashboard-client/src/main.tsx`](https://github.com/sameerk27/vigil365/blob/master/src/m365-security-dashboard-client/src/main.tsx) (Dashboard shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Dashboard client"]
  node_ui["Dashboard shell<br/>[main.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_monitoring_views["Monitoring pages"]
  node_alert_views["Alert center"]
end

subgraph group_collection["Tenant collection"]
  node_graph_client["Graph API client<br/>[GraphApiClient.cs]"]
  node_collector["Graph collector<br/>[GraphCollector.cs]"]
  node_collection_worker["Scheduled collection"]
end

subgraph group_analysis["Alerting and insight"]
  node_alert_engine["Alert evaluator<br/>[AlertEvaluator.cs]"]
  node_recommendations["Recommendations"]
  node_posture_analysis["Posture analyzers<br/>[Services]"]
  node_metrics_trends["Metrics and trends<br/>[MetricsService.cs]"]
end

subgraph group_operations["API and operations"]
  node_api_host["API host<br/>[Program.cs]"]
  node_api_endpoints["API endpoints<br/>[Endpoints]"]
  node_auth_rbac["Sign-in and RBAC"]
  node_audit["Audit trail<br/>[AuditLogger.cs]"]
  node_notifications["Notifications"]
  node_reports["Reports and digests<br/>[DigestBuilder.cs]"]
  node_retention["Data retention"]
end

subgraph group_storage["Persistence"]
  node_db_context["Database context<br/>[AppDbContext.cs]"]
end

node_admin(("Admin / analyst"))
node_graph_service{{"Microsoft Graph"}}
node_sql[("SQL Server")]

node_admin -->|"uses"| node_ui
node_ui -->|"navigates"| node_monitoring_views
node_ui -->|"calls"| node_api_client
node_monitoring_views -.->|"loads data"| node_api_client
node_alert_views -.->|"manages alerts"| node_api_client
node_api_client -.->|"requests"| node_api_endpoints
node_api_host -.->|"hosts"| node_api_endpoints
node_api_host -->|"configures"| node_auth_rbac
node_api_host -->|"configures"| node_db_context
node_api_host -.->|"registers"| node_collection_worker
node_collection_worker -.->|"schedules"| node_collector
node_collector -.->|"requests data"| node_graph_client
node_graph_client -->|"queries"| node_graph_service
node_collection_worker -.->|"stores results"| node_db_context
node_alert_engine -.->|"evaluates records"| node_db_context
node_recommendations -->|"reads alerts"| node_db_context
node_posture_analysis -.->|"reads tenant data"| node_db_context
node_metrics_trends -.->|"records trends"| node_db_context
node_notifications -.->|"records delivery"| node_db_context
node_reports -.->|"sends digests"| node_notifications
node_retention -->|"prunes records"| node_db_context
node_audit -.->|"writes audit"| node_db_context
node_db_context -->|"persists data"| node_sql

click node_ui "https://github.com/sameerk27/vigil365/blob/master/src/m365-security-dashboard-client/src/main.tsx"
click node_api_client "https://github.com/sameerk27/vigil365/blob/master/src/m365-security-dashboard-client/src/services/api.ts"
click node_monitoring_views "https://github.com/sameerk27/vigil365/tree/master/src/m365-security-dashboard-client/src/pages"
click node_alert_views "https://github.com/sameerk27/vigil365/blob/master/src/m365-security-dashboard-client/src/pages/AlertCenterPage.tsx"
click node_graph_client "https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/GraphApiClient.cs"
click node_collector "https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/GraphCollector.cs"
click node_collection_worker "https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/GraphCollectionWorker.cs"
click node_alert_engine "https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/AlertEvaluator.cs"
click node_recommendations "https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/RecommendationsEngine.cs"
click node_posture_analysis "https://github.com/sameerk27/vigil365/tree/master/src/M365SecurityDashboard.Api/Services"
click node_metrics_trends "https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/MetricsService.cs"
click node_api_host "https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Program.cs"
click node_api_endpoints "https://github.com/sameerk27/vigil365/tree/master/src/M365SecurityDashboard.Api/Endpoints"
click node_auth_rbac "https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/RoleClaimsTransformation.cs"
click node_audit "https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/AuditLogger.cs"
click node_notifications "https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/NotificationSender.cs"
click node_reports "https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/DigestBuilder.cs"
click node_retention "https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/DataRetentionWorker.cs"
click node_db_context "https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Data/AppDbContext.cs"

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_ui,node_api_client,node_monitoring_views,node_alert_views toneBlue
class node_graph_client,node_collector,node_collection_worker,node_sql toneAmber
class node_alert_engine,node_recommendations,node_posture_analysis,node_metrics_trends toneMint
class node_api_host,node_api_endpoints,node_auth_rbac,node_audit,node_notifications,node_reports,node_retention toneRose
class node_db_context,node_admin,node_graph_service toneIndigo
```

## Components

### Dashboard client

- [Dashboard shell](https://github.com/sameerk27/vigil365/blob/master/src/m365-security-dashboard-client/src/main.tsx): `src/m365-security-dashboard-client/src/main.tsx`
- [API client](https://github.com/sameerk27/vigil365/blob/master/src/m365-security-dashboard-client/src/services/api.ts): `src/m365-security-dashboard-client/src/services/api.ts`
- [Monitoring pages](https://github.com/sameerk27/vigil365/tree/master/src/m365-security-dashboard-client/src/pages): `src/m365-security-dashboard-client/src/pages`
- [Alert center](https://github.com/sameerk27/vigil365/blob/master/src/m365-security-dashboard-client/src/pages/AlertCenterPage.tsx): `src/m365-security-dashboard-client/src/pages/AlertCenterPage.tsx`

### Tenant collection

- [Graph API client](https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/GraphApiClient.cs): `src/M365SecurityDashboard.Api/Services/GraphApiClient.cs`
- [Graph collector](https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/GraphCollector.cs): `src/M365SecurityDashboard.Api/Services/GraphCollector.cs`
- [Scheduled collection](https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/GraphCollectionWorker.cs): `src/M365SecurityDashboard.Api/Services/GraphCollectionWorker.cs`

### Alerting and insight

- [Alert evaluator](https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/AlertEvaluator.cs): `src/M365SecurityDashboard.Api/Services/AlertEvaluator.cs`
- [Recommendations](https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/RecommendationsEngine.cs): `src/M365SecurityDashboard.Api/Services/RecommendationsEngine.cs`
- [Posture analyzers](https://github.com/sameerk27/vigil365/tree/master/src/M365SecurityDashboard.Api/Services): `src/M365SecurityDashboard.Api/Services`
- [Metrics and trends](https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/MetricsService.cs): `src/M365SecurityDashboard.Api/Services/MetricsService.cs`

### API and operations

- [API host](https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Program.cs): `src/M365SecurityDashboard.Api/Program.cs`
- [API endpoints](https://github.com/sameerk27/vigil365/tree/master/src/M365SecurityDashboard.Api/Endpoints): `src/M365SecurityDashboard.Api/Endpoints`
- [Sign-in and RBAC](https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/RoleClaimsTransformation.cs): `src/M365SecurityDashboard.Api/Services/RoleClaimsTransformation.cs`
- [Audit trail](https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/AuditLogger.cs): `src/M365SecurityDashboard.Api/Services/AuditLogger.cs`
- [Notifications](https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/NotificationSender.cs): `src/M365SecurityDashboard.Api/Services/NotificationSender.cs`
- [Reports and digests](https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/DigestBuilder.cs): `src/M365SecurityDashboard.Api/Services/DigestBuilder.cs`
- [Data retention](https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Services/DataRetentionWorker.cs): `src/M365SecurityDashboard.Api/Services/DataRetentionWorker.cs`

### Persistence

- [Database context](https://github.com/sameerk27/vigil365/blob/master/src/M365SecurityDashboard.Api/Data/AppDbContext.cs): `src/M365SecurityDashboard.Api/Data/AppDbContext.cs`

### Other components

- **Admin / analyst**
- **Microsoft Graph**
- **SQL Server**

## Connections

- Admin / analyst → Dashboard shell: uses (evidence: `README.md`)
- Dashboard shell → Monitoring pages: navigates (evidence: `src/m365-security-dashboard-client/src/main.tsx`)
- Dashboard shell → API client: calls (evidence: `src/m365-security-dashboard-client/src/main.tsx`)
- Monitoring pages → API client: loads data
- Alert center → API client: manages alerts
- API client → API endpoints: requests
- API host → API endpoints: hosts (evidence: `src/M365SecurityDashboard.Api/Endpoints/AuthHealthEndpoints.cs`)
- API host → Sign-in and RBAC: configures (evidence: `src/M365SecurityDashboard.Api/Program.cs`)
- API host → Database context: configures (evidence: `src/M365SecurityDashboard.Api/Program.cs`)
- API host → Scheduled collection: registers (evidence: `src/M365SecurityDashboard.Api/Program.cs`)
- Scheduled collection → Graph collector: schedules
- Graph collector → Graph API client: requests data
- Graph API client → Microsoft Graph: queries (evidence: `src/M365SecurityDashboard.Api/Services/GraphApiClient.cs`)
- Scheduled collection → Database context: stores results
- Alert evaluator → Database context: evaluates records
- Recommendations → Database context: reads alerts (evidence: `src/M365SecurityDashboard.Api/Services/RecommendationsEngine.cs`)
- Posture analyzers → Database context: reads tenant data (evidence: `src/M365SecurityDashboard.Api/Services/RecommendationsEngine.cs`)
- Metrics and trends → Database context: records trends (evidence: `src/M365SecurityDashboard.Api/Services/MetricsService.cs`)
- Notifications → Database context: records delivery
- Reports and digests → Notifications: sends digests
- Data retention → Database context: prunes records (evidence: `src/M365SecurityDashboard.Api/Services/DataRetentionWorker.cs`)
- Audit trail → Database context: writes audit (evidence: `src/M365SecurityDashboard.Api/Services/AuditLogger.cs`)
- Database context → SQL Server: persists data (evidence: `src/M365SecurityDashboard.Api/Data/AppDbContext.cs`)
