Best practices, references, and templates for integrating games with the Play.fun ecosystem.
Play.fun is a platform for integrating games with Web3 rewards. Games can register on Play.fun, track player points, and launch Playcoins (game-specific Solana tokens) that reward players based on their gameplay.
npx skills add OpusGameLabs/skills| Topic | Description |
|---|---|
| API Reference | Complete API endpoint reference |
| API Authentication | HMAC-SHA256 authentication guide |
| Server SDK | Server SDK reference (recommended for production) |
| Browser SDK | Browser SDK reference (for prototypes) |
| Hybrid SDK | Combined Server + Browser approach |
| SDK Best Practices | Security, validation, and SDK selection |
| MCP Quickstart | MCP server setup for AI assistants |
| Glossary | Play.fun terminology and concepts |
| Guide | Description |
|---|---|
| GitHub Pages Deploy | Deploy games to GitHub Pages for free hosting |
| Snippet | Description |
|---|---|
| Server SDK Snippets | Express.js, Next.js, session validation examples |
| Browser SDK Snippets | Vanilla JS, React, Phaser 3 examples |
| Scenario | Recommended SDK |
|---|---|
| Production game with token rewards | Server SDK |
| Games where cheating prevention matters | Server SDK |
| Security + Play.fun widget | Hybrid (Server + Browser) |
| Quick prototype / demo | Browser SDK |
| Game jam entry | Browser SDK |
import { OpenGameClient } from '@playdotfun/server-sdk';
const client = new OpenGameClient({
apiKey: process.env.OGP_API_KEY!,
secretKey: process.env.OGP_API_SECRET_KEY!,
});
await client.play.savePoints({
gameId: 'your-game-uuid',
playerId: 'player-123',
points: 100,
});<meta name="x-ogp-key" content="YOUR_API_KEY" />
<script src="https://sdk.play.fun"></script>
<script>
let sdk = null;
let sdkReady = false;
if (typeof OpenGameSDK !== 'undefined') {
sdk = new OpenGameSDK({
ui: { usePointsWidget: true },
logLevel: 1,
});
sdk.on('OnReady', () => {
sdkReady = true;
});
sdk.on('SavePointsSuccess', () => console.log('Saved!'));
sdk.on('SavePointsFailed', () => console.log('Failed'));
sdk.init({ gameId: 'your-game-uuid' });
}
// During gameplay:
// if (sdk && sdkReady) sdk.addPoints(10);
//
// At game over:
// if (sdk && sdkReady) sdk.savePoints(totalScore);
</script>MIT