/book:dojo-indexerfrom book
Sets up and configures Torii indexer for GraphQL queries, gRPC subscriptions, and SQL access to indexed world state. Use when indexing deployed worlds for client queries or real-time updates.
Ships in book. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Set up and use Torii, the Dojo indexer, for efficient querying and real-time subscriptions to your world state.
Manages Torii indexer:
Start Torii:
torii --world <WORLD_ADDRESS>
This starts Torii with default settings:
http://localhost:8080/graphqlhttp://localhost:8080With Controller indexing (recommended):
torii --world <WORLD_ADDRESS> --indexing.controllers
Production configuration:
torii --world <WORLD_ADDRESS> --db-dir ./torii-db --indexing.controllers
Torii is the Dojo indexer that:
Why use Torii:
Torii provides GraphQL endpoint at http://localhost:8080/graphql
Use the GraphiQL IDE in your browser to explore the schema and test queries.
Torii generates two types of queries:
Generic Queries:
entities - Access all entities with filteringmodels - Retrieve model definitionstransactions - Query indexed transactionsModel-Specific Queries:
{modelName}Models - Custom queries for each modelpositionModels, movesModelsGet all entities of a model:
query {
movesModels {
edges {
node {
player
remaining
last_direction
}
}
}
}
Get model metadata:
query {
models {
edges {
node {
id
name
classHash
contractAddress
}
}
totalCount
}
}
Cursor-based pagination:
query {
entities(first: 10) {
edges {
cursor
node {
id
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
Get next page:
query {
entities(first: 10, after: "cursor_value") {
edges {
cursor
node { id }
}
}
}
Offset/limit pagination:
query {
entities(offset: 20, limit: 10) {
edges {
node { id }
}
totalCount
}
}
Subscribe to world state changes via WebSocket.
subscription {
entityUpdated(id: "0x54f58...") {
id
updatedAt
models {
__typename
... on Position {
vec {
x
y
}
}
... on Moves {
remaining
}
}
}
}
Monitor all world events:
subscription {
eventEmitted {
id
keys
data
transactionHash
}
}
Listen for new model registrations:
subscription {
modelRegistered {
id
name
namespace
}
}
Torii stores data in SQLite, accessible for complex queries.
Connect to database:
sqlite3 torii.db
Example queries:
-- Count entities
SELECT COUNT(*) FROM entities;
-- Custom aggregations
SELECT AVG(value) FROM model_data WHERE model_name = 'Health';
import { createClient } from '@dojoengine/torii-client';
const client = await createClient({
rpcUrl: "http://localhost:5050",
toriiUrl: "http://localhost:8080",
worldAddress: WORLD_ADDRESS,
});
// Query entities
const positions = await client.getEntities({
model: "Position",
limit: 10
});
// Subscribe to updates
await client.onEntityUpdated(
[{ model: "Position", keys: [playerId] }],
(entity) => console.log("Position updated:", entity)
);
import { ApolloClient, InMemoryCache, gql } from '@apollo/client';
const client = new ApolloClient({
uri: 'http://localhost:8080/graphql',
cache: new InMemoryCache(),
});
const { data } = await client.query({
query: gql`
query GetMoves {
movesModels {
edges {
node {
player
remaining
}
}
}
}
`
});
| Option | Description | Default |
|---|---|---|
--world | World contract address | Optional (since Torii 1.6.0) |
--rpc | RPC endpoint URL | http://localhost:5050 |
--db-dir | Database directory | In-memory |
--config | Path to TOML configuration file | None |
--http.cors_origins | CORS origins | * |
Slot provides hosted Torii instances. Slot requires a TOML configuration file.
# torii.toml
world_address = "<WORLD_ADDRESS>"
rpc = "<RPC_URL>"
[indexing]
controllers = true
See the Torii configuration guide for all TOML options (indexing, polling, namespaces, etc.).
slot auth login
slot deployments create <PROJECT_NAME> torii --config torii.toml --version <DOJO_VERSION>
# Stream logs
slot deployments logs <PROJECT_NAME> torii -f
# Delete and recreate (safe — all data is on-chain)
slot deployments delete <PROJECT_NAME> torii
Terminal 1: Start Katana
katana --dev --dev.no-fee
Terminal 2: Deploy world
sozo build && sozo migrate
Terminal 3: Start Torii
torii --world <WORLD_ADDRESS> --http.cors_origins "*"
entitiesAfter Torii setup:
dojo-client skill)What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (dojoengine/book) — no native marketplace selected
npx claudepluginhub p/dojoengine-book13 skills in this plugin
/dojo-clientIntegrate Dojo with game clients for JavaScript, Unity, Unreal, Rust, and other platforms. Generate typed bindings and connection code. Use when connecting frontends or game engines to your Dojo world./dojo-configConfigure Scarb.toml, dojo profiles, world settings, and dependencies. Use when setting up project configuration, managing dependencies, or configuring deployment environments./dojo-deployDeploy Dojo worlds to local Katana, testnet, or mainnet. Configure Katana sequencer and manage deployments with sozo. Use when deploying your game or starting local development environment./dojo-initInitialize new Dojo projects with proper directory structure, configuration files, and dependencies. Use when starting a new Dojo game project or setting up the initial project structure./dojo-migrateManage world migrations, handle breaking changes, and upgrade Dojo versions. Use when updating deployed worlds, migrating to new versions, or handling schema changes./dojo-modelCreate Dojo models for storing game state with proper key definitions, trait derivations, and ECS patterns. Use when defining game entities, components, or state structures.Other plugins' skills for the same job