# mohammedayad1/grafana architecture

> Architecture diagram of the GitHub repository mohammedayad1/grafana, 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/mohammedayad1/grafana
- Repository: https://github.com/mohammedayad1/grafana

## Overview

Grafana is a monitoring and observability platform: users query data sources, visualize results in dashboards, and explore metrics and logs; alert rules are evaluated and can send notifications to external systems. The graph preserves those documented capabilities and includes dashboard, query, alerting, and notification components present in the tree. Source excerpts show public-dashboard query dispatch, alert-route matching, folder retrieval, and unified resource storage; other relationships are documented at a higher level in the README, so implementation links are omitted where evidence is unavailable.

Main entry points: [`apps/dashboard/pkg/apis/dashboard/v0alpha1/dashboard_spec.go`](https://github.com/mohammedayad1/grafana/blob/main/apps/dashboard/pkg/apis/dashboard/v0alpha1/dashboard_spec.go) (Dashboards), [`packages/grafana-runtime/src/utils/publicDashboardQueryHandler.ts`](https://github.com/mohammedayad1/grafana/blob/main/packages/grafana-runtime/src/utils/publicDashboardQueryHandler.ts) (Public dashboard query), [`public/app/core/components/NestedFolderPicker/useFoldersQueryAppPlatform.ts`](https://github.com/mohammedayad1/grafana/blob/main/public/app/core/components/NestedFolderPicker/useFoldersQueryAppPlatform.ts) (Folder picker), [`apps/alerting/rules/pkg/app/alertrule/validator.go`](https://github.com/mohammedayad1/grafana/blob/main/apps/alerting/rules/pkg/app/alertrule/validator.go) (Alert rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboards["Dashboards"]
  node_dashboards["Dashboards<br/>[dashboard_spec.go]"]
  node_folder_picker["Folder picker"]
  node_folders["Folder service"]
end

subgraph group_querying["Querying"]
  node_query["Public dashboard query"]
  node_datasources["Data sources"]
  node_visualizations["Visualizations<br/>[queryResponse.ts]"]
  node_explore["Metrics and logs"]
end

subgraph group_alerting["Alerting"]
  node_alert_rules["Alert rules<br/>[validator.go]"]
  node_rule_eval["Rule evaluation<br/>[engine.go]"]
  node_routing_preview["Route matching"]
  node_notifications["Notification settings<br/>[app.go]"]
end

subgraph group_storage["Storage"]
  node_resource_storage[("Unified resource storage<br/>[storage_backend.go]")]
end

node_user(("Grafana user"))
node_recipients(("Notification systems"))

node_user -->|"creates and views"| node_dashboards
node_dashboards -.->|"queries data"| node_query
node_query -->|"queries"| node_datasources
node_query -->|"returns results"| node_visualizations
node_user -->|"explores data"| node_explore
node_user -.->|"browses folders"| node_folder_picker
node_folder_picker -.->|"requests folders"| node_folders
node_dashboards -.->|"persists resources"| node_resource_storage
node_user -->|"defines rules"| node_alert_rules
node_alert_rules -->|"evaluates continuously"| node_rule_eval
node_rule_eval -->|"sends notifications"| node_notifications
node_notifications -->|"notifies"| node_recipients
node_routing_preview -->|"previews routes"| node_user

click node_dashboards "https://github.com/mohammedayad1/grafana/blob/main/apps/dashboard/pkg/apis/dashboard/v0alpha1/dashboard_spec.go"
click node_folder_picker "https://github.com/mohammedayad1/grafana/blob/main/public/app/core/components/NestedFolderPicker/useFoldersQueryAppPlatform.ts"
click node_folders "https://github.com/mohammedayad1/grafana/blob/main/pkg/services/folder/folderimpl/folder_unifiedstorage.go"
click node_query "https://github.com/mohammedayad1/grafana/blob/main/packages/grafana-runtime/src/utils/publicDashboardQueryHandler.ts"
click node_datasources "https://github.com/mohammedayad1/grafana/blob/main/packages/grafana-runtime/src/utils/DataSourceWithBackend.ts"
click node_visualizations "https://github.com/mohammedayad1/grafana/blob/main/packages/grafana-runtime/src/utils/queryResponse.ts"
click node_explore "https://github.com/mohammedayad1/grafana/blob/main/public/app/features/explore/TraceView/components/TracePageHeader/useTraceAdHocFiltersController.ts"
click node_alert_rules "https://github.com/mohammedayad1/grafana/blob/main/apps/alerting/rules/pkg/app/alertrule/validator.go"
click node_rule_eval "https://github.com/mohammedayad1/grafana/blob/main/pkg/services/ngalert/backtesting/engine.go"
click node_routing_preview "https://github.com/mohammedayad1/grafana/blob/main/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/useAlertmanagerNotificationRoutingPreview.ts"
click node_notifications "https://github.com/mohammedayad1/grafana/blob/main/apps/alerting/notifications/pkg/app/app.go"
click node_resource_storage "https://github.com/mohammedayad1/grafana/blob/main/pkg/storage/unified/resource/storage_backend.go"

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_dashboards,node_folder_picker,node_folders,node_user toneBlue
class node_query,node_datasources,node_visualizations,node_explore toneAmber
class node_alert_rules,node_rule_eval,node_routing_preview,node_notifications toneMint
class node_resource_storage toneRose
class node_recipients toneIndigo
```

## Components

### Dashboards

- [Dashboards](https://github.com/mohammedayad1/grafana/blob/main/apps/dashboard/pkg/apis/dashboard/v0alpha1/dashboard_spec.go): `apps/dashboard/pkg/apis/dashboard/v0alpha1/dashboard_spec.go`
- [Folder picker](https://github.com/mohammedayad1/grafana/blob/main/public/app/core/components/NestedFolderPicker/useFoldersQueryAppPlatform.ts): `public/app/core/components/NestedFolderPicker/useFoldersQueryAppPlatform.ts`
- [Folder service](https://github.com/mohammedayad1/grafana/blob/main/pkg/services/folder/folderimpl/folder_unifiedstorage.go): `pkg/services/folder/folderimpl/folder_unifiedstorage.go`

### Querying

- [Public dashboard query](https://github.com/mohammedayad1/grafana/blob/main/packages/grafana-runtime/src/utils/publicDashboardQueryHandler.ts): `packages/grafana-runtime/src/utils/publicDashboardQueryHandler.ts`
- [Data sources](https://github.com/mohammedayad1/grafana/blob/main/packages/grafana-runtime/src/utils/DataSourceWithBackend.ts): `packages/grafana-runtime/src/utils/DataSourceWithBackend.ts`
- [Visualizations](https://github.com/mohammedayad1/grafana/blob/main/packages/grafana-runtime/src/utils/queryResponse.ts): `packages/grafana-runtime/src/utils/queryResponse.ts`
- [Metrics and logs](https://github.com/mohammedayad1/grafana/blob/main/public/app/features/explore/TraceView/components/TracePageHeader/useTraceAdHocFiltersController.ts): `public/app/features/explore/TraceView/components/TracePageHeader/useTraceAdHocFiltersController.ts`

### Alerting

- [Alert rules](https://github.com/mohammedayad1/grafana/blob/main/apps/alerting/rules/pkg/app/alertrule/validator.go): `apps/alerting/rules/pkg/app/alertrule/validator.go`
- [Rule evaluation](https://github.com/mohammedayad1/grafana/blob/main/pkg/services/ngalert/backtesting/engine.go): `pkg/services/ngalert/backtesting/engine.go`
- [Route matching](https://github.com/mohammedayad1/grafana/blob/main/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/useAlertmanagerNotificationRoutingPreview.ts): `public/app/features/alerting/unified/components/rule-editor/notificaton-preview/useAlertmanagerNotificationRoutingPreview.ts`
- [Notification settings](https://github.com/mohammedayad1/grafana/blob/main/apps/alerting/notifications/pkg/app/app.go): `apps/alerting/notifications/pkg/app/app.go`

### Storage

- [Unified resource storage](https://github.com/mohammedayad1/grafana/blob/main/pkg/storage/unified/resource/storage_backend.go): `pkg/storage/unified/resource/storage_backend.go`

### Other components

- **Grafana user**
- **Notification systems**

## Connections

- Grafana user → Dashboards: creates and views
- Dashboards → Public dashboard query: queries data
- Public dashboard query → Data sources: queries
- Public dashboard query → Visualizations: returns results (evidence: `packages/grafana-runtime/src/utils/publicDashboardQueryHandler.ts`)
- Grafana user → Metrics and logs: explores data
- Grafana user → Folder picker: browses folders
- Folder picker → Folder service: requests folders
- Dashboards → Unified resource storage: persists resources
- Grafana user → Alert rules: defines rules
- Alert rules → Rule evaluation: evaluates continuously
- Rule evaluation → Notification settings: sends notifications
- Notification settings → Notification systems: notifies
- Route matching → Grafana user: previews routes (evidence: `public/app/features/alerting/unified/components/rule-editor/notificaton-preview/useAlertmanagerNotificationRoutingPreview.ts`)
