# ECS Full Stack A full-stack Discord bot management dashboard with React frontend, Express backend, and Discord.js bot integration. Server admins can manage bot settings, invites, moderation, and live notifications through a modern web interface. ## Features - **Dashboard**: View Discord servers and manage per-server settings - **Invite Management**: Create, list, and revoke server invites with custom options - **Moderation**: Direct ban/kick/timeout actions from web interface with user autocomplete - **Live Notifications**: Twitch stream notifications with rich embeds - **Admin Logs**: Complete moderation action logging with real-time updates - **Theme Support**: Light, dark, and Discord-themed UI options ## Quick Start ### Prerequisites - Node.js 18+ - PostgreSQL database - Discord application with bot user ### Setup 1. **Clone and install dependencies:** ```bash git clone cd ECS-FullStack npm install # Run in both frontend/ and backend/ directories ``` 2. **Configure Discord App:** - Go to [Discord Developer Portal](https://discord.com/developers/applications) - Create new application and bot user - Copy Client ID, Client Secret, and Bot Token 3. **Database Setup:** ```sql CREATE DATABASE ecs_fullstack; CREATE USER ecs_user WITH PASSWORD 'your_password'; GRANT ALL PRIVILEGES ON DATABASE ecs_fullstack TO ecs_user; ``` 4. **Environment Configuration:** **backend/.env:** ```env DATABASE_URL=postgres://ecs_user:password@localhost:5432/ecs_fullstack DISCORD_CLIENT_ID=your_client_id DISCORD_CLIENT_SECRET=your_client_secret DISCORD_BOT_TOKEN=your_bot_token ENCRYPTION_KEY=your_32_byte_secret BACKEND_BASE=http://localhost:3002 FRONTEND_BASE=http://localhost:3001 ``` **frontend/.env:** ```env REACT_APP_API_BASE=http://localhost:3002 ``` 5. **Start the application:** ```bash # Backend (includes Discord bot) cd backend && npm start # Frontend (separate terminal) cd frontend && npm start ``` 6. **Invite Bot to Server:** - Use OAuth2 URL Generator in Discord Developer Portal - Select `bot` and `applications.commands` scopes - Choose appropriate permissions - Visit generated URL to invite bot ## Project Structure ``` ECS-FullStack/ ├── frontend/ # React dashboard ├── backend/ # Express API + Discord bot ├── discord-bot/ # Bot wrapper ├── checklist.md # Feature tracking └── README.md ``` ## API Endpoints ### Server Management - `GET /api/servers/:guildId` - Server info and settings - `GET /api/servers/:guildId/members` - Server member list - `GET /api/servers/:guildId/channels` - Text channels - `GET /api/servers/:guildId/roles` - Server roles ### Invites - `GET /api/servers/:guildId/invites` - List invites - `POST /api/servers/:guildId/invites` - Create invite - `DELETE /api/servers/:guildId/invites/:code` - Delete invite ### Moderation - `POST /api/servers/:guildId/moderate` - Ban/kick/timeout users - `GET /api/servers/:guildId/admin-logs` - View moderation logs ### Live Notifications - `GET/POST /api/servers/:guildId/live-notifications` - Settings - `GET/POST /api/servers/:guildId/twitch-users` - Watched users ## Environment Variables ### Required - `DATABASE_URL` - PostgreSQL connection string - `DISCORD_CLIENT_ID` - Discord app client ID - `DISCORD_CLIENT_SECRET` - Discord app client secret - `DISCORD_BOT_TOKEN` - Bot token ### Optional - `TWITCH_CLIENT_ID` - Twitch app client ID - `TWITCH_CLIENT_SECRET` - Twitch app client secret - `BOT_PUSH_URL` - For separate bot/backend deployment - `CORS_ORIGIN` - Restrict API access ## Development ### Running Tests ```bash cd frontend && npm test cd backend && npm test ``` ### Building for Production ```bash cd frontend && npm run build cd backend && npm run build # If applicable ``` ## Troubleshooting ### Common Issues - **Database connection failed**: Verify `DATABASE_URL` format and credentials - **CORS errors**: Check `CORS_ORIGIN` matches your frontend URL - **Bot not responding**: Ensure bot has proper permissions in server - **Invite deletion fails**: Check `ENCRYPTION_KEY` is set ### Logs - Backend logs Discord bot status and API requests - Frontend console shows API calls and errors - Check browser Network tab for failed requests ## Contributing 1. Fork the repository 2. Create feature branch 3. Make changes with tests 4. Submit pull request ## License MIT License - see LICENSE file for details. --- **Updated**: October 9, 2025