Dashboard

v0.4.8Updated for nself v0.4.8

Monitor and manage your nself backend infrastructure with comprehensive dashboards, metrics, and real-time insights. Access nself-admin for a unified management experience.

Overview

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

nself-admin Dashboard

The primary management interface for nself deployments:

# Enable in .env
NSELF_ADMIN_ENABLED=true
NSELF_ADMIN_ROUTE=admin

# Access at https://admin.local.nself.org (dev)
# Port: 3021

# Features:
# - Service status and health monitoring
# - Configuration management
# - SSL certificate management
# - Project setup wizard
# - Log viewer
# - Metrics dashboard

Security Note: nself-admin should be DISABLED in production for security. Use staging or local environments for admin tasks.

Service Dashboards

Hasura Console

Access the powerful Hasura GraphQL console for managing your API:

# Access at https://api.local.nself.org/console
# 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 https://storage.local.nself.org/console
# Default credentials from .env:
# Username: MINIO_ROOT_USER
# Password: MINIO_ROOT_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

Monitoring Stack

nself includes a complete observability stack when monitoring is enabled:

Enable Monitoring

# Enable monitoring in .env
MONITORING_ENABLED=true

# Choose monitoring profile (v0.4.2+)
nself metrics enable minimal    # 4 services (~500MB)
nself metrics enable standard   # 7 services (~1GB)
nself metrics enable full       # 10 services (~2GB)
nself metrics enable auto       # Auto-detect based on ENV

# Rebuild with monitoring services
nself build && nself start

Access Monitoring

Monitor Command

# Open dashboards
nself monitor                   # Open Grafana (default)
nself monitor grafana           # Open Grafana
nself monitor prometheus        # Open Prometheus
nself monitor alerts            # Open Alertmanager
nself monitor loki              # Open Loki in Grafana

# CLI views
nself monitor services          # Service status
nself monitor resources         # Resource usage
nself monitor logs [service]    # Tail service logs

Pre-configured Dashboards

nself includes pre-configured Grafana dashboards for:

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

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

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:

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

Next Steps