A comprehensive TestFlight monitoring system built with Next.js, Discord bot integration, and PostgreSQL. Monitor TestFlight builds automatically and get notified when builds become available or expire.
- 🤖 Discord Bot Integration: Manage TestFlight URLs via Discord commands
- 🔄 Automatic Monitoring: Checks TestFlight URLs every 5-6 minutes
- 📊 Admin Dashboard: Modern web interface with TanStack Table for managing builds
- 🔐 Secure Authentication: NextAuth.js with 2FA support using TOTP
- 📧 Email Notifications: Built-in email functionality
- 🗄️ PostgreSQL Database: Robust data storage with Prisma ORM
- 🚀 Vercel Ready: Optimized for Vercel deployment
This is a Turborepo monorepo containing:
apps/web: Next.js web application with admin dashboardapps/discord-bot: Discord bot with Sapphire Framework
packages/database: Shared Prisma database schema and clientpackages/tsconfig: Shared TypeScript configurationspackages/config: Shared ESLint configurations
- Frontend: Next.js 13, React, TailwindCSS, Radix UI
- Backend: Next.js API Routes, tRPC
- Database: PostgreSQL with Prisma ORM
- Authentication: NextAuth.js with 2FA (TOTP)
- Discord Bot: Discord.js with Sapphire Framework
- Monitoring: Node-cron for scheduled checks
- Deployment: Vercel (web app), any Node.js host (bot)
- Node.js 18+
- PostgreSQL database
- Discord bot token and server setup
-
Clone the repository
git clone https://github.com/DudeThatsErin/TestFlightBot.git cd TestFlightBot -
Install dependencies
npm install --legacy-peer-deps
-
Set up environment variables
Copy the example environment file:
cp apps/web/.env.example apps/web/.env.local
Fill in your environment variables:
# Database DATABASE_URL="postgresql://username:password@localhost:5432/testflight_monitor" # NextAuth.js NEXTAUTH_SECRET="your-secret-key-here" NEXTAUTH_URL="http://localhost:3000" # Discord Bot DISCORD_TOKEN="your-discord-bot-token" DISCORD_CLIENT_ID="your-discord-client-id" DISCORD_GUILD_ID="your-discord-guild-id" DISCORD_CHANNEL_ID="your-discord-channel-id" # Email Configuration EMAIL_SERVER_HOST="smtp.gmail.com" EMAIL_SERVER_PORT=587 EMAIL_SERVER_USER="your-email@gmail.com" EMAIL_SERVER_PASSWORD="your-app-password" EMAIL_FROM="noreply@yourdomain.com" # Admin Panel ADMIN_PANEL_SECRET="unique-admin-panel-secret-path"
-
Set up the database
# Generate Prisma client npm run db:generate # Push database schema npm run db:push
-
Create an admin user
You'll need to manually create an admin user in your database or use the signup process and then update the user role to
ADMINorSUPER_ADMIN.
Run the development servers:
# Start all services
npm run dev
# Or start individual services
npm run dev --filter=web # Web app only
npm run dev --filter=discord-bot # Discord bot only# Build all apps
npm run build
# Build specific app
npm run build --filter=web
npm run build --filter=discord-bot-
Create a Discord Application
- Go to Discord Developer Portal
- Create a new application
- Go to the "Bot" section and create a bot
- Copy the bot token
-
Set up bot permissions
- In the OAuth2 > URL Generator section
- Select "bot" and "applications.commands" scopes
- Select necessary permissions (Send Messages, Use Slash Commands, etc.)
- Use the generated URL to invite the bot to your server
-
Configure environment variables
- Set
DISCORD_TOKENto your bot token - Set
DISCORD_CLIENT_IDto your application ID - Set
DISCORD_GUILD_IDto your server ID - Set
DISCORD_CHANNEL_IDto the channel where notifications should be sent
- Set
The admin panel is accessible at a unique URL defined by the ADMIN_PANEL_SECRET environment variable:
https://yourdomain.com/dashboard
Only users with ADMIN or SUPER_ADMIN roles can access the dashboard.
/testflight add- Add a new TestFlight URL to monitor/testflight list- List all monitored TestFlight builds/testflight remove- Remove a TestFlight build from monitoring/testflight status- Check the status of a specific build
- Connect your GitHub repository to Vercel
- Set environment variables in Vercel dashboard
- Deploy automatically on push to main branch
Deploy the Discord bot to any Node.js hosting service:
- Railway
- Render
- DigitalOcean App Platform
- AWS EC2
- Google Cloud Run
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE file for details