Skip to content

Quickstart with React

Concise. Get started with Dojo in minutes.

This assumes knowledge of React and the Dojo CLI.

Prerequisites:

  1. Create project
npx @dojoengine/create-dojo start -t example-vite-react-sdk
  1. Run development network with katana
# In new terminal
katana --dev --dev.no-fee --http.cors_origins "*"
  1. Build and deploy contracts
cd dojo-starter
sozo build
sozo migrate

From the sozo migrate command output, find the deployed world address. For example:

 profile | chain_id | rpc_url
---------+----------+------------------------
 dev     | KATANA   | http://localhost:5050/
 
 
🌍 World deployed at block 2 with txn hash: 0x038e984efa3e91e045b33d14e63c5e9f765e5a8fe2b3546fc3ab872f608e37a2
⛩ī¸   Migration successful with world at address 0x00e2ea9b5dd9804d13903edf712998943b7d5d606c139dd0f13eeb8f5b84da8d

The world address in this case would be 0x00e2ea9b5dd9804d13903edf712998943b7d5d606c139dd0f13eeb8f5b84da8d.

  1. Run indexer with torii

Start the indexer torii with the world address from the last step:

# In new terminal
torii --http.cors_origins "*" --world YOUR_WORLD_ADDRESS

The command for the example world address above would be:

# Example command only. Use your own world address.
torii --http.cors_origins "*" --world 0x00e2ea9b5dd9804d13903edf712998943b7d5d606c139dd0f13eeb8f5b84da8d
  1. Setup client
cd client
pnpm i
pnpm dev

Visit http://localhost:5173 to view the project. You should now see the project connected to the network and indexed!

Next Steps

This should have given you a good starting point to build your first application with Dojo. Here are some next steps to take: