Dashboard

Monitor and manage your nself backend infrastructure with comprehensive dashboards, metrics, and real-time insights.

Overview

nself provides built-in dashboard capabilities through multiple interfaces, giving you complete visibility into your backend services, database performance, and system health.

Service Dashboards

Hasura Console

Access the powerful Hasura GraphQL console for managing your API:

# Access at http://localhost:8080
# Features:
# - GraphQL query explorer
# - Database browser
# - API permissions
# - Event triggers
# - Actions and remote schemas
# - Metadata management

MinIO Console

Manage your object storage with the MinIO web console:

# Access at http://localhost:9001
# Default credentials from .env.local:
# Username: admin
# Password: [generated password]

# Features:
# - Bucket management
# - File upload/download
# - Access policies
# - User management
# - Monitoring and metrics

Database Administration

While nself doesn't include a built-in database dashboard, you can easily add popular tools:

pgAdmin 4

# Add to your .env.local:
PGADMIN_ENABLED=true
PGADMIN_EMAIL=admin@example.com
PGADMIN_PASSWORD=your-secure-password

# Rebuild and start
nself build && nself up

# Access at http://localhost:5050

Adminer

# Lightweight alternative - add to .env.local:
ADMINER_ENABLED=true

# Access at http://localhost:8081
# Connection details:
# System: PostgreSQL
# Server: postgres
# Username: postgres
# Password: [from .env.local]
# Database: [your project name]

Monitoring Dashboard

System Metrics

Monitor resource usage and system health:

# View current resource usage
nself resources

# Continuous monitoring
nself resources --watch

# JSON output for external tools
nself resources --format json

Service Health

# Check all service status
nself status --verbose

# Health check with details
nself doctor

# Monitor specific service
nself logs -f postgres
nself logs -f hasura

Adding Grafana + Prometheus

For advanced monitoring, you can add Grafana and Prometheus:

Enable Monitoring Stack

# Add to .env.local:
GRAFANA_ENABLED=true
PROMETHEUS_ENABLED=true

# Configure Grafana
GRAFANA_ADMIN_PASSWORD=secure-password

# Rebuild with monitoring services
nself build && nself up

Access Monitoring

  • Grafana: http://localhost:3000 (admin / [your password])
  • Prometheus: http://localhost:9090

Pre-configured Dashboards

nself includes pre-configured Grafana dashboards for:

  • PostgreSQL performance metrics
  • Hasura GraphQL API metrics
  • Redis cache performance
  • MinIO storage metrics
  • System resource utilization
  • Docker container metrics

Custom Dashboards

Application Metrics

Integrate your application metrics with the monitoring stack:

# Example: Express.js metrics endpoint
app.get('/metrics', (req, res) => {
  res.set('Content-Type', 'text/plain');
  res.send(promClient.register.metrics());
});

# Configure Prometheus to scrape your app
# In prometheus.yml:
scrape_configs:
  - job_name: 'my-app'
    static_configs:
      - targets: ['my-app:3000']

Business Metrics

# Custom Grafana dashboard for business metrics
# Example queries:
# - User signups per day
# - API request volume
# - Error rates by endpoint
# - Database query performance
# - Storage usage trends

Alert Management

Configure Alerts

# Example Grafana alerts
# High CPU usage
avg(cpu_usage) > 80

# High memory usage  
avg(memory_usage) > 85

# Database connection issues
postgres_up == 0

# High error rate
rate(http_errors[5m]) > 0.1

Notification Channels

  • Email: SMTP configuration for email alerts
  • Slack: Webhook integration for team notifications
  • Discord: Community server alerts
  • PagerDuty: Production incident management

Log Management

Centralized Logging

# Enable log aggregation
LOG_AGGREGATION_ENABLED=true

# Access logs dashboard
nself logs --dashboard

# Search logs
nself logs --search "error" --since "1h"
nself logs --grep "database" postgres

Log Analytics

Optional ELK stack (Elasticsearch, Logstash, Kibana) integration:

# Add to .env.local:
ELK_ENABLED=true
ELASTICSEARCH_PASSWORD=secure-password

# Access Kibana at http://localhost:5601

Performance Monitoring

Database Performance

# Monitor slow queries
SELECT query, mean_time, calls 
FROM pg_stat_statements 
ORDER BY mean_time DESC LIMIT 10;

# Check connection pools
SELECT state, count(*) 
FROM pg_stat_activity 
GROUP BY state;

# Table sizes
SELECT schemaname, tablename, 
       pg_size_pretty(pg_total_relation_size(schemaname||'.'||tablename)) as size
FROM pg_tables 
ORDER BY pg_total_relation_size(schemaname||'.'||tablename) DESC;

API Performance

# Hasura query analytics
query GetQueryAnalytics {
  query_collection {
    name
    average_execution_time
    request_count
  }
}

# Monitor GraphQL operations
nself logs hasura | grep "query-log"

Security Dashboard

Access Monitoring

  • Failed login attempts
  • Unusual access patterns
  • API rate limiting triggers
  • SSL certificate expiration

Audit Logging

# Enable audit logging
AUDIT_LOGGING_ENABLED=true

# Track:
# - Database schema changes
# - User permission modifications
# - Configuration updates
# - Service restarts

Mobile Dashboard

Access key metrics on mobile devices:

  • Responsive Grafana dashboards
  • Mobile-optimized status pages
  • Push notifications for critical alerts
  • Quick action buttons for common tasks

Dashboard Customization

Team Dashboards

# Create role-based dashboards
# - Developer dashboard: logs, debugging, local metrics
# - DevOps dashboard: infrastructure, deployments, alerts
# - Business dashboard: user metrics, performance KPIs
# - Executive dashboard: high-level trends, costs

API Integration

# Integrate with external tools
# Datadog API
POST /api/v1/metrics
{
  "series": [
    {
      "metric": "nself.users.active",
      "points": [[timestamp, value]]
    }
  ]
}

# Custom webhook notifications
curl -X POST webhook-url \
  -H "Content-Type: application/json" \
  -d '{"alert": "High CPU", "value": 95}'

Best Practices

  • Start Simple: Begin with built-in dashboards, add complexity as needed
  • Role-based Access: Provide different dashboard views for different roles
  • Actionable Alerts: Set up alerts that require action, avoid alert fatigue
  • Regular Reviews: Periodically review and update dashboard relevance
  • Document Everything: Maintain documentation for custom dashboards and alerts
  • Security First: Secure dashboard access and audit dashboard usage

Next Steps