Setup guide
This comprehensive guide covers everything you need to deploy and configure Project Stardust.Prerequisites
- Python 3.8 or higher
- PostgreSQL database (Supabase recommended)
- Discord bot application
- Git (for cloning the repository)
Installation
Clone the repository
Install dependencies
Project Stardust requires the following packages:requirements.txt
Consider using a virtual environment to isolate dependencies:
Configuration
Environment variables
Create a.env file in the project root with the following configuration:
.env
Discord bot setup
Create a Discord application
- Navigate to the Discord Developer Portal
- Click “New Application” and give it a name
- Navigate to the “Bot” section in the sidebar
- Click “Add Bot” to create a bot user
Configure bot permissions
The bot requires these intents:
- Server Members Intent - To track user data
- Message Content Intent - To read commands
Copy the bot token
In the “Bot” section, click “Reset Token” and copy the new token. Add this to your
.env file as DISCORD_TOKEN.Database setup
Project Stardust uses PostgreSQL with automatic schema initialization.Using Supabase (recommended)
Supabase provides free PostgreSQL hosting perfect for Discord bots:Create a Supabase project
- Sign up at supabase.com
- Create a new project
- Wait for the database to provision
Get connection string
- Go to Project Settings → Database
- Copy the “Connection string” under “Connection pooling”
- Replace
[YOUR-PASSWORD]with your database password - Add this to your
.envasDATABASE_URL
Self-hosted PostgreSQL
If you’re running your own PostgreSQL instance:Database initialization
The bot automatically creates all required tables on first run:main.py
users- User profiles, currencies, and progressioninventory- Character ownership and dupe levelsteams- Active team compositionsteam_presets- Saved team loadoutsexpeditions- Passive gem generationcharacters_cache- AniList data cachedaily_tasks- Task progress trackingachievements- Achievement unlocksbounty_board- Shared bounty challengesbanners- Rate-up banner configuration- And more…
Running the bot
Local development
Start the bot directly with Python:Production hosting
Render.com (recommended)
Render provides free hosting for Discord bots:Connect your repository
- Push your code to GitHub
- Sign up at render.com
- Click “New +” → “Web Service”
- Connect your GitHub repository
Configure the service
- Environment: Python 3
- Build Command:
pip install -r requirements.txt - Start Command:
python main.py - Instance Type: Free
The bot includes a health check server on port 8080 to keep Render services active:
main.py
Railway.app
Railway is another excellent option:- Connect your GitHub repository
- Railway auto-detects Python projects
- Add environment variables in the dashboard
- Deploy with one click
Heroku
For Heroku deployment, create aProcfile:
Procfile
Advanced configuration
Cog management
The bot automatically loads all cogs from thecogs/ directory:
main.py
achievements.py- Achievement trackingadmin.py- Admin commandsbattle.py- PvE and PvP battlesbounty.py- Bounty board systemdaily.py- Daily tasks and rewardsexpedition.py- Passive gem generationgacha.py- Character pulling systeminventory.py- Collection managementraid.py- Raid boss battlesshop.py- Item purchasingteambuilder.py- Team composition
Character rankings
The gacha system uses a ranking file to determine character rarity:data/rankings.json with character popularity data.
Database optimization
For high-traffic servers, adjust connection pool settings:core/database.py
Verification
Test your bot setup:Troubleshooting
Common issues
Bot doesn’t start:- Check
DISCORD_TOKENis set correctly - Verify Python version is 3.8+
- Ensure all dependencies are installed
- Verify
DATABASE_URLformat - Check database host is accessible
- Confirm IP whitelist (if using Supabase)
- Enable “Message Content Intent” in Discord Developer Portal
- Verify bot has “Send Messages” permission
- Check command prefix matches your configuration
- Check Python syntax in cog files
- Verify imports are correct
- Look for missing dependencies
Logs and debugging
Enable detailed logging:Next steps
Commands reference
Learn about all available bot commands and features.
Database schema
Understand the database structure and relationships.
Contributing
Learn how to contribute to Project Stardust.
API reference
Explore the bot’s internal API and modules.