Skip to main content

Dashboard Setup


PG Dashboard Installation Guide

The PG dashboard lets you manage your bot settings, servers, and users from a web interface.


Requirements

  • Node.js v18+
  • npm or yarn
  • MongoDB (local or Atlas)
  • A configured .env file (see Environment Setup)
  • Discord Bot Application with OAuth2 credentials

Step 1: Clone the Repository

git clone https://github.com/pg-cv/pg-dashboard.git
cd pg-dashboard

Step 2: Install Dependencies

npm install
# or
yarn install

Step 3: Configure Environment

Create a .env file in the root of the project:

MONGO_URI=mongodb://localhost:27017/pg-bot
BOT_TOKEN=your_discord_bot_token
CLIENT_ID=your_discord_client_id
CLIENT_SECRET=your_discord_client_secret

DASHBOARD_URL=http://localhost:3000
API_URL=http://localhost:3000/api
PORT=3000

ENCRYPTION_KEY=your_32_character_encryption_key

See Environment Setup Guide for details.


Step 4: Build the Dashboard

npm run build

Step 5: Run the Dashboard

Development Mode (hot reload)

npm run dev

Production Mode

npm start

The dashboard will be available at: http://localhost:3000


Step 6: Discord OAuth2 Setup

  1. Go to Discord Developer Portal.
  2. Open your application > OAuth2 > Redirects.
  3. Add your dashboard redirect URL: http://localhost:3000/api/callback
  4. Save changes.
  5. Update CLIENT_ID and CLIENT_SECRET in .env.

Optional: PM2 (Auto-Restart in Production)

npm install -g pm2
pm2 start dist/app.js --name "pg-dashboard"
pm2 logs pg-dashboard

Optional: Reverse Proxy with Nginx

If deploying on a server:

server {
listen 80;
server_name yourdomain.com;

location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}

Reload nginx:

sudo systemctl restart nginx

Final Check

  1. Start your bot (npm run dev or npm start).
  2. Visit http://localhost:3000.
  3. Login with Discord to access the dashboard.

You now have the PG dashboard installed and running!