Quick Start
The fastest way to get started:http://localhost:3000 (login: admin / admin).
Building the Backend
The backend is a Go web server that serves the API and frontend assets.Development Build with Hot-Reload
Start the backend with hot-reload
- Builds the Go binary
- Starts the server on
localhost:3000 - Watches for changes and automatically rebuilds
- Uses Air for hot-reload (configured in
.air.toml)
First build takes ~3 minutes due to debug symbols. Subsequent hot-reload rebuilds are much faster.
Production Build
Build the backend without hot-reload:bin/grafana.
Build Without Make
If you prefer not to use Make:CGO and Static Builds
- Development (Default)
- Production
make run and make build-go detect GCC and enable CGO automatically if available.- With CGO: Uses SQLite for the embedded database
- Without CGO: No SQLite support
Windows-Specific Build Instructions
Install Wire tool
Follow the Wire installation instructions.
On Windows, you can use Make for Windows in a UNIX shell like Git Bash.
Building the Frontend
The frontend is built with webpack and served by the backend in development.Development Build with Watch
Production Build
Build optimized frontend assets:public/build/.
Build Variations
Troubleshooting Frontend Builds
Type-checking errors after git pull
Type-checking errors after git pull
The incremental TypeScript build cache may be stale:
Checksum mismatch on yarn install
Checksum mismatch on yarn install
Temporary mismatch for a dependency:
Building Plugins
Some built-in plugins require separate builds:Build All Plugins
Build Specific Plugins
Build a single plugin:List All Plugins
Plugins Requiring Separate Builds
- azuremonitor
- cloud-monitoring
- grafana-postgresql-datasource
- grafana-pyroscope-datasource
- grafana-testdata-datasource
- jaeger
- loki
- mysql
- parca
- tempo
- zipkin
Building Both Frontend and Backend
Build everything in one command:make build-go- Builds backendyarn build- Builds frontend
Code Generation
Some changes require regenerating code:Wire Dependency Injection
After modifying service initialization:CUE Schemas
After modifying dashboard/panel schemas inkinds/:
Feature Toggles
After adding/modifying feature flags inpkg/services/featuremgmt/:
App SDK Apps
After modifying apps inapps/:
Go Workspace
After adding Go modules:OpenAPI/Swagger Specs
After API changes:i18n String Extraction
After adding translatable strings:Building for Docker
Build a development Docker image:grafana/grafana:dev.
On Docker for macOS, increase memory limit to >2 GiB in Docker Desktop → Preferences → Advanced.
Linting and Formatting
Before committing, ensure your code passes linting:Backend
Frontend
Build Configuration
Environment Variables
| Variable | Purpose |
|---|---|
CGO_ENABLED | Enable/disable CGO (0 or 1) |
GO_BUILD_TAGS | Go build tags (e.g., oss, enterprise) |
NODE_ENV | Node environment (dev or production) |
GO_RACE | Enable Go race detector |
Makefile Targets
View all available targets:make run- Run backend with hot-reloadmake build- Build frontend and backendmake build-backend- Build backend onlymake test-go- Run backend testsmake test-js- Run frontend testsmake devenv- Start development services
Next Steps
Testing
Run tests for your changes
Creating Pull Requests
Submit your changes for review