# Triggair > Full game backend for browser games. Anonymous-first player identity, cloud saves, leaderboards, stats, achievements, daily rewards, inbox/rewards, friends & share links, a server-authoritative economy (currency, stores, inventory, loot boxes, energy), remote config & feature flags, moderation, age-gate/parental-consent compliance, analytics, crash reporting, tournaments/leagues/teams, UGC, battle-pass/quests/progression, collections storage, promo codes, turn-based matches, and deterministic RNG. One import, one publishable key. Agent-first: typed results and errors that say how to fix themselves. ## Start - Install: `npm i @triggair/sdk` then `const tg = createClient({ key: 'tg_pk_…' })`. - Only the `tg_pk_` publishable key goes in client code. NEVER ship a `tg_sk_` secret key. - Player-scoped calls auto-authenticate (an anonymous token is minted + silently refreshed). - Every error is a TriggairError with an `agentHint` — read it. Transient errors retry automatically. - Configure server-side surfaces (boards, economy, flags, quests, …) in the dashboard or via the MCP server — no client deploy to change them. - Before deploying, add your origin to the game's allowed_origins (CORS). ## Recipes - Install & initialize - Player identity (anonymous-first) - Cloud saves - Leaderboards - Player stats & profile - Achievements & daily rewards - Inbox & reward claims - Friends & share links - Economy: currency, store, inventory - Loot boxes & energy - Remote config, flags & live events - Moderation (names, chat, UGC) - Age gate & parental consent (compliance) - Analytics (durable & offline) - Realtime rooms (presence & chat) - Crash reporting - Turn-based matches - Storage collections - Promo codes & gifts - Tournaments (scheduled, prize tables) - Leagues (tiered divisions, promotion/relegation) - Teams & clans - Keyed leaderboards (per-entity boards) - Battle pass & quests - Player segments - User-generated content (create, publish, remix) - More domains, same shape - CORS: works locally, 403s when deployed - Recovery (cross-device) - Errors are actionable - Verify your integration ## Guides ### Getting started - Getting started (/docs/guides/getting-started): Keys, anonymous identity, and the one-import integration loop. - Reliability: retries, idempotency & offline (/docs/guides/reliability): How the SDK survives dropped connections and retries — the durable outbox, idempotency keys, and the error contract. - Built for coding agents (/docs/guides/agent-first): llms.txt, an MCP server, self-fixing errors, and a one-command self-test — so an agent can integrate the backend itself. ### Players & saves - Cloud saves (/docs/guides/cloud-saves): Per-slot saves with last-write-wins or conflict-safe writes, plus a durable offline queue. - Key-value storage & collections (/docs/guides/storage): Structured per-player, shared, and team collections with OCC and atomic mutations. - Achievements, dailies & progression (/docs/guides/progression): Achievements, daily rewards with streaks, quests, battle passes, and an XP/level curve. - Inbox & rewards (/docs/guides/inbox-rewards): The single audited path that grants currency, items, and stat rewards — exactly once. - Economy (/docs/guides/economy): Server-authoritative currency, stores, inventory, loot boxes, and energy — with one hardened grant path. ### Multiplayer & social - Social & teams (/docs/guides/social): Friends, share/invite links, and teams (clans) with roles, invites, and requests. - Realtime rooms (/docs/guides/realtime): WebSocket rooms with presence, broadcast, in-transit chat moderation, private rooms, and history. - Turn-based matches (/docs/guides/async-matches): Asynchronous multiplayer (chess, words, card games) over HTTP — no realtime connection needed. - Leaderboards & competition (/docs/guides/leaderboards-competition): Boards, periods, keyed boards, tournaments, and promotion/relegation leagues. ### Content & LiveOps - User-generated content (/docs/guides/ugc): Author, publish, play, and remix player content — with moderation and remix lineage. - LiveOps: config, flags, segments & codes (/docs/guides/liveops): Change the live game with no client deploy — remote config, feature flags, player segments, live events, and promo codes. - Verifiable RNG (/docs/guides/rng): Deterministic, server-seeded randomness so loot and crit rolls can't be client-forged. - Analytics & crash reporting (/docs/guides/analytics): Durable event ingest that rolls up into DAU/MAU, retention, funnels, sessions, economy health, and grouped crashes. ### Trust & safety - Moderation & trust-and-safety (/docs/guides/moderation): A pre-visibility filter, reports, bans/mutes enforced at token issuance, and appeals. - Age gate & compliance (/docs/guides/compliance): Fail-closed age brackets, no DOB stored, verifiable parental consent, and per-feature gating. ## More - Full guide: /llms-full.txt - API reference (OpenAPI 3.1): /openapi.json · human docs: /docs/api - Drop-in prompt: /dropin - Error docs: /docs/errors/ - MCP server (management tools): connect any MCP client to `POST /v1/mcp` with your developer session token as `Authorization: Bearer `. - Self-test: run the MCP tool `triggair_verify_integration` after wiring to close the loop.