Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions client-new/pages/deployment/torii/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
title: "Torii Indexer Overview"
description: "Learn what Torii is, why you need it, and how it works in the Dojo ecosystem"
---

# Torii Indexer Overview

Torii is Dojo's built-in tool for making your game data fast and easy to access. Think of it as a "search engine" for your on-chain game world—it keeps everything up-to-date in a local database so your apps can query it instantly.

## What is Torii?

- **Official Indexing Engine**: Torii is the standard way to index data in Dojo worlds
- **Automatic Syncing**: It watches your blockchain (Starknet) and copies game state changes to a database
- **Efficient Queries**: Provides APIs for quick data access, avoiding slow direct blockchain calls
- **Built in Rust**: Designed for speed and reliability
- **Pre-Installed**: Comes bundled with the Dojo toolchain—no extra setup needed

## Why Use Torii?

Directly querying the blockchain is like searching a massive library book-by-book: slow and costly. Torii acts like a catalog system:

- **Speed**: Instant access to game data
- **Real-Time Updates**: Supports subscriptions for live changes (e.g., player moves)
- **Cost Savings**: Reduces on-chain queries
- **Multiple Options**: Query via GraphQL, gRPC, or even SQL

## How It Works (Simplified)

1. **Monitor**: Torii tracks your deployed World contract on Starknet
2. **Capture**: It records every state change (e.g., new player spawns or moves)
3. **Store**: Saves data in a local database for easy access
4. **Serve**: Exposes APIs for your client apps to read the data

No manual intervention—Torii runs in the background when you deploy or migrate your Dojo project.

## API Interfaces

- **GraphQL**: Flexible for custom queries and real-time subscriptions
- Default Endpoint: `http://localhost:8080/graphql`
- **gRPC**: Fast binary protocol for high-performance apps
- Default Endpoint: `http://localhost:8080`

## When to Use Torii

- Fetching player stats (e.g., position, score)
- Building leaderboards or dashboards
- Real-time updates in games (e.g., multiplayer sync)
- Analyzing historical data without blockchain delays

## Installation Note

Torii is included by default with Dojo. Install Dojo via the official guide, and Torii is ready to go. Run `torii --world <WORLD_ADDRESS>` to start it manually if needed.

## Next Steps

- See the [Local Development](../local.md) guide for setup
- Check [Client Integration](./client-integration.md) for using Torii in apps
- For advanced config, visit the [official Dojo docs](https://book.dojoengine.org/toolchain/torii)

This overview keeps things simple—dive deeper as you build!
14 changes: 14 additions & 0 deletions client-new/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,20 @@ const sidebarConfig: SidebarItem[] = [
text: 'Slot',
link: '/deployment/slot',
},
{
text: 'Torii Indexer',
collapsed: true,
items: [
{
text: 'Overview',
link: '/deployment/torii/overview',
},
{
text: 'Client Integration',
link: '/deployment/torii/client-integration',
},
],
},
],
},
{
Expand Down