Architecture
How PokeDexter's components fit together.
Architecture
PokeDexter is built on a fork of Pokémon Showdown with custom wagering infrastructure layered on top. This page explains how all the pieces connect.
High-Level Overview
Components
Game Server (Port 8000)
The core Pokémon Showdown server, responsible for:
- User connections via SockJS (WebSocket abstraction)
- Chat rooms and private messages
- Matchmaking for ladder and challenges
- Battle simulation (Generations 1-9)
- Wager plugin for escrow and settlement
Key directories:
Fake Login Server (Port 8001)
A lightweight mock authentication server that:
- Allows instant username selection (no registration)
- Returns valid assertions for any username
- Bypasses the official Pokémon Showdown login server
Why fake? The official PS login server requires account creation. For PokeDexter, we want frictionless access - pick a name and play.
Browser Client
The web interface users interact with:
- Static files served via nginx
- SockJS client for real-time communication
- Battle renderer with animations
- Team builder (for non-random formats)
Configuration:
Wager Plugin
Custom chat plugin that adds wagering functionality:
Dexter Facilitator
External service (x402.dexter.cash) that:
- Sponsors transaction fees (users don't need SOL)
- Verifies payment signatures
- Settles transactions on-chain
- Tracks all payments for marketplace stats
Solana Blockchain
Where the money actually moves:
- USDC (SPL token) for all wagers
- Escrow wallets hold funds during battles
- Settlement transactions pay winners
- All transactions publicly verifiable
Data Flow: Wagered Battle
1. Challenge Phase
2. Deposit Phase
3. Battle Phase
4. Settlement Phase
Configuration Files
Server Config (config/config.js)
Client Config (config/config.js)
Environment Variables
Security Model
Escrow Isolation
Each wager creates a fresh Keypair. Even if one escrow is compromised, others are unaffected.
Server-Side Keys
Escrow private keys exist only on the server. Users never see them, only the public address for deposits.
No Password Storage
The fake login server doesn't store passwords - there are no passwords. Usernames are ephemeral.
On-Chain Verification
All settlements are Solana transactions. Anyone can verify a payout happened.

Architecture