This guide will help you deploy the Miku Dashboard to Vercel (free) while your bot runs on WispByte.
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Discord │ ◄─────► │ Bot + API │ ◄─────► │ Dashboard │
│ Server │ │ (WispByte) │ │ (Vercel) │
└─────────────┘ └──────────────┘ └─────────────┘
│
▼
┌──────────┐
│ Database │
│ (SQLite) │
└──────────┘
- Bot: Runs on WispByte, handles Discord events
- API Server: FastAPI server (within bot), exposes database via REST API
- Dashboard: Next.js app on Vercel, calls bot API for data
- Discord Application with OAuth2 configured
- WispByte account (or any hosting for the bot)
- Vercel account (free)
- Git repository (GitHub, GitLab, or Bitbucket)
Update your .env file on WispByte with:
DISCORD_BOT_TOKEN=your_bot_token_here
API_PORT=8000
ALLOWED_ORIGINS=https://your-dashboard.vercel.appYou need to run both the Discord bot AND the API server. Create a startup script or use a process manager.
Option A: Using a simple bash script (start.sh):
#!/bin/bash
# Start API server in background
python src/api_server.py &
API_PID=$!
# Start Discord bot
python main.py
# Cleanup on exit
kill $API_PIDOption B: Using Python multiprocessing (recommended):
Create start_all.py:
import multiprocessing
import sys
import os
def run_bot():
from src.bot import main
import asyncio
asyncio.run(main())
def run_api():
import uvicorn
from src.api_server import app
port = int(os.getenv("API_PORT", "8000"))
uvicorn.run(app, host="0.0.0.0", port=port)
if __name__ == "__main__":
# Start API server process
api_process = multiprocessing.Process(target=run_api)
api_process.start()
# Start bot in main process
run_bot()
# Cleanup
api_process.terminate()
api_process.join()Then update your WispByte startup command to:
python start_all.pyOnce deployed, note down your bot's API URL. This will be something like:
https://your-bot-domain.wispbyte.com- Or the public URL WispByte provides
Test it by visiting: https://your-bot-url.com/ - should return {"status": "ok", "message": "Miku Bot API is running"}
- Visit https://discord.com/developers/applications
- Select your application
- Go to OAuth2 → General
Add these redirect URLs:
http://localhost:3000/api/auth/callback/discord
https://your-dashboard.vercel.app/api/auth/callback/discord
(Replace your-dashboard with your actual Vercel project name)
Copy these values:
- Client ID
- Client Secret
- Bot Token (from Bot section)
cd dash
git init
git add .
git commit -m "Prepare dashboard for deployment"
git remote add origin https://github.com/yourusername/miku-dashboard.git
git push -u origin main- Go to https://vercel.com
- Click "Add New Project"
- Import your Git repository
⚠️ IMPORTANT: Configure Root Directory- In the project configuration screen
- Find "Root Directory" setting
- Click "Edit"
- Set it to:
dash - Click "Continue"
- Vercel will auto-detect Next.js
In Vercel project settings → Environment Variables, add:
| Variable | Value | Where to Get It |
|---|---|---|
NEXTAUTH_URL |
https://your-dashboard.vercel.app |
Vercel will show this after first deploy |
NEXTAUTH_SECRET |
Generate with: openssl rand -base64 32 |
Run in terminal |
DISCORD_CLIENT_ID |
Your Discord Client ID | Discord Developer Portal |
DISCORD_CLIENT_SECRET |
Your Discord Client Secret | Discord Developer Portal |
DISCORD_BOT_TOKEN |
Your Discord Bot Token | Discord Developer Portal |
BOT_API_URL |
https://your-bot-url.com |
From Part 1, Step 3 |
Click "Deploy". Vercel will build and deploy your dashboard.
After first deployment:
- Note your Vercel URL (e.g.,
miku-dashboard.vercel.app) - Go back to Discord Developer Portal
- Update the redirect URL to match exactly:
https://miku-dashboard.vercel.app/api/auth/callback/discord - Update
NEXTAUTH_URLin Vercel environment variables - Redeploy in Vercel
Update your bot's .env:
ALLOWED_ORIGINS=https://your-dashboard.vercel.appThis ensures only your dashboard can access the API.
curl https://your-bot-url.com/
# Should return: {"status": "ok", "message": "Miku Bot API is running"}- Visit your Vercel URL
- Click "Login with Discord"
- Authorize the application
- You should see your servers
- Click on a server to view stats
- Check
BOT_API_URLin Vercel environment variables - Ensure API server is running on WispByte
- Check CORS settings (ALLOWED_ORIGINS)
- Test API endpoint directly:
https://your-bot-url.com/api/server/{guild_id}/stats
- Check DISCORD_BOT_TOKEN is set correctly in Vercel
- Verify token has proper permissions
- Verify NEXTAUTH_URL matches your Vercel domain exactly
- Check Discord redirect URLs are correct
- Ensure NEXTAUTH_SECRET is set
- Update ALLOWED_ORIGINS on bot to include your Vercel domain
- Redeploy bot
| Service | Cost | Limits |
|---|---|---|
| Vercel | FREE | 100GB bandwidth/month |
| WispByte | FREE | Check their free tier limits |
| Discord API | FREE | Unlimited |
- Go to Vercel Project → Settings → Domains
- Add your custom domain
- Update DNS records as instructed
- Update NEXTAUTH_URL and Discord redirect URLs
- Check WispByte documentation for custom domain setup
- Update BOT_API_URL in Vercel after setup
- Vercel Dashboard → Project → Deployments → View Logs
- Check WispByte console/logs
Monitor: https://your-bot-url.com/ should always return {"status": "ok"}
git add .
git commit -m "Update dashboard"
git pushVercel auto-deploys on push!
Push changes to WispByte via their deployment method.
- ✅ Never commit
.envfiles - ✅ Use environment variables for all secrets
- ✅ Restrict CORS to your dashboard domain only
- ✅ Rotate NEXTAUTH_SECRET periodically
- ✅ Keep dependencies updated
If you encounter issues:
- Check Vercel deployment logs
- Check WispByte bot logs
- Verify all environment variables are set correctly
- Test API endpoints directly
- Check Discord Developer Portal for OAuth errors
✨ Free hosting for both bot and dashboard
✨ Scalable - Vercel scales automatically
✨ Fast - CDN distribution for dashboard
✨ Secure - No direct database exposure
✨ Maintainable - Clear separation of concerns
Congratulations! Your Miku Dashboard is now deployed! 🎉