← Back to list

dojo-setup
by dojoengine
Official JavaScript packages for Dojo.
⭐ 37🍴 55📅 Jan 23, 2026
SKILL.md
name: dojo-setup description: | Use when setting up dojo.js SDK in a frontend project. Triggers: setup dojo, initialize dojo, configure dojo, dojoengine setup, sdk init, DojoSdkProvider, world address, torii url, dojo config
Dojo.js SDK Setup
When to Use
Use this skill when:
- Setting up dojo.js in a new frontend project
- Configuring the SDK with world address and Torii URL
- Setting up the React provider hierarchy
- Generating TypeScript types from ABIs
SDK Initialization
import { init } from "@dojoengine/sdk";
import { DojoConfig } from "@dojoengine/core";
import { schema } from "./models.gen"; // Generated from ABI
const sdk = await init<typeof schema>({
client: {
worldAddress: "0x...",
toriiUrl: "http://localhost:8080",
},
domain: {
name: "MyGame",
version: "1.0.0",
chainId: "SN_MAIN", // or "SN_SEPOLIA"
},
});
React Provider Setup
Note:
masterAddressandmasterPrivateKeyare for local development only. In production, use wallet connections instead.
import { DojoSdkProvider } from "@dojoengine/sdk/react";
import { DojoConfig, DojoProvider } from "@dojoengine/core";
const dojoConfig: DojoConfig = {
manifest: manifest, // From manifest.json
rpcUrl: process.env.VITE_RPC_URL || "http://localhost:5050",
toriiUrl: process.env.VITE_TORII_URL || "http://localhost:8080",
// For local development only - never hardcode in production
masterAddress: process.env.VITE_MASTER_ADDRESS || "0x...",
masterPrivateKey: process.env.VITE_MASTER_PRIVATE_KEY || "",
};
function App() {
return (
<DojoSdkProvider
dojoConfig={dojoConfig}
sdk={sdk}
// clientFn is a user-provided factory to create your game client
clientFn={(provider) => new GameClient(provider)}
>
{children}
</DojoSdkProvider>
);
}
Environment Variables
VITE_WORLD_ADDRESS=0x...
VITE_TORII_URL=http://localhost:8080
VITE_RPC_URL=http://localhost:5050
VITE_CHAIN_ID=SN_SEPOLIA
Key Configuration Options
| Option | Description |
|---|---|
worldAddress | Deployed world contract address |
toriiUrl | Torii indexer URL (default: http://localhost:8080) |
rpcUrl | Starknet RPC URL |
chainId | SN_MAIN, SN_SEPOLIA, or custom |
manifest | Dojo manifest.json for contract ABIs |
Using DojoContext
import { useDojoSDK } from "@dojoengine/sdk/react";
function GameComponent() {
const { sdk, config, provider, useDojoStore } = useDojoSDK();
// sdk: SDK instance for queries/subscriptions
// config: DojoConfig
// provider: DojoProvider for contract calls
// useDojoStore: Zustand store hook
}
Common Pitfalls
- Missing schema types: Generate types from ABI using
@dojoengine/coreCLI - CORS issues: Ensure Torii is configured to allow your frontend origin
- Wrong chain ID: Must match the deployed world's chain
- Provider hierarchy:
DojoSdkProvidermust wrap all Dojo-consuming components
Score
Total Score
70/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
✓最近の活動
1ヶ月以内に更新
+10
✓フォーク
10回以上フォークされている
+5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
✓タグ
1つ以上のタグが設定されている
+5
Reviews
💬
Reviews coming soon
