thothctl

ThothCTL Dashboard

The ThothCTL Dashboard provides a unified web interface to view and manage all your infrastructure data in one place. It integrates scan results, inventory, cost analysis, drift detection, AI usage tracking, and risk assessments into a modern, responsive web application.

Features

Quick Start

Launch Dashboard

# Start dashboard on default port 8080
thothctl dashboard launch

# Custom port and host
thothctl dashboard launch --port 3000 --host 0.0.0.0

# Debug mode
thothctl dashboard launch --debug

# Don't open browser automatically
thothctl dashboard launch --no-browser

Access Dashboard

Once launched, the dashboard will be available at:

Data Sources

The dashboard automatically loads data from existing ThothCTL reports:

Inventory Data

SBOM Data

Security Scan Results

Cost Analysis

Risk Assessment

Drift Detection

AI Token Usage

Enhanced Features (v0.19.0)

Security Findings Viewer

The findings viewer provides granular access to individual security findings across all scanning tools:

SBOM Details Viewer

Full CycloneDX 1.6 support with rich metadata visualization:

Inventory Browser

Enhanced inventory browsing experience:

Drift Detection

Visualize infrastructure drift directly in the dashboard:

AI Token Usage

Monitor AI provider consumption:

Infrastructure Topology

The infrastructure topology view is integrated within the Blast Radius tab, providing a unified visualization of your infrastructure dependencies and change impact:

Data source: Reports/topology/topology.json

Generate topology data:

thothctl check iac -type blast-radius --recursive

Architecture

Twelve-Factor App Compliance

The dashboard follows twelve-factor app principles:

  1. Codebase: Single codebase in version control
  2. Dependencies: Explicitly declared (FastAPI, Uvicorn, etc.)
  3. Config: Environment variables (THOTHCTL_DEBUG, THOTHCTL_VERBOSE)
  4. Backing Services: File-based data sources as attached resources
  5. Build/Release/Run: Separate stages
  6. Processes: Stateless with in-memory caching
  7. Port Binding: Self-contained service via Uvicorn
  8. Concurrency: Scalable via Uvicorn workers and async handlers
  9. Disposability: Fast startup/shutdown
  10. Dev/Prod Parity: Same code in all environments
  11. Logs: Event streams via Python logging
  12. Admin Processes: Dashboard as admin interface

Data Loading Strategy

# Efficient file-based loading
class DashboardDataLoader:
    def __init__(self):
        self.cache = {}
        self.cache_ttl = 300  # 5 minutes
    
    def get_inventory_data(self):
        # Load from Reports/inventory/InventoryIaC_*.json
        # Cache for 5 minutes
        # Graceful error handling

Performance Features

API Endpoints

Data Endpoints

Control Endpoints

Response Format

{
  "components": [...],
  "summary": {...},
  "error": "Error message if any"
}

Findings Response Format

{
  "findings": [...],
  "total": 142,
  "limit": 20,
  "offset": 0,
  "filters": {
    "tool": "checkov",
    "severity": "high",
    "search": ""
  }
}

Configuration

Environment Variables

# Debug logging
export THOTHCTL_DEBUG=true

# Verbose logging  
export THOTHCTL_VERBOSE=true

# Custom host/port (can also use CLI flags)
# Default: 127.0.0.1:8080

File Patterns

The dashboard looks for these file patterns:

Reports/
β”œβ”€β”€ inventory/
β”‚   β”œβ”€β”€ InventoryIaC_*.json              # Inventory data
β”‚   β”œβ”€β”€ InventoryIaC_cyclonedx_*.json    # CycloneDX SBOM data
β”‚   └── html_reports/                    # Inventory HTML reports
β”œβ”€β”€ topology/
β”‚   β”œβ”€β”€ topology.json                    # Infrastructure topology data
β”‚   └── architecture.png                 # AWS architecture diagram
β”œβ”€β”€ blast-radius/
β”‚   └── blast_radius_*.json              # Blast radius analysis
β”œβ”€β”€ opa/
β”‚   └── html_reports/                    # OPA/compliance HTML reports
β”œβ”€β”€ cost_analysis_*.json                 # Cost analysis
β”œβ”€β”€ blast_radius_*.json                  # Risk assessment
β”œβ”€β”€ drift_*.json                         # Drift detection
β”œβ”€β”€ **/*.html                            # Scan reports
└── **/*.xml                             # Test results

Development

Project Structure

src/thothctl/
β”œβ”€β”€ commands/dashboard/
β”‚   β”œβ”€β”€ cli.py                    # Command interface
β”‚   └── commands/
β”‚       └── launch.py             # Launch command
β”œβ”€β”€ services/dashboard/
β”‚   β”œβ”€β”€ dashboard_service.py      # FastAPI + Uvicorn web service
β”‚   └── data_loader.py           # Data loading logic
└── utils/common/templates/
    └── dashboard.html           # Web interface

Adding New Data Sources

  1. Extend DataLoader:
    def get_new_data_source(self) -> Dict[str, Any]:
     cache_key = "new_source"
     if self._is_cache_valid(cache_key):
         return self.cache[cache_key]["data"]
        
     # Load from files
     data = load_from_files()
     self._cache_data(cache_key, data)
     return data
    
  2. Add API Endpoint:
    @self.app.get("/api/new-source")
    async def api_new_source():
     return self.data_loader.get_new_data_source()
    
  3. Update Frontend:
    async function loadNewSourceData() {
     const response = await fetch('/api/new-source');
     const data = await response.json();
     // Update UI
    }
    

Troubleshooting

Common Issues

Dashboard won’t start

# Check if port is available
netstat -tulpn | grep :8080

# Try different port
thothctl dashboard launch --port 8081

No data showing

# Generate sample data first
thothctl inventory iac
thothctl scan iac  
thothctl check iac -type cost-analysis
thothctl check iac -type drift --recursive

Permission errors

# Check file permissions
ls -la Reports/
chmod 644 Reports/**/*.json

Debug Mode

# Enable debug logging
export THOTHCTL_DEBUG=true
thothctl dashboard launch --debug

Testing

# Test API endpoints
python test_dashboard.py

# Manual testing
curl http://localhost:8080/api/inventory
curl "http://localhost:8080/api/findings?tool=checkov&severity=high&limit=10"
curl http://localhost:8080/api/sbom
curl http://localhost:8080/api/drift
curl http://localhost:8080/api/ai-usage

Security Considerations

Integration Examples

CI/CD Pipeline

# .github/workflows/infrastructure.yml
- name: Generate Reports
  run: |
    thothctl inventory iac --check-versions
    thothctl scan iac
    thothctl check iac -type cost-analysis
    thothctl check iac -type drift --recursive

- name: Launch Dashboard
  run: |
    thothctl dashboard launch --no-browser --port 8080 &
    sleep 5
    curl http://localhost:8080/api/inventory

Docker Integration

FROM python:3.12-slim
COPY . /app
WORKDIR /app
RUN pip install -e .
EXPOSE 8080
CMD ["thothctl", "dashboard", "launch", "--host", "0.0.0.0"]

Monitoring Integration

# Health check endpoint
curl -f http://localhost:8080/ || exit 1

# Data freshness check
curl http://localhost:8080/api/refresh

Future Enhancements