Development Guide
This guide covers testing, debugging, and deploying your Games.fun integration.
Development Mode
The SDK includes a development mode for testing without real tokens:
const sdk = new GamesFunSDK({
debug: true, // Enable debug logging
gameServerUrl: "your-validation-endpoint",
dev: {
enabled: true,
mock: {
wallet: {
address: 'ED5nyyWEzpPPiWimP8vYm7sD7TD3LAt3Q3gRTWHzPJBY',
tokenBalance: '1000',
solBalance: '10',
privyId: '123'
}
},
validation: {
auto: true, // Auto-validate transfers
makeRequest: true // Still hit your server
}
}
});Environment Setup
Set up your environment variables:
Load them in your server:
Testing
Token Transfers
Test token transfers with dev mode:
Authentication
Test JWT flow:
WebSocket
Test real-time updates:
Debugging
Client Side
Enable debug logging:
Monitor WebSocket messages:
Server Side
Log validation requests:
Monitor state changes:
Deployment
Game Server
Set up environment:
Run server:
Client Side
Build React app:
Configure SDK:
Production Checklist
Security
Validate all inputs
Use HTTPS
Set CORS headers
Rate limit requests
Error Handling
Log all errors
Show user messages
Handle edge cases
Monitor issues
Performance
Optimize state updates
Cache responses
Use WebSocket
Monitor latency
Monitoring
Log key events
Track metrics
Set up alerts
Monitor uptime
Best Practices
Development
Use TypeScript
Write tests
Document code
Follow patterns
Testing
Unit tests
Integration tests
Load tests
Error scenarios
Deployment
Use CI/CD
Stage changes
Back up data
Monitor logs
Maintenance
Update packages
Check logs
Monitor usage
Handle issues