A FastAPI-based web application that automates Pterodactyl server deployment and management, integrated with Discord OAuth2 authentication and database logging.
Before setting up the project, ensure your environment meets the following requirements:
- Python:
python 3.11(or higher) - Panel: Pterodactyl Panel (Admin access required)
- Database: MongoDB instance
- Discord: Webhook
- Copy the
.env.examplefile to create your own configuration:
cp .env.example .env- Open
.envand fill in your variables:
# Application Configuration
app:
# Host address to bind the web server
host: "0.0.0.0"
# Port used by the web server
port: 8000
# Enable debug mode
debug: false
# Debug secret key (If debug is true)
key: "sfjsdghfdkjdlk"
# Enable docs route
docs: false
# Advance settings
advance:
# Put discord id str as list
admins: []
# Theme for dashboard (Default "dark")
theme: "dark"
# Default settings (First login)
cpu: 50
ram: 512
disk: 1024
coin: 50
# Discord OAuth2 Configuration
discord:
# OAuth2 callback URL
# This URL must match the redirect URL configured in Discord Developer Portal
callback: "http://localhost:8000/api/auth/callback"
# Discord Application Client ID
client_id: "YOUR_DISCORD_CLIENT_ID"
# Discord server invite link
invite: "https://discord.gg/YOUR_INVITE_CODE"
# Database Configuration
database:
# Database name
db: "your_database_name"
# Collection name
collection: "your_collection_name"
# Pterodactyl Configuration
pterodactyl:
# Pterodactyl panel URL
url: "https://panel.example.com"
# Default Nest ID used when creating servers
nest_id: 1
# Available location IDs for server deployment
location_ids: [1]
# Allowed port allocation range
# Leave empty to disable custom port restriction
port_range: []
# Pricing Configuration
price:
# Price per CPU
cpu: 5
# Price per MB of RAM
ram: 10
# Price per MB of disk storage
disk: 5| Variable | Description |
|---|---|
client_id / client_secret |
Obtained from the Discord Developer Portal. Used for user authentication. |
callback |
The URL Discord redirects to after successful login. Must match the redirect URI set in the Discord portal. |
mongo_* / database |
Credentials to connect to your local or remote MongoDB instance for caching and user quota tracking. |
panel_key / panel |
Your Pterodactyl panel domain and an Application API Key with full administrator privileges. |
nest_id |
The ID of the default Pterodactyl Nest used for deploying new servers (e.g., Node.js, Python Nests). |
location_ids |
A list of node location IDs where new servers are allowed to be created. |
webhook |
A Discord webhook URL used to log panel activities (e.g., server creation/deletion events). |
- Clone this repository and navigate to the project directory:
git clone https://github.com/littlecommandcat/PyPterodash.git- Create a virtual environment using Python 3.11:
python3.11 -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate- Install the dependencies:
pip install -r requirements.txtYou can start the development server using either of the following methods:
- Method 1: Using Uvicorn
uvicorn app.main:app --reload --port 8000- Method 2: Using the Python Script
python main.pyIf this project helped you or you find it useful, please consider giving it a Star! It means a lot to us and helps keep the project alive. 🌟