Deployment¶
Deploy ChostPulse to Cloudflare Workers, Vercel, or Netlify.
Prerequisites¶
- Node.js 20+: Download
- Account on chosen platform: Cloudflare, Vercel, or Netlify
Installation¶
Clone the repository and install dependencies:
Deploy¶
1. Create KV Namespace¶
Note the returned ID.
2. Configure wrangler.toml¶
Update wrangler.toml with your KV namespace ID:
name = "chost-pulse-worker"
main = "src/platforms/cloudflare.ts"
compatibility_date = "2024-09-23"
[[kv_namespaces]]
binding = "PULSE_KV"
id = "your-kv-namespace-id"
3. Deploy¶
Verification¶
Test your deployed worker:
# Health check
curl https://your-domain.com/health
# Send a heartbeat
curl -X POST https://your-domain.com/api/heartbeat \
-H "Content-Type: application/json" \
-d '{
"token": "sk_live_550e8400-e29b-41d4-a716-446655440000",
"data": {
"status": "online",
"players": 10,
"maxPlayers": 50,
"tps": 20.0,
"version": "1.0.0"
}
}'
# View a badge
curl "https://your-domain.com/api/badge?id=srv_pub_xxx&type=status"
Platform Comparison¶
| Feature | Cloudflare | Vercel | Netlify |
|---|---|---|---|
| Edge Locations | 300+ | 100+ | 100+ |
| Cold Start | <1ms | ~50ms | ~50ms |
| Storage | Cloudflare KV | Vercel KV | Netlify Blobs |
| Free Tier | 100k/day | 100k/month | 125k/month |
Updating¶
To update: