One login. One shared XP + badges ledger across the whole suite — a badge earned in Ground Game shows up in Save Arena, PD Hub, Dream Big, and on the Command Center home. This is the API that makes ~30 tools feel like one competitive platform.
| Method | Path | Auth | Purpose |
|---|---|---|---|
| POST | /emit | x-internal token | App pushes a typed event |
| GET | /user/:email | open | Identity + XP + level + badges (badge bar) |
| GET | /badges | open | This catalog (JSON) |
| GET | /leaderboard | open | ?scope=market|portfolio|system&key=… |
| GET | /badge-bar.js | open | The shared embed strip |
// 1. bind the spine in the app's wrangler.jsonc "services": [{ "binding": "BADGES", "service": "badges-api" }] // 2. share the secret: wrangler secret put INTERNAL_TOKEN (same value) // 3. emit where credit is awarded (copy src/client.js): const res = await emitBadgeEvent(env, { app: 'pd-hub', type: 'scenario', actor_email: email, market, portfolio, id: submissionId, // stable id => idempotent }); if (res?.new_badges?.length) toastBadges(res.new_badges); // 🎉
<!-- after Cloudflare Access sets the user -->
<script src="https://badges.dreambigsouthwind.com/badge-bar.js"
data-email="rep@dreambigsouthwind.com"></script>
Ring 1 of the spine — live. Next: Cloudflare Access (one login) ·
first real loop in Save Arena · custom domain badges.dreambigsouthwind.com.