This is the main Dasharr application source code - a unified media dashboard for monitoring your media server ecosystem.
The application now collects comprehensive metrics from:
- Series statistics (total, monitored, continuing, ended)
- Episode counts (total, downloaded, missing, unaired, today)
- Quality breakdowns (4K, 1080p, 720p, SD)
- Queue information and download rates
- Indexer and download client health
- Storage usage and average file sizes
- Movie statistics (total, monitored, downloaded, missing)
- Quality breakdowns (4K, 1080p, 720p, SD)
- Queue status and download speeds
- Indexer and download client health
- Storage metrics
- Indexer statistics (total, enabled, failing, disabled)
- Application sync status
- Grab and query statistics with success rates
- Average response times
- Health monitoring
# Application
PORT=3000 # Web interface port
TZ=America/New_York # Timezone
APP_URL=http://localhost:3000 # Full URL where Dasharr is accessible
TRUST_PROXY=false # Set true if behind reverse proxy
DASHARR_SELF_SIGNED=true # Allow self-signed certificates
LOG_LEVEL=info # Options: error, warn, info, debug, trace
# Metrics Push Configuration (Optional)
METRICS_ENDPOINT_URL=https://your-analytics-endpoint.com
DASHBOARD_SECRET=your-secret-token-here
CONTAINER_ID=dasharr-main # Unique identifier for this instance
METRICS_PUSH_INTERVAL=300000 # Push interval in milliseconds (5 min default)
ENABLE_METRICS_PUSH=false # Enable/disable metrics push
Services can be configured via environment variables or the web UI at /admin
:
# Sonarr
SONARR_URL=http://sonarr:8989
SONARR_API_KEY=your-api-key
# Radarr
RADARR_URL=http://radarr:7878
RADARR_API_KEY=your-api-key
# Prowlarr
PROWLARR_URL=http://prowlarr:9696
PROWLARR_API_KEY=your-api-key
# ... other services
Access /admin
to configure:
- Authentication: Enable/disable admin panel protection with custom credentials
- Service Connections: Add/edit service URLs and API keys
- Global Polling: How often to collect metrics from services (15s - 1hr)
- Global Push: How often to push metrics to Cloudflare (1min - 1hr)
- Proxy Settings: Auto-detect and configure reverse proxy settings
- Logging: Adjust log levels and timezone
docker compose up -d
docker build --platform linux/amd64 -t dasharr:dev .
services:
dasharr:
image: dasharr:latest
container_name: dasharr
ports:
- 3000:3000
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
- CLOUDFLARE_WORKER_URL=https://your-worker.workers.dev
- DASHBOARD_SECRET=your-secret-here
# Optional: Force authentication (overrides UI settings)
# - DASHARR_ADMIN_USERNAME=admin
# - DASHARR_ADMIN_PASSWORD=secure-password
volumes:
- ./config:/app/config
- ./data:/data # SQLite database storage
restart: unless-stopped
- Collection: Services are polled based on the Global Polling interval
- Storage: Metrics are temporarily stored in memory
- Transformation: Data is formatted for the Cloudflare Worker API
- Transmission: HTTP POST to
{WORKER_URL}/api/v1/metrics
- Retry Logic: Automatic retry on failure with exponential backoff
Headers:
Content-Type: application/json
x-client-secret: your-32-character-secret
Body:
{
"container_id": "dasharr-main-sonarr",
"service_type": "sonarr",
"metrics": {
"series_total": 150,
"series_monitored": 140,
"episodes_total": 3500,
"episodes_downloaded": 3200,
"episodes_missing": 300,
"queue_count": 5,
"health_issues": 0
}
}
With 50+ metrics collected across all services, Dasharr provides enterprise-level monitoring data:
- Series: total, monitored, unmonitored, continuing, ended
- Episodes: total, downloaded, missing, unaired, today, 4K, 1080p, 720p, SD
- Storage: total_size_bytes, average_episode_size_bytes
- Queue: count, size_bytes, download_rate_bytes_per_sec
- System: indexers (total/enabled/failing), download_clients (total/active), health_issues, api_response_time_ms
- Movies: total, monitored, unmonitored, downloaded, missing, 4K, 1080p, 720p, SD
- Storage: total_size_bytes, average_movie_size_bytes
- Queue: count, size_bytes, download_rate_bytes_per_sec
- System: indexers (total/enabled/failing), download_clients (total/active), health_issues, api_response_time_ms
- Indexers: total, enabled, disabled, failing, temporary_disabled
- Apps: total, synced
- Activity: grabs (total/successful/failed), queries (total/successful/failed)
- Performance: avg_response_time_ms, health_issues, api_response_time_ms
- Series/Movies added over time
- Quality distribution trends (4K adoption, HD vs SD)
- Storage usage growth and projections
- Episode/Movie availability ratios
- Queue depth over time
- Download speeds and completion rates
- Failed vs successful downloads
- Peak usage hours and patterns
- Indexer reliability scores and uptime
- API response times across services
- Health issue frequency and resolution
- Download client performance comparisons
- 4K vs HD vs SD breakdown over time
- Average file sizes by quality
- Storage efficiency metrics
- Quality upgrade patterns
- Service availability and uptime
- Error rates and failure patterns
- Performance bottlenecks identification
- Capacity planning metrics
- Live queue status across all services
- Current download rates and ETA
- Health status indicators
- Storage utilization gauges
- Monthly/yearly library growth
- Download success rates over time
- Quality migration patterns
- Performance degradation alerts
- Service efficiency comparisons
- Indexer performance rankings
- Peak vs off-peak usage patterns
- Cost-per-GB analysis
- Health issue alerts
- Storage capacity warnings
- Performance degradation notifications
- Unusual activity detection
With comprehensive metrics + Cloudflare Analytics Engine:
- Predict storage needs based on growth patterns
- Identify optimal download times based on performance data
- Track content consumption patterns
- Monitor service efficiency and optimize configurations
- Create SLA dashboards for your media infrastructure
Use the test endpoint to verify connectivity:
curl -X POST http://localhost:3000/api/admin/metrics-push/test \
-H "Content-Type: application/json" \
-d '{
"workerUrl": "https://test.dasharr.io",
"dashboardSecret": "test-secret",
"containerId": "test-container",
"useQueue": false
}'
curl -X POST https://your-worker.workers.dev/api/v1/metrics \
-H "Content-Type: application/json" \
-H "x-client-secret: your-secret" \
-d '{
"container_id": "manual-test",
"service_type": "sonarr",
"metrics": { ... }
}'
dasharr/
├── src/
│ ├── app/ # Next.js app directory
│ │ ├── api/ # API routes
│ │ │ ├── admin/ # Admin endpoints
│ │ │ └── metrics/ # Metrics endpoints
│ │ └── admin/ # Admin UI pages
│ ├── components/ # React components
│ └── lib/
│ ├── api/ # Service API clients
│ ├── config/ # Configuration management
│ └── metrics/ # Metrics collection & push
│ ├── collector.ts # Main metrics collector
│ ├── pusher.ts # HTTP POST pusher
│ └── *-collector.ts # Service-specific collectors
├── config/ # Runtime configuration storage
├── public/ # Static assets
├── server.js # Custom Next.js server
└── Dockerfile # Container definition
docker logs dasharr --tail 50 -f
LOG_LEVEL=debug docker compose up
-
"Failed to store metrics" with D1 errors from Worker
- The Cloudflare Worker is receiving data but has database schema issues
- This is a Worker-side issue that needs to be fixed in the D1 database schema
- Previous "Database not available" errors have been resolved
-
Metrics not pushing
- Verify
DASHBOARD_SECRET
is set - Check
CLOUDFLARE_WORKER_URL
is correct - Ensure at least one service is configured
- Verify
-
Connection refused to services
- Use container names, not localhost (e.g.,
http://sonarr:8989
) - Verify services are on the same Docker network
- Check API keys are correct
- Use container names, not localhost (e.g.,
npm install
npm run dev
npm run build
npm start
.env.example
- Template with all available options.env
- Your local configuration (git ignored)config/
- Runtime configuration storage
- Authentication Fix: Moved secret from request body to
x-client-secret
header for Cloudflare compatibility - Queue Support: Added Queue checkbox for Cloudflare Queues (/api/v1/metrics/queue) vs direct processing
- UI Improvements: Hidden push configuration fields until Enable Push is checked
- Purple Branding: Fixed toggle switches to use consistent dasharr-purple color scheme
- Comprehensive Metrics: Added enhanced metrics collection for Sonarr, Radarr, and Prowlarr (50+ metrics)
- HTTP POST Architecture: Replaced WebSocket with HTTP POST metrics push for better reliability
- Admin Dashboard: Added Enable Push, Push Target, Secret, Queue, and Push Frequency controls
- Test Integration: Added Test Push button with real-time feedback
- Environment Variables: Updated for clarity and added Queue support
- Error Handling: Enhanced retry logic and proper authentication
- Container Deployment: Successfully deployed with :dev tag on dockge server (10.11.11.2)
- Main project docs:
/project-support-docs/
- Deployment scripts:
/project-support-docs/scripts/
- API documentation:
/Users/tim/Coding/apidocs/
Private project - not for public distribution