A modern Discord onboarding bot with a web management interface, built with FastAPI, SQLModel, and HTMX.
- Graceful Shutdown Handling - Proper signal handling for both local development and Docker deployments
- Onboarding Management from Web UI - Approve or demote user onboarding status directly from the dashboard
- Python 3.13+ Support - Full compatibility with latest Python versions
- Enhanced Notifications - Customizable Discord event notifications with toggle controls
- Improved Documentation - Reorganized docs with dedicated sections for development, deployment, and API reference
- 28+ API Endpoints - Comprehensive REST API for all bot operations
-
Discord Bot Functionality
- Automated member onboarding with customizable workflow
- Nickname management based on real names
- Role assignment upon onboarding completion
- Persistent button/modal interactions
- Comprehensive audit logging
- Graceful shutdown handling for both local and Docker environments
-
Web Management Interface
- Discord OAuth authentication
- User management dashboard with approve/demote onboarding status
- Bot configuration panel
- Real-time audit logs
- Multi-guild support (built-in from day one)
- Export member data (CSV/JSON)
- Welcome message customization with notification controls
- Command management interface
-
Technical Features
- Full Python 3.13+ support with discord.py 2.4.0+
- Dual database support (SQLite/PostgreSQL)
- HTMX for dynamic UI without JavaScript complexity
- Docker containerization with proper signal handling (tini)
- CI/CD with GitHub Actions
- Fully typed with SQLModel
- Comprehensive structured logging with graceful shutdown
- Built-in notification system for Discord events
For detailed documentation, visit the docs folder:
- Quick Start Guide - Get running in 5 minutes
- Installation Guide - Detailed setup instructions
- Discord Setup - Bot and OAuth configuration
- Development Guide - Python 3.13+ setup and dependencies
- Project Structure - Understanding the codebase
- Shutdown Handling - Graceful shutdown procedures
- API Reference - Complete API documentation
- Docker Deployment - Container deployment guide
- Python 3.9 or higher (fully supports Python 3.13+)
- discord.py 2.4.0+ (required for Python 3.13 compatibility)
- Discord Bot Token (Create one here)
- Discord OAuth Application (for web interface login)
-
Clone the repository
git clone https://github.com/jkkicks/Vela.git cd Vela -
Set up a Python virtual environment
Windows (PowerShell):
# Create virtual environment python -m venv .venv # Activate virtual environment .\.venv\Scripts\Activate.ps1 # If you get an execution policy error, run: # Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Windows (Command Prompt):
# Create virtual environment python -m venv .venv # Activate virtual environment .venv\Scripts\activate.bat
macOS/Linux:
# Create virtual environment python3 -m venv .venv # Activate virtual environment source .venv/bin/activate
To deactivate the virtual environment (all platforms):
deactivate
-
Install dependencies (with virtual environment activated)
# IMPORTANT: Upgrade pip first (especially for Python 3.13+) python -m pip install --upgrade pip setuptools wheel pip cache purge # Install all dependencies pip install -r requirements.txt
-
Download static assets
python download_assets.py
-
Configure environment
cp .env.example .env # Edit .env with your configuration -
Run the application
# Direct start: python -m src.main # Using startup script (handles venv, checks dependencies): python start.py # Restart (kills existing process on port 8000 first): python restart.py
-
Complete initial setup
- Visit http://localhost:8000/setup
- Enter your Discord bot token and admin credentials
- Configure your first guild
Create a .env file based on .env.example:
# Database (SQLite or PostgreSQL)
DATABASE_URL=sqlite:///./vela.db
# DATABASE_URL=postgresql://user:password@localhost:5432/vela
# Discord Bot (optional - can be set via web UI)
BOT_TOKEN=your_bot_token_here
GUILD_ID=123456789012345678
# Discord OAuth (required for web login)
DISCORD_CLIENT_ID=your_app_client_id
DISCORD_CLIENT_SECRET=your_app_client_secret
DISCORD_REDIRECT_URI=http://localhost:8000/auth/callback
# Security
API_SECRET_KEY=change-this-secret-key
ENCRYPTION_KEY=generate-with-fernet
# API Settings
API_PORT=8000
API_HOST=0.0.0.0- Go to Discord Developer Portal
- Create or select your application
- Go to OAuth2 settings
- Add redirect URL:
http://localhost:8000/auth/callback(or your domain) - Copy Client ID and Client Secret to
.env
-
Using Docker Compose (Recommended)
docker-compose up -d
-
Using Docker directly
docker build -t vela . docker run -d -p 8000:8000 --env-file .env vela
Note: The Docker image includes tini as an init system for proper signal handling and graceful shutdowns. The container will properly handle SIGTERM signals for clean termination.
-
Install PostgreSQL (optional, for production)
sudo apt install postgresql
-
Set up systemd service (Linux) Create
/etc/systemd/system/vela.service:[Unit] Description=Vela Discord Bot After=network.target [Service] Type=simple User=vela WorkingDirectory=/opt/vela ExecStart=/usr/bin/python3 -m src.main Restart=on-failure [Install] WantedBy=multi-user.target
-
Start the service
sudo systemctl enable vela sudo systemctl start vela
Slash Commands:
/onboard- Complete onboarding process/setnick- Change your nickname/help- Display help information/ping- Check bot latency/about- Information about Vela/server_info- Server statistics
Admin Commands:
/remove @user- Remove user from database/stats- View server statistics/list_members- List all members/sync- Sync slash commands
Legacy Commands:
!nick- View current nickname!setnick [firstname] [lastname]- Change nickname!reinit- Re-initialize user in database!99- Get a Brooklyn Nine-Nine quote!shutdown- Shutdown the bot (owner only)
Access the web interface at http://localhost:8000
Available Pages:
/- Home page/dashboard- Statistics overview/admin/users- User management (with approve/demote onboarding controls)/admin/config- Bot configuration/admin/logs- Audit logs/admin/guilds- Multi-guild management (super admin only)/apps/onboarding- Onboarding workflow configuration/apps/welcome- Welcome message customization/apps/notify- Notification settings for Discord events/apps/commands- Command configuration
Interactive API documentation available at:
- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
Key API Endpoints (28+ total):
- User Management:
GET/POST /users,GET/DELETE /users/{user_id} - Onboarding Control:
POST /users/{user_id}/approve,POST /users/{user_id}/demote - Guild Management:
GET /guilds,POST /settings/{guild_id} - Notifications:
POST /notifications/toggle,POST /notifications/channel - Data Export:
GET /export(CSV/JSON formats) - Commands:
GET/POST /commands/{guild_id}
-
Create and activate virtual environment:
Windows PowerShell:
python -m venv .venv .\.venv\Scripts\Activate.ps1macOS/Linux:
python3 -m venv .venv source .venv/bin/activate -
Install development dependencies:
pip install -r requirements.txt pip install --upgrade pip
-
Verify installation:
python test_install.py
-
IDE Configuration:
-
VS Code: Select the interpreter from
.venv- Press
Ctrl+Shift+P(Windows) orCmd+Shift+P(Mac) - Type "Python: Select Interpreter"
- Choose
./.venv/Scripts/python.exe(Windows) or./.venv/bin/python(Mac/Linux)
- Press
-
PyCharm: Configure project interpreter
- Go to Settings → Project → Python Interpreter
- Add interpreter → Existing environment
- Select
.venv/Scripts/python.exe(Windows) or.venv/bin/python(Mac/Linux)
-
Vela/
├── src/
│ ├── bot/ # Discord bot implementation
│ │ ├── cogs/ # Command groups
│ │ └── views/ # UI components
│ ├── api/ # FastAPI web application
│ │ ├── routers/ # API endpoints
│ │ └── models/ # Pydantic schemas
│ └── shared/ # Shared database and config
├── templates/ # HTMX templates
│ ├── pages/ # Full pages
│ ├── fragments/ # HTMX fragments
│ └── components/ # Reusable components
├── static/ # Static assets
├── migrations/ # Database migrations
└── tests/ # Test suite
pytest tests/black src/
ruff check src/Note: start.py and restart.py are excluded from Black formatting to preserve critical signal handling code. These files contain specific formatting required for proper shutdown procedures.
# Create a new migration
alembic revision --autogenerate -m "Description"
# Apply migrations
alembic upgrade head
# Rollback
alembic downgrade -1- Backend: Python 3.9+ (including 3.13+)
- Bot Framework: discord.py 2.4.0+
- Web Framework: FastAPI
- Database ORM: SQLModel (Pydantic + SQLAlchemy)
- Frontend: HTMX + Alpine.js + Tailwind CSS
- Database: SQLite (dev) / PostgreSQL (production)
- Authentication: Discord OAuth2
- Containerization: Docker
- KISS: Keep It Simple - Python-only stack, no build steps
- DRY: SQLModel for both API validation and database
- Multi-guild Ready: Architecture supports multiple Discord servers
- Security First: Encrypted tokens, OAuth authentication, audit logging
- Progressive Enhancement: HTMX for interactivity without JavaScript complexity
- Graceful Operations: Proper signal handling and shutdown procedures for both local and containerized environments
- Modern Python: Full support for Python 3.13+ with async/await patterns
If you're upgrading from the original Vela:
-
Backup your data
cp member_data.db member_data.db.backup
-
Run the new version
- The new version uses a different database structure
- Existing data will NOT be automatically migrated
- Use the web interface to re-configure your bot
Thank you for considering contributing to Vela! We welcome contributions from everyone.
- Check GitHub Issues for existing discussions
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes following our code style
- Write tests if applicable
- Update documentation as needed
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
By contributing, you agree to license your contributions under the same license as the project.
This project is licensed under the MIT License - see the LICENSE file for details.
Windows PowerShell Execution Policy Error:
# If you see "cannot be loaded because running scripts is disabled"
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# Then try activating again
.\.venv\Scripts\Activate.ps1Command Not Found (Mac/Linux):
# Make sure python3 is installed
python3 --version
# If not installed:
# Mac: brew install python3
# Ubuntu/Debian: sudo apt install python3 python3-venv python3-pipWrong Python Version:
# Check your Python version
python --version # Windows
python3 --version # Mac/Linux
# Vela requires Python 3.9+Virtual Environment Not Activating:
- Look for
(.venv)at the beginning of your command prompt - Windows: Try using Command Prompt instead of PowerShell
- Make sure you're in the Vela directory when activating
Python 3.13 - ModuleNotFoundError: No module named 'audioop':
# discord.py 2.3.2 doesn't support Python 3.13
# Upgrade to discord.py 2.4.0+
pip install --upgrade discord.pyDependency Conflicts:
# Clean install in virtual environment
pip install --upgrade pip
pip install -r requirements.txt --force-reinstallMissing Static Assets:
python download_assets.pyDatabase Connection Issues:
- SQLite: Ensure write permissions in current directory
- PostgreSQL: Check connection string in
.env
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Wiki: Documentation Wiki
- Discord.py community for the excellent bot framework
- FastAPI for the modern web framework
- HTMX for making web development fun again
- Original Vela contributors
Made with ❤️ by the Vela team