Deployment
How to deploy your own PokeDexter server.
Deployment Guide
This guide covers deploying PokeDexter for development, testing, or running your own instance.
Prerequisites
| Requirement | Version | Notes |
|---|---|---|
| Node.js | 22+ | Required for server |
| npm | 8+ | Comes with Node.js |
| PM2 | Latest | Process manager (optional but recommended) |
| nginx | Latest | Reverse proxy (for production) |
| Git | Latest | For cloning repos |
Install Prerequisites
Repository Setup
PokeDexter consists of two repositories:
Server Setup
1. Install Dependencies
2. Build
3. Configure
Edit config/config.js:
4. Environment Variables
Create .env in the root:
5. Start the Server
Development:
Production (PM2):
The server runs on port 8000 by default.
Fake Login Server Setup
The fake login server allows instant usernames without registration.
1. Start the Server
Or with PM2:
The login server runs on port 8001 by default.
Client Setup
1. Install Dependencies
2. Configure
Edit play.pokemonshowdown.com/config/config.js:
3. Build
4. Serve Static Files
The built client is static HTML/JS/CSS. Serve via nginx:
Nginx Reverse Proxy (Production)
For production, use nginx to handle SSL and proxy to the game server:
Enable the site:
SSL with Let's Encrypt
PM2 Process Management
View Running Processes
View Logs
Restart
Stop
Startup Script
Make PM2 start on boot:
Directory Structure
After setup, your directories should look like:
Testing Your Deployment
1. Check Server is Running
2. Check Login Server
3. Check Client Loads
Visit https://poke.your-domain.com in browser.
4. Test a Battle
- Open two browser windows (or use incognito)
- Pick different usernames
- Challenge one from the other
- Battle should work
5. Test Wallet Connection
Troubleshooting
"Connection refused"
- Check the game server is running:
pm2 list - Check the port:
netstat -tlnp | grep 8000 - Check firewall:
sudo ufw status
"WebSocket connection failed"
- Check nginx WebSocket config (Upgrade headers)
- Check SSL certificate is valid
- Try clearing browser cache
"User not found"
- Both users must be connected to the same server
- Check both have picked usernames
"Cannot find module"
Logs
Check logs for errors:
Production Checklist
Before going live with wagering:
- SSL configured and working
- PM2 startup script enabled
-
.envhas real wallet addresses -
HOUSE_WALLET_ADDRESSis your actual wallet - Tested wager flow end-to-end
- Backup strategy for config files
- Monitoring/alerting set up
- Persistence layer for escrow keys (critical!)

Deployment