Implement a comprehensive web-based dashboard for managing Telegram and Discord bots with real-time monitoring, process control, and beautiful UI. Backend (FastAPI): - Complete REST API with OpenAPI documentation - WebSocket support for real-time log streaming and statistics - SQLAlchemy models for bots, logs, and users - JWT-based authentication system - Process management with subprocess and psutil - Auto-restart functionality with configurable backoff - System and bot resource monitoring (CPU, RAM, network) - Comprehensive error handling and logging Frontend (Next.js 14 + TypeScript): - Modern React application with App Router - shadcn/ui components with Tailwind CSS - TanStack Query for data fetching and caching - Real-time WebSocket integration - Responsive design for mobile, tablet, and desktop - Beautiful dark theme with glassmorphism effects - Bot cards with status badges and controls - System statistics dashboard Example Bots: - Telegram userbot using Telethon - Telegram bot using python-telegram-bot - Discord bot using discord.py - Full command examples and error handling Infrastructure: - Docker and Docker Compose configurations - Multi-stage builds for optimal image sizes - Nginx reverse proxy with WebSocket support - Production and development compose files - Rate limiting and security headers Documentation: - Comprehensive README with setup instructions - API documentation examples - Configuration guides - Troubleshooting section - Makefile for common commands Features: - Start/stop/restart bots with one click - Real-time log streaming via WebSocket - Live system and bot statistics - Auto-restart on crashes - Bot configuration management - Process monitoring and resource tracking - Search and filter bots - Responsive UI with loading states - Toast notifications for all actions Security: - JWT token-based authentication - Password hashing with bcrypt - CORS configuration - Environment variable management - Input validation and sanitization - Rate limiting in nginx - Security headers configured
86 lines
1.8 KiB
Makefile
86 lines
1.8 KiB
Makefile
# Makefile for Bot Management Dashboard
|
|
|
|
.PHONY: help dev build up down logs clean install test format lint
|
|
|
|
# Default target
|
|
help:
|
|
@echo "Bot Management Dashboard - Available commands:"
|
|
@echo ""
|
|
@echo " make dev - Start development environment"
|
|
@echo " make build - Build Docker images"
|
|
@echo " make up - Start all services"
|
|
@echo " make down - Stop all services"
|
|
@echo " make logs - View logs"
|
|
@echo " make clean - Clean up containers and volumes"
|
|
@echo " make install - Install dependencies"
|
|
@echo " make test - Run tests"
|
|
@echo " make format - Format code"
|
|
@echo " make lint - Lint code"
|
|
|
|
# Development
|
|
dev:
|
|
docker-compose up
|
|
|
|
# Build images
|
|
build:
|
|
docker-compose build
|
|
|
|
# Start services
|
|
up:
|
|
docker-compose up -d
|
|
|
|
# Stop services
|
|
down:
|
|
docker-compose down
|
|
|
|
# View logs
|
|
logs:
|
|
docker-compose logs -f
|
|
|
|
# Clean up
|
|
clean:
|
|
docker-compose down -v
|
|
rm -rf backend/__pycache__
|
|
rm -rf backend/app/__pycache__
|
|
rm -rf frontend/.next
|
|
rm -rf frontend/node_modules
|
|
rm -rf backend/venv
|
|
|
|
# Install dependencies
|
|
install:
|
|
cd backend && pip install -r requirements.txt
|
|
cd frontend && npm install
|
|
cd bots/examples && pip install -r requirements.txt
|
|
|
|
# Run tests
|
|
test:
|
|
cd backend && pytest
|
|
cd frontend && npm run test
|
|
|
|
# Format code
|
|
format:
|
|
cd backend && black app/
|
|
cd frontend && npm run format
|
|
|
|
# Lint code
|
|
lint:
|
|
cd backend && flake8 app/
|
|
cd frontend && npm run lint
|
|
|
|
# Database
|
|
db-init:
|
|
cd backend && python -c "from app.database import init_db; init_db()"
|
|
|
|
# Production
|
|
prod-build:
|
|
docker-compose -f docker-compose.prod.yml build
|
|
|
|
prod-up:
|
|
docker-compose -f docker-compose.prod.yml up -d
|
|
|
|
prod-down:
|
|
docker-compose -f docker-compose.prod.yml down
|
|
|
|
prod-logs:
|
|
docker-compose -f docker-compose.prod.yml logs -f
|