Files
bot-dashboard/frontend/types/bot.ts
Claude 297e94593f feat: Complete production-ready bot management dashboard system
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
2025-11-21 10:31:11 +00:00

62 lines
1.1 KiB
TypeScript

/**
* Type definitions for bot-related entities.
*/
export enum BotType {
TELEGRAM_USERBOT = "telegram_userbot",
TELEGRAM_BOT = "telegram_bot",
DISCORD_BOT = "discord_bot",
}
export enum BotStatus {
STOPPED = "stopped",
STARTING = "starting",
RUNNING = "running",
STOPPING = "stopping",
CRASHED = "crashed",
}
export interface Bot {
id: string;
name: string;
type: BotType;
config: Record<string, any>;
status: BotStatus;
auto_restart: boolean;
created_at: string;
updated_at: string;
last_started_at: string | null;
process_id: number | null;
restart_count: number;
last_crash_at: string | null;
}
export interface BotCreate {
name: string;
type: BotType;
config: Record<string, any>;
auto_restart: boolean;
}
export interface BotUpdate {
name?: string;
config?: Record<string, any>;
auto_restart?: boolean;
}
export interface BotListResponse {
total: number;
page: number;
page_size: number;
bots: Bot[];
}
export interface BotStatusResponse {
id: string;
name: string;
status: BotStatus;
process_id: number | null;
uptime_seconds: number | null;
last_started_at: string | null;
}