Laddr Dashboard
The official Laddr dashboard, distributed as a Docker image for seamless integration with Laddr projects.
๐ฏ Overview
This directory contains the React-based dashboard that provides comprehensive observability for Laddr agent systems. The dashboard is built and distributed as a Docker image (laddr/dashboard:latest) so users never need to touch frontend code.
๐๏ธ Architecture
dashboard/
โโโ src/ # React application source
โ โโโ App.tsx # Main application component
โ โโโ main.tsx # Application entry point
โ โโโ ...
โโโ public/ # Static assets
โโโ Dockerfile # Development Dockerfile
โโโ Dockerfile.prod # Production Dockerfile (multi-stage)
โโโ nginx.conf # Nginx configuration for production
โโโ vite.config.ts # Vite build configuration
โโโ package.json # Dependencies and scripts
โโโ build-dashboard.sh # Build script for Docker image
๐ฆ Distribution Model
For Users
- Dashboard is NOT copied to user projects
- Distributed as pre-built Docker image
- Automatically pulled when running
laddr run dev - Zero frontend setup required
For Maintainers
- Build and publish Docker images to Docker Hub
- Multi-stage build: Node.js โ Nginx
- Optimized for production (~40MB final size)
๐ Building the Dashboard
Development
# Install dependencies
npm install
# Run development server
npm run dev
# Dashboard available at http://localhost:5173
# Build for production
npm run build
# Output in dist/
Production Docker Image
# Build Docker image
./build-dashboard.sh v1.0.0
# Or manually
docker build -f Dockerfile.prod -t laddr/dashboard:latest .
# Test locally
docker run -p 5173:5173 laddr/dashboard:latest
# Push to Docker Hub
docker push laddr/dashboard:latest
docker push laddr/dashboard:v1.0.0
๐ง Technical Details
Multi-Stage Build
Stage 1: Builder
- Base:
node:20-alpine - Installs dependencies with
npm ci - Builds React app with Vite
- Output: Optimized static files
Stage 2: Server
- Base:
nginx:alpine - Copies built files from builder
- Includes custom nginx configuration
- Final size: ~40MB
Nginx Configuration
The production image uses nginx to:
- Serve static files with caching and compression
- Proxy
/api/*requests to API container - Proxy
/ws/*WebSocket connections - Handle React Router client-side routing
- Optimize with gzip compression
location /api/ {
proxy_pass http://api:8000/api/;
# ... proxy headers
}
location /ws/ {
proxy_pass http://api:8000/ws/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
Environment Variables
The dashboard uses environment variables for configuration:
VITE_API_URL: API server URL (default:http://api:8000)VITE_WS_URL: WebSocket URL (default:ws://api:8000)
๐ Features
The dashboard provides:
System Overview
- Active agents count
- Job queue status
- System health metrics
Agent Management
- View all registered agents
- Check agent status and queue depth
- Agent details (role, goal, tools)
- Chat with individual agents
Observability
- View distributed traces
- Monitor metrics and performance
- Real-time logs via WebSocket
- Token usage tracking
Job Management
- Submit new jobs
- Monitor job status
- View results
- Cancel running jobs
Real-time Updates
- WebSocket for live logs
- System event streaming
- Agent status updates
๐ API Integration
The dashboard communicates with the Laddr API server:
REST Endpoints
GET /api/agents- List agentsGET /api/agents/{name}- Get agent detailsPOST /api/agents/{name}/chat- Chat with agentGET /api/jobs- List jobsPOST /api/jobs- Submit jobGET /api/traces- Get tracesGET /api/metrics- Get metrics
WebSocket Endpoints
WS /ws/logs/{agent}- Stream agent logsWS /ws/events- Stream system events
๐งช Testing
# Run tests
npm test
# Run linting
npm run lint
# Type checking
npm run type-check
# Preview production build
npm run build
npm run preview
๐ฆ Dependencies
Core
- React 18.3 - UI framework
- React Router 6 - Client-side routing
- TypeScript - Type safety
Data Fetching
- TanStack Query 5 - Server state management
- Axios - HTTP client
UI Components
- Recharts - Data visualization
- Lucide React - Icons
Build Tools
- Vite 5 - Build tool and dev server
- TypeScript - Type checking
๐ Release Process
- Update version in
package.json - Build image:
./build-dashboard.sh v1.x.x - Test locally:
docker run -p 5173:5173 laddr/dashboard:v1.x.x - Push to Docker Hub:
docker push laddr/dashboard:v1.x.x - Tag as latest:
docker push laddr/dashboard:latest - Update docs: Note version in changelog
๐ Troubleshooting
Build fails
# Clean and rebuild
rm -rf node_modules dist
npm install
npm run build
Docker image too large
- Check multi-stage build is working
- Verify
node_modulesnot copied to final image - Use
docker imagesto check size
API connection fails
- Verify nginx proxy configuration
- Check CORS settings in API server
- Ensure API container is running
- Check network connectivity between containers
๐ Resources
๐ค Contributing
For maintainers working on the dashboard:
- Make changes in
src/ - Test locally with
npm run dev - Build production image
- Test Docker image locally
- Push to Docker Hub
- Update documentation
๐ License
Same as Laddr project license.
Note: This dashboard is designed to be distributed as a Docker image. Users should never need to modify or build it themselves. All customization is done via environment variables and API configuration.