Reference: create-chainrender
Scaffold a working ChainRender project in one command:
npm create chainrender@latest my-app
cd my-app && npm install && npm run dev
You'll pick what you're building:
| Template id | Tier | What it emits |
|---|---|---|
component-html |
T1 | A plain HTML page that renders a deployed component by its content hash from a free eth_call — you enter the RPC URL, the chain's RenderRouter address and the hash. Vite serves it so the SDK import resolves. |
miniapp-react |
T2 | A React app that composes from the closed vocabulary and shows, live as you edit, its checkNode() issues (what compile() would silently drop), content hash and grade(). Renders a deployed component from chain once .env is set. |
defi-app-react |
T3 | The same, with two views (Quote, Venues) shaped like the zQuoter flagship, each holding a live-data slot you bind to your chain's DeFi resolver (uniQuote, uniV3Price, …). Each view is checked and graded. |
miniapp-farcaster |
T2 | The HTML render page plus a Farcaster Mini App manifest stub; @chainrender/client/miniapp builds the complete manifest. |
game-tictactoe |
T3 | A playable two-player game on the deployed v2 game stack: post or join an offer in GameLobbyV2, play with peer-to-peer moves signed by a browser game key and carried by GameMoveBoard, settle on-chain in GameChannelV2, challenge a staller, withdraw. src/engine.ts is the whole protocol (tested end to end in the repo); src/floor.ts is the lobby as a grade-A ChainRender component. See Multiplayer & Lobbies. |
Non-interactive use
For CI, scripts or an AI agent, name the template:
npm create chainrender@latest my-app -- --template miniapp-react
npx create-chainrender my-app --template component-html
npm create chainrender@latest my-game -- --template game-tictactoe
npx create-chainrender --help # lists the template ids
With no terminal and no --template, the first template is used and the choice is printed.
No addresses are baked in
The RenderRouter address and the app hash differ per chain and per deployment, so a scaffold never hardcodes them: the
HTML page takes them as inputs, and the React templates read VITE_CR_RPC, VITE_CR_ROUTER and VITE_CR_APP_HASH
from .env (copy .env.example). Find the addresses on Deployed Contracts.
Versions
create-chainrender 0.3.9 pins @chainrender/client ^0.21.0 (decompile, the builder's Fork; docs/202 §20.12),
React 19, Vite 5, viem 2 and, for the game template, TypeScript 5, in the generated package.json, from the manifest's
versions map. Scaffolds made with 0.3.8 (client ^0.20.0, the Classic/Enhanced switch: Enhanced renders where the
chain's RenderRouter has the VERSION_5 interpreter — Sepolia, Robinhood and Arc), 0.3.7 (client ^0.19.0, viewer reads), 0.3.6 (^0.18.0), 0.3.5 (^0.17.0), 0.3.4 (^0.16.0), 0.3.3 (^0.15.0), 0.3.2 (^0.14.0),
0.3.0/0.3.1 (^0.13.0), 0.2.0 (^0.10.1) and 0.1.0 still work as they are. Publish client 0.21.0 before
create-chainrender 0.3.9: a scaffold resolves ^0.21.0 from npm.
The scaffolder is manifest-driven (templates.json): a new template is a new manifest entry, never a code change.
A template can also ship real files under templates/<id>/ (the entry's dir). They are copied as they are, with
{{name}} and {{version}} filled; the game template works this way, so its files are the tested ones.
Every scaffold starts at grade A, and the React templates show the grade and the tree check as you build — a
dependency you add that lowers the grade shows up there before you deploy.