Full Setup Guide
Follow this professional roadmap to deploy the entire AudioFlux ecosystem across your own infrastructure. This guide covers everything from credential acquisition to production deployment and monitoring.
Prerequisites
Required tools and accounts before you begin.
Development Tools
- Node.js 18+ - Runtime environment for backend and frontend
- Git - Version control for cloning repositories
- npm/yarn - Package manager (comes with Node.js)
Cloud Accounts
- Telegram Account - For creating the bot
- Upstash Account - For Redis database (free tier available)
- Hosting Platform - Railway, Heroku, or VPS
Step 1: Credential Acquisition
Collect the necessary API keys and database strings.
Telegram Bot Token
Required • From @BotFather
The bot token allows the backend to authenticate with Telegram's Bot API and intercept music search commands from users.
- 1.Open Telegram and search for @BotFather
- 2.Send the command
/newbot - 3.Follow the prompts to choose a name and username for your bot
- 4.Copy the HTTP API token (format:
123456:ABC-DEF...) - 5.Optional: Disable privacy mode with
/setprivacyto allow group message reading
Upstash Redis Database
Required • Global State Engine
Global state is persisted in Upstash Redis. This includes room queues, playback state, user history, and viewer presence.
- 1.Sign up at upstash.com
- 2.Create a new Redis database (select a region close to your backend deployment)
- 3.Copy the REST URL (starts with
https://...) - 4.CRITICAL: Go to Settings → Eviction Policy → Set to
noeviction
Eviction Policy Warning
If eviction is enabled, Redis will automatically delete keys when memory is full, causing queue loss and state desynchronization. Always use noeviction for production.
Admin User ID
Required • For Administrative Access
Your Telegram user ID is used to grant administrative permissions for queue management and system commands.
- 1.Open Telegram and search for @userinfobot
- 2.Send any message to the bot
- 3.Copy your numeric ID (e.g.,
123456789)
Step 2: Deploying the Backend
The orchestration core must be live first.
Clone the Repository
git clone https://github.com/4nuxd/AudioFlux.git
cd AudioFlux/audioflux-backendConfigure Environment Variables
Create a .env file in the backend root directory:
cp .envexample .env
nano .env # or use your preferred editor| Variable | Description | Example |
|---|---|---|
| BOT_TOKEN | Telegram bot API token | 123456:ABC-DEF... |
| REDIS_URL | Upstash Redis REST URL | https://... |
| OWNER_ID | Your Telegram user ID | 123456789 |
| NODE_ENV | Environment mode | production |
| PORT | Server port (auto-injected on most platforms) | 3001 |
Platform-Specific Deployment
Railway (Recommended)
- 1. Connect your GitHub repository to Railway
- 2. Add environment variables in the dashboard
- 3. Deploy automatically on push
Heroku
heroku create audioflux-backend
git push heroku main
heroku config:set BOT_TOKEN=...VPS (DigitalOcean, Linode)
npm install
npm install -g pm2
pm2 start server.js --name audioflux
pm2 saveDocker
docker build -t audioflux-backend .
docker run -p 3001:3001 --env-file .env audioflux-backendVerify Backend is Running
Test the health endpoint:
curl https://your-backend-url.com/healthExpected response: {"status":"healthy",...}
Step 3: Frontend & Status Monitor
Final steps to link the ecosystem.
Web Player (Frontend)
Point the web player to your backend using the public URL.
cd ../audioflux-frontend
cp .env.example .env.localStatus Monitor
Configure health check endpoints.
cd ../audioflux-status
cp .env.example .env.localCommon Issues & Solutions
Bot not responding to commands
- • Verify
BOT_TOKENis correct - • Check if backend
/healthendpoint returns 200 - • Ensure bot privacy mode is disabled for group chats
Queue state lost after restart
- • Verify Redis eviction policy is set to
noeviction - • Check Redis connection in backend logs
- • Ensure
REDIS_URLuses HTTPS (not rediss://)
Frontend can't connect to backend
- • Verify
NEXT_PUBLIC_API_URLis publicly accessible - • Check CORS settings in backend (should allow your frontend domain)
- • Test Socket.IO connection manually in browser console
Next Steps
Once deployed, test the entire flow: send a music search command to your bot in Telegram, verify the web player loads, and check the status monitor shows all systems operational.