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

# Deploy

> Ship to your own host — the environment, the Blob store, a production treasury, and the link users open.

A Built-for-Bankroll app deploys like any web app, to your own host — Bankroll
never hosts it. Any origin that serves HTTPS works; this page is the Vercel
path the starter is wired for.

## The environment

| Variable                | What it is                                                                                                                                                                             |
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `BANKROLL_TREASURY_KEY` | The app's one secret: a base58 Solana secret key that receives payments and signs payouts. Without it the app still runs — it just can't take or send money, and its manifest says so. |
| `BANKROLL_APP_NAME`     | Shown when a user connects the app.                                                                                                                                                    |
| `SOLANA_RPC_URL`        | Your RPC endpoint. Optional to start, **required before you pay anyone** — see below.                                                                                                  |
| `BLOB_READ_WRITE_TOKEN` | Set automatically when a Blob store is connected — nothing to copy by hand.                                                                                                            |
| `STORE`                 | Leave unset in production: the [store](/build/store) then uses Vercel Blob. `STORE=fs` is the local-files setting `.env.local` carries in development.                                 |

`.env.local` is gitignored, so the dev configuration — and the dev treasury —
never reach a deployment.

## Vercel

```bash theme={null}
npx vercel link                                  # create or connect the project
npx vercel blob create-store acme-store          # injects BLOB_READ_WRITE_TOKEN
npx vercel env add BANKROLL_APP_NAME production
npx vercel deploy --prod
```

Connecting the Blob store injects its token into deployments automatically. Do
**not** `vercel env pull` it into `.env.local` — that overwrites your dev
setup, and worse, points local code at production data.

## A production treasury

Generate a **fresh** key for production — never the dev key, which sits in
plaintext on your machine — and set it so the secret is never printed or
written to disk: generate it and pipe it straight into a sensitive variable.
The public address goes to stderr, so you still see which wallet to fund.

```bash theme={null}
node -e "const{generateKeyPairSync}=require('crypto'),bs58=require('bs58').default;const{publicKey,privateKey}=generateKeyPairSync('ed25519');const a=publicKey.export({format:'der',type:'spki'}).subarray(-32),s=privateKey.export({format:'der',type:'pkcs8'}).subarray(-32);console.error('treasury:',bs58.encode(a));process.stdout.write(bs58.encode(Buffer.concat([s,a])))" \
  | npx vercel env add BANKROLL_TREASURY_KEY production --sensitive
```

Fund the address with the HSUSD you pay out of, and keep a little SOL on it —
the treasury pays the network fee, and the one-time rent when a payout creates
a recipient's token account.

<Warning>
  **Never replace a funded treasury.** Swapping the variable strands the balance
  — it does not move it. Rotating means: create the new key, move the old
  wallet's entire balance to the new address (`npx bankroll treasury send`), and
  only then swap the variable. A sensitive variable's value is shown once, at
  creation, never again.
</Warning>

## Set your RPC

Set `SOLANA_RPC_URL` before the app pays anyone. Unset, the SDK falls back to
Solana's public endpoint, which rate-limits under concurrency — and a 429 while
broadcasting a payout surfaces as `rpc_error` with an unknown outcome, the one
failure you cannot safely retry. The fallback warns once per process rather
than failing, so it will not stop a deploy that forgot it. Any provider works.

## Open it

Users open your app at:

```
https://joinbankroll.com/play?url=<your URL-encoded origin>/app
```

— which is [`playLink()`](/build/share-links) if you'd rather not build it by
hand. Before sharing it, confirm the manifest is live:

```bash theme={null}
curl https://acme.example/.well-known/bankroll.jwt
# → header.payload.
```

No registration or approval is required: once the manifest serves, the `/play`
link opens your app for any Bankroll user.
