# Guide: Ship as a Farcaster Mini App

Distribute your ChainRender app as a Farcaster Mini App using `@chainrender/client/miniapp`. Your app stays fully
on-chain; the adapter just builds the Farcaster manifest and embed metadata around it.

## Build the manifest

```ts
import { buildManifest, capabilitiesForEnvelope } from "@chainrender/client/miniapp";
import { requiredCapabilities } from "@chainrender/client";

const manifest = buildManifest(
  {
    name: "My App",
    homeUrl: "https://myapp.example",
    iconUrl: "https://myapp.example/icon.png",          // 1024×1024
    requiredChains: ["eip155:11155111"],                 // CAIP-2: the chains the app needs
    requiredCapabilities: capabilitiesForEnvelope(requiredCapabilities(myAppTree)),
  },
  accountAssociation, // optional { header, payload, signature }: proves your FID owns the domain
);
// serve JSON.stringify(manifest) at https://myapp.example/.well-known/farcaster.json
```

`capabilitiesForEnvelope` maps your app's capability envelope to the wallet requirement the host should expect —
write/value/sign map to a wallet requirement; read/gpu need none. This keeps the Mini App's declared needs honest
and minimal.

## Build the embed + meta tags

```ts
import { buildEmbed, buildEmbedMetaTags } from "@chainrender/client/miniapp";

const embedConfig = {
  imageUrl: "https://myapp.example/preview.png",  // 3:2 preview (can be the app's own on-chain render)
  buttonTitle: "Open",                            // ≤ 32 characters
  appUrl: "https://myapp.example",
};
const embed = buildEmbed(embedConfig);              // the fc:miniapp JSON object
const metaTags = buildEmbedMetaTags(embedConfig);   // emits both fc:miniapp and the fc:frame alias
// inject metaTags into your page <head>
```

## Fail-closed outside a host

The miniapp runtime hooks (identity, wallet, notifications) **degrade safely** when the app runs outside a
Farcaster host: `inMiniAppHost` is false, `signalReady` is a safe no-op, and identity/wallet/notifications return
null/false. So the *same* app works as a normal web page and as a Mini App — no branching, no breakage.

## The app itself is unchanged

Nothing about your ChainRender app changes to become a Mini App — it's the same on-chain component, rendered the
same way. The adapter only adds the Farcaster distribution wrapper. Your app stays Grade A and fully on-chain.

## Related
- **[Reference → @chainrender/client](../reference/sdk-client.md)** · **[What's Fully On-Chain](../concepts/fully-on-chain.md)**
