Production‑ready real‑time analytics dashboard for the Telegram AIogram Bot.
Displays command heatmap, hourly charts, auto‑moderation rules, trade history, temporary invites, user management, and live event stream via WebSocket.
- 🔥 Real‑time event stream – Redis pub/sub → WebSocket (Laravel Reverb)
- 📊 Command heatmap – GitHub‑style, 365 days
- 📈 Hourly command charts – ApexCharts
- ⚖️ Auto‑moderation CRUD – Create/edit/delete rules (bot enforces)
- 🤝 Trade history – Pending & confirmed trades
- 🔗 Temporary invites – List invites generated by bot
- 👤 User management – View users, ban (simulated)
- 🔐 Telegram OAuth login – No passwords, secure
- 🐳 Docker Compose – Full stack (Laravel + Reverb + PostgreSQL + Redis)
- 🧪 Testing – PHPUnit, Pest (optional)
- PHP 8.2+ (8.5 supported)
- Composer 2.x
- Node.js 20+ & npm
- PostgreSQL 14+
- Redis 7+
git clone https://github.com/lelextb/telegram-bot-analytics.git
cd telegram-bot-analytics
composer install
npm install --legacy-peer-deps
cp .env.example .envEdit .env with your settings:
APP_NAME="Telegram Bot Analytics"
APP_ENV=local
APP_DEBUG=true
APP_URL=http://localhost
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=telegram_analytics
DB_USERNAME=your_db_user
DB_PASSWORD=your_db_password
BROADCAST_DRIVER=reverb
REVERB_APP_ID=123456
REVERB_APP_KEY=your-key
REVERB_APP_SECRET=your-secret
REVERB_HOST=localhost
REVERB_PORT=8080
REVERB_SCHEME=http
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
# Telegram OAuth
TELEGRAM_BOT_TOKEN=your_bot_token
TELEGRAM_BOT_USERNAME=your_bot_username
TELEGRAM_ADMIN_IDS=123456789 # comma‑separated Telegram user IDsphp artisan key:generate
php artisan migrate --seedThe seeder creates an admin user (for password login) – but you will use Telegram OAuth.
Admin access is granted based on TELEGRAM_ADMIN_IDS.
npm run buildphp artisan serve --host=0.0.0.0 --port=8000In separate terminals, start the WebSocket server and Redis subscriber:
php artisan reverb:start
php artisan redis:subscribeNow visit http://localhost:8000 and log in with Telegram.
The repository includes a docker-compose.yml that starts:
- PostgreSQL
- Redis
- Laravel (PHP-FPM + Nginx)
- Reverb (WebSocket)
- Redis subscriber
docker-compose up -dAccess the dashboard at http://localhost:8000.
This dashboard is designed to work with the Telegram AIogram Bot.
Requirements:
- Both bot and dashboard share the same PostgreSQL database.
- The bot must write to these tables:
command_logs– for heatmap and chartstrades– for trade historytemp_invites– for invite listmoderation_logs– for audit (optional)moderation_rules– dashboard writes, bot reads
- The bot must publish events to Redis channel
bot_events(the dashboard subscribes).
No API calls needed – only shared database and Redis.
php artisan testFor frontend, open browser developer tools – no unit tests for Vue provided.
app/
├── Http/Controllers/ # Analytics, Moderation, Trades, Invites, Users
├── Models/ # CommandLog, Trade, TempInvite, ModerationRule, User
├── Events/ # BotEvent (broadcastable)
├── Console/Commands/ # SubscribeRedis
database/
├── migrations/ # All required tables
├── seeders/ # AdminUserSeeder
resources/
├── js/
│ ├── Pages/ # Dashboard, Analytics, Moderation, Trades, Invites, Users
│ ├── Components/ # Heatmap, CommandChart, RealTimeLog, ModerationRuleForm
│ ├── Layouts/ # AppLayout
│ ├── store/ # Pinia store for real‑time events
│ └── app.js
routes/
├── web.php # Inertia pages + API endpoints
└── channels.php # Reverb channel authorization
- Ensure
socialiteproviders/telegramis installed andEventServiceProviderhas the listener. - Clear config:
php artisan config:clear.
- Verify Redis is running:
redis-cli ping - Check that
php artisan redis:subscribeis running. - Send a test message:
redis-cli publish bot_events '{"event":"test"}'– should appear in subscriber.
- Set
APP_URLto your HTTPS domain. - Add
URL::forceScheme('https')inAppServiceProvider::boot()for production.
- Exclude
/auth/telegram/callbackfrom CSRF inbootstrap/app.php.
MIT – free to use and modify.
Coded & Developed by LelexTB
Built with Laravel, Vue 3, Inertia, and Reverb.
Uses socialiteproviders/telegram for OAuth.