Transform your Discord server from basic to extraordinary in just 5 minutes!
Automated server configuration • 35+ bot integrations • Custom TypeScript bot • Production-ready
| 🛡️ Complete Automation | 🚀 Modern Architecture | 📚 Comprehensive Docs |
|---|---|---|
| Instant 32+ channels setup | TypeScript + Discord.js v14 | Step-by-step guides |
| 10+ roles with hierarchy | MongoDB integration | 35+ bot tutorials |
| Security-first permissions | Production-ready code | Legal templates included |
- Instant Setup: Automated scripts create 32+ channels and 10+ roles
- Professional Structure: Organized categories with proper permissions
- Security Ready: Built-in moderation channels and role hierarchy
- Bot Integration: Setup guides for 35+ popular Discord bots
- Modern Architecture: TypeScript with Discord.js v14
- Database Integration: MongoDB with comprehensive user/guild models
- Modular Design: Easy to extend with new commands and features
- Production Ready: Logging, error handling, and validation included
- Step-by-Step Guides: From Discord Developer Portal to deployment
- Bot Integration Tutorials: Setup instructions for popular bots
- Legal Templates: Terms of service, rules, and guidelines
- Troubleshooting: Common issues and solutions
git clone https://github.com/yourusername/discord-hk-server.git
cd discord-hk-server
npm install# Copy environment template
cp .env.example .env
# Edit .env with your values (see Environment Configuration section)
nano .env💡 Tip: Use VSCode for easier editing:
code .env
Choose your preferred database option:
- Visit MongoDB Atlas
- Create free cluster
- Get connection string
- Add to
.envfile
# macOS
brew install mongodb/brew/mongodb-community
brew services start mongodb/brew/mongodb-community
# Ubuntu
sudo apt install mongodb
sudo systemctl start mongod- Create Application: Discord Developer Portal
- Create Bot: Application → Bot → Reset Token
- Copy Token: Add to
.envfile asDISCORD_TOKEN - Enable Intents: Turn on required bot intents
- Invite Bot: Use OAuth2 URL generator with proper permissions
# Test everything works
npm run test-connection
# Run automated server setup (creates 32+ channels & 10+ roles)
npm run setup-server-enhanced
# Start your custom bot
npm run devYour Discord server is now fully configured with:
- ✅ 32+ organized channels in 6 categories
- ✅ 10+ role hierarchy with proper permissions
- ✅ Custom TypeScript bot with moderation & features
- ✅ Production-ready setup with database integration
- Node.js v18.0.0 or higher (Download)
- npm v8.0.0 or higher (comes with Node.js)
- MongoDB (Local or Atlas)
- Git (Download)
- Discord account with server admin permissions
- Discord Developer Portal access
- MongoDB Atlas (cloud database - free tier available)
- Railway/Heroku (for hosting the bot online)
- External API Keys (YouTube, Spotify, OpenAI for enhanced features)
- Visit Discord Developer Portal
- Click "New Application"
- Name your bot (e.g., "My Server Bot")
- Save and note the Application ID
- Go to "Bot" section
- Click "Add Bot"
- Click "Reset Token" and copy the token
⚠️ Keep this token secret! Never share it publicly.
Required Settings:
✅ Public Bot: OFF (recommended for private servers)
✅ Requires OAuth2 Code Grant: OFF
✅ Presence Intent: ON
✅ Server Members Intent: ON
✅ Message Content Intent: ONSelect these permissions for your bot:
General Permissions:
✅ Manage Roles
✅ Manage Channels
✅ Kick Members
✅ Ban Members
✅ Manage Nicknames
✅ Manage Emojis and Stickers
✅ View Audit Log
✅ View Server Insights
Text Permissions:
✅ Send Messages
✅ Manage Messages
✅ Embed Links
✅ Attach Files
✅ Read Message History
✅ Use External Emojis
✅ Add Reactions
Voice Permissions:
✅ Connect
✅ Speak
✅ Mute Members
✅ Deafen Members
✅ Move Members- Go to "OAuth2" → "URL Generator"
- Select "bot" scope
- Select permissions from above
- Copy and visit the generated URL
- Select your server and authorize
Edit your .env file with these required values:
# Discord Configuration (Required)
DISCORD_TOKEN=your_bot_token_from_developer_portal
DISCORD_CLIENT_ID=your_application_id_from_developer_portal
DISCORD_GUILD_ID=your_server_id
# Database Configuration (Required)
MONGODB_URI=mongodb://localhost:27017/discord-hk
# OR for MongoDB Atlas:
# MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/discord-hk- Enable Developer Mode in Discord (User Settings → Advanced → Developer Mode)
- Right-click your server name
- Click "Copy Server ID"
- Paste into
DISCORD_GUILD_ID
# Web Dashboard (Optional)
PORT=3000
JWT_SECRET=your_random_jwt_secret_here
SESSION_SECRET=your_random_session_secret_here
# External APIs (Optional - for enhanced features)
YOUTUBE_API_KEY=your_youtube_api_key_here
SPOTIFY_CLIENT_ID=your_spotify_client_id_here
SPOTIFY_CLIENT_SECRET=your_spotify_client_secret_here
OPENAI_API_KEY=your_openai_api_key_here
# Bot Customization (Optional)
BOT_PREFIX=!
BOT_ACTIVITY=Watching over the server
BOT_STATUS=online
MAX_WARNS=3# macOS with Homebrew
brew install mongodb/brew/mongodb-community
brew services start mongodb/brew/mongodb-community
# Ubuntu/Debian
sudo apt update
sudo apt install mongodb
sudo systemctl start mongod
sudo systemctl enable mongod
# Windows
# Download MongoDB Community Server from mongodb.com
# Follow installation wizard- Create free account at MongoDB Atlas
- Create new cluster (free tier available)
- Create database user
- Whitelist your IP address (or use 0.0.0.0/0 for development)
- Get connection string and update
MONGODB_URIin.env
npm install# Test bot connection
npm run test-connection
# Validate environment variables
npm run validate-setup# Choose one of these setup scripts:
# Enhanced setup (Recommended)
npm run setup-server-enhanced
# Basic setup
npm run setup-server
# TypeScript version
npm run setup-server-ts
# Tested version with extra error handling
npm run setup-server-tested# Development mode (auto-restart on changes)
npm run dev
# Production mode
npm run build
npm start
# Check if everything works
npm run typecheck
npm run lint
|
|
🔧 Configuration Files
.env.example • package.json • tsconfig.json • CLAUDE.md
# Start development server
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Code quality checks
npm run lint
npm run typecheck |
# Recommended setup
npm run setup-server-enhanced
# Alternative setups
npm run setup-server
npm run setup-server-tested
npm run setup-server-ts
# Fix issues
npm run fix-failed-roles |
# Test bot connection
npm run test-connection
# Validate configuration
npm run validate-setup
# Health check
npm run health-check |
Professional Discord server structure with proper hierarchy and permissions
|
Total: 32+ channels organized perfectly |
|
|
/ping- Check bot latency and API response time/help- Display available commands and features
- User warning system with database tracking
- Mute/timeout functionality with duration support
- Kick and ban commands with reason logging
- Comprehensive moderation history
- Custom XP system (separate from MEE6)
- Virtual currency with bank system
- Daily and weekly rewards
- Activity tracking (messages, voice time)
- Welcome/goodbye message system
- Auto-role assignment for new members
- Member analytics and statistics
- Birthday tracking and celebrations
- User Model: XP, economy, moderation history, preferences
- Guild Model: Server configuration, settings, custom commands
# Clone and setup (see Quick Start above)
npm run dev- Fork this repository
- Connect to Railway
- Add environment variables in Railway dashboard
- Deploy automatically from GitHub
# Install Heroku CLI
npm install -g heroku
# Login and create app
heroku login
heroku create your-bot-name
# Add MongoDB addon
heroku addons:create mongolab:sandbox
# Set environment variables
heroku config:set DISCORD_TOKEN=your_token_here
heroku config:set DISCORD_CLIENT_ID=your_client_id_here
heroku config:set DISCORD_GUILD_ID=your_guild_id_here
# Deploy
git push heroku main# Install Node.js and MongoDB on your server
# Clone repository
git clone https://github.com/yourusername/discord-hk-server.git
cd discord-hk-server
# Install dependencies
npm install
# Build TypeScript
npm run build
# Install PM2 for process management
npm install -g pm2
# Start with PM2
pm2 start dist/index.js --name "discord-bot"
pm2 startup
pm2 save- Create new file in
src/commands/ - Follow the command template:
import { ChatInputCommandInteraction, SlashCommandBuilder } from 'discord.js';
module.exports = {
data: new SlashCommandBuilder()
.setName('yourcommand')
.setDescription('Your command description'),
async execute(interaction: ChatInputCommandInteraction) {
await interaction.reply('Hello World!');
},
cooldown: 5 // seconds
};- Create new file in
src/events/ - Follow the event template:
import { Events } from 'discord.js';
module.exports = {
name: Events.MessageCreate,
async execute(message) {
// Your event logic here
}
};Edit the setup scripts in scripts/ directory to customize:
- Role names, colors, and permissions
- Channel names and structure
- Category organization
- Permission overrides
Modify the models in src/models/ to add:
- New user fields
- Guild-specific settings
- Custom data tracking
- Additional analytics
This template includes setup guides for 35+ popular Discord bots:
- MEE6 - Leveling and basic moderation
- Carl-bot - Advanced automod and reaction roles
- Dyno - Backup moderation and server management
- Jockie Music - High-quality music streaming
- GiveawayBot - Giveaway management
- TicketTool - Support ticket system
- Voice Master - Dynamic voice channel creation
- YAGPDB - Advanced custom commands
See full guide: docs/bot-integrations.md
docs/setup-instructions.md- Detailed setup walkthroughdocs/server-automation.md- Automation script documentationdocs/bot-integrations.md- 35+ bot integration guides
# Check bot connection
npm run test-connection
# Verify token in .env
# Check bot permissions in Discord server
# Ensure bot is online in server member list# Check MongoDB is running
brew services start mongodb/brew/mongodb-community # macOS
sudo systemctl start mongod # Linux
# Verify MONGODB_URI in .env
# Check MongoDB Atlas whitelist settings# Ensure bot has Administrator permission
# Check bot role is higher than roles it's trying to create
# Verify bot has Manage Channels and Manage Roles permissionsnpm run typecheck # Check for type errors
npm run lint # Check for linting issues
npm install # Reinstall dependencies- Check the Issues page
- Read the documentation in
docs/folder - Join our Discord Support Server
- Create a new issue with detailed information
# Fork and clone your fork
git clone https://github.com/your-username/discord-hk-server.git
cd discord-hk-server
# Create development branch
git checkout -b feature/your-feature-name
# Install dependencies
npm install
# Make your changes and test
npm run dev
npm run typecheck
npm run lint
# Commit and push
git add .
git commit -m "Add your feature"
git push origin feature/your-feature-name
# Create pull request- Follow TypeScript best practices
- Add JSDoc comments for new functions
- Update documentation for new features
- Test your changes thoroughly
- Follow the existing code style
This project is licensed under the MIT License - see the LICENSE file for details.
- Web dashboard for server management
- Advanced analytics and insights
- Multi-server support
- Plugin system for custom features
- Advanced security features
- Integration with more external APIs
- Automated server setup scripts
- Custom TypeScript bot with database
- Comprehensive documentation
- 35+ bot integration guides
- Legal document templates
- Production-ready deployment guides
If this template helped you create an awesome Discord server, consider:
- ⭐ Star this repository
- 🔄 Share with friends
- 🐛 Report bugs or suggest features
- 💝 Contribute to the codebase
- Documentation:
docs/folder - Issues: GitHub Issues
- Discussions: GitHub Discussions
- Discord: Join our support server