> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinematic.run/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> These are the customer docs for kinematic, a name written in lowercase except at the start of a sentence. Kinematic provides provably fair casino games, served to a casino's site by a game server: a Cloudflare Worker that the kinematic dashboard deploys into the casino's own Cloudflare account.
> Never put SESSION_SECRET or WALLET_SECRET in code, prompts, logs, commits or chat. Read them from environment variables and ask the person you work with to set them. The dashboard's Integration page shows each secret once.
> Values such as lucky-star, luckystar.example, og-rgs-lucky-star.luckystar.workers.dev, games.luckystar.example and player_48213 are examples. Use the casino's own casino ID, game server origin, element tag, session issuer and currencies: the Instructions for your coding agent on the dashboard's Integration page hold them, or ask the person you work with.
> To debug, start at https://docs.kinematic.run/troubleshooting and https://docs.kinematic.run/reference/errors. The wallet contract is at https://docs.kinematic.run/api/wallet.openapi.yaml.
> Sandbox bets are recorded on Solana devnet. Live game servers record nothing on Solana until the audited mainnet program is deployed.

# Integration overview

> The three steps your site and backend implement to offer the games: put the games on your page, sign session tokens and, for live mode, connect your wallet.

Your game server runs the games, the bets and the proofs. Your side implements three steps, and the dashboard's **Integration** page names them the same way:

| Step | You build | Needed in |
| - | - | - |
| [Put the games on your page](https://docs.kinematic.run/integrate/embed.md) | The element and the loader in your site's HTML, and, if your pages send one, [Content Security Policy](https://docs.kinematic.run/integrate/csp.md) directives | Sandbox and live |
| [Sign session tokens](https://docs.kinematic.run/integrate/session-tokens.md) | A session endpoint on your backend, behind your player login | Sandbox and live |
| [Connect your wallet](https://docs.kinematic.run/integrate/wallet.md) | Debit, credit and balance endpoints at your wallet URL | Live |

You install nothing from npm and write no game logic. The element, the games, the Provably fair dialog and every proof come from your game server.

## The Integration page

The **Integration** page has three sections, in this order:

1. **Instructions for your coding agent** (`#agent`): one text that covers the steps with your casino's values and no secrets, with **Copy instructions**. See [Use an AI agent](https://docs.kinematic.run/agents.md).
2. **Steps**: the three steps above, one open at a time, with a counter of the steps done. Each step shows its code with your values and links to these docs. A link ending in `#embed`, `#session` or `#wallet` opens that step.
3. **Secrets** (`#secrets`): your `SESSION_SECRET` and `WALLET_SECRET`, their fingerprints and the date they were shown.

A second tab, **Wallet contract**, has the contract your wallet keeps.

## The values you need

All of these come from the dashboard. The Integration page fills them into its code and its instructions for your coding agent.

| Value | Example | Where it is set |
| - | - | - |
| Casino ID | `lucky-star` | Made from your casino's name when you create it, and never changes. **Settings**, under **Casino**, shows it to copy. Session tokens carry it as `tenant`. |
| Game server origin | `https://og-rgs-lucky-star.luckystar.workers.dev` | **Game server**, once a game server is deployed. **Copy the address** on its card copies it. |
| Element tag | `og-game` | **Appearance**. The default is `og-game`. |
| Allowed origins | `https://www.luckystar.example` | **Settings**, under **Players and sessions**. Every origin of a page that shows the games. |
| Session issuer | `https://www.luckystar.example` | **Settings**, under **Players and sessions**. Session tokens carry it as `iss`. |
| Currencies | `USD`, `BTC` | **Games**. Each with its decimal scale and limits. |
| Wallet URL | `https://wallet.luckystar.example/kinematic/` | **Settings**, under **Mode**, for live mode. |
| `SESSION_SECRET` | | **Integration**, under **Secrets**, shown once. Your session endpoint signs tokens with it. |
| `WALLET_SECRET` | | **Integration**, under **Secrets**, shown once. Your wallet checks the game server's signatures with it. |

After the secrets have been shown, the page keeps only each one's fingerprint: the first 12 hex digits of HMAC-SHA256 over the text `kinematic-secret-fingerprint`, keyed with the secret. Compute it from your copy to check that you hold the right one. See [Settings](https://docs.kinematic.run/dashboard/settings.md) for the allowed origins, the session issuer and the mode.

## The order to build in

**1. Put the games on your page**

Add the element and the loader to a page whose origin is in **Allowed origins**. If your pages send a `Content-Security-Policy`, merge the directives the step shows under **Content Security Policy, for pages that send one**.

**2. Sign session tokens**

Answer `POST /api/game-session` with a token for the signed-in player. In sandbox the game server keeps test balances, so players can bet as soon as the first two steps work. The [quickstart](https://docs.kinematic.run/quickstart.md) walks through both.

**3. Connect your wallet**

Implement `/debit`, `/credit` and `/balance` at your wallet URL with atomic, persistent idempotency. Test it with the cases in [Test your integration](https://docs.kinematic.run/integrate/testing.md#your-wallet).

**4. Go live**

Switch your casino to live mode in **Settings**, then run **Check my wallet** in the **Connect your wallet** step. See [Go live](https://docs.kinematic.run/dashboard/go-live.md).

## When a step shows Done

* **Put the games on your page** and **Sign session tokens** show **Done** once your game server reports your casino's first bet. Until then they read `No bet yet`.
* **Connect your wallet** shows **Done** once **Check my wallet** passes all its checks against your current wallet URL. In sandbox it reads `Needed for live mode`; in live mode `Not checked yet`, or `Check failed` after a check that did not pass. A check against an earlier wallet URL does not count.

## How one bet flows

1. The player presses **BET**. The element signs the bet with a key kept in the player's browser and sends it to your game server.
2. Your game server checks the session, the limits and the signature, then debits your wallet. In sandbox it debits its own test balance.
3. Once the debit applies, the game server signs its acceptance of the bet. Only then does the browser reveal the seed that decides the outcome.
4. The game server computes the outcome with your casino's VRF key, stores the result and credits a win to your wallet.
5. The element shows the result. The player can check the bet in the Provably fair dialog.

[How it works](https://docs.kinematic.run/concepts/how-it-works.md) describes each step and what it guarantees.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.