This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Dark Shuffle is a deck-building game built on Starknet. It uses:
- Frontend: React 18 + Vite + Material-UI
- Smart Contracts: Cairo 2.10.1 with Dojo Engine v1.5.0
- Blockchain: Starknet Layer 2
Start the full development environment:
# Terminal 1: Start local blockchain (Katana)
./scripts/contracts.sh
# Terminal 2: Start indexer (Torii) - wait for Katana to be ready
./scripts/indexer.sh
# Terminal 3: Start frontend
./scripts/client.shpnpm install # Install dependencies
pnpm dev # Start dev server (with --force flag)
pnpm build # Production build
pnpm lint # Run ESLint
pnpm preview # Preview production buildsozo build # Build contracts
sozo test # Run all tests
sozo migrate # Deploy to local Katana
scarb fmt # Format Cairo code
scarb fmt --check # Check formatting (used in CI)# Run a single contract test
sozo test -f test_function_name
# Frontend has no test command defined - check for test files before suggesting testsclient/- React frontendsrc/api/- Blockchain integration (indexer, starknet)src/battle/- Battle logic and utilitiessrc/components/- React componentssrc/contexts/- State management
contracts/- Cairo smart contractssrc/models/- Game data models (ECS entities)src/systems/- Game logic (ECS systems)src/utils/- Contract utilities
scripts/- Development and deployment scripts
Dojo Engine: The game uses Dojo's Entity Component System (ECS) pattern:
- Models define game state (entities and components)
- Systems implement game logic that modifies state
- World is the deployed game instance containing all systems and models
Game Flow:
- Players connect wallet via Cartridge Controller
- Draft phase: Select cards to build a deck
- Map navigation: Progress through game stages
- Battle phase: Turn-based card battles with on-chain logic
- Achievements: Track player accomplishments
Entry Points:
client/src/main.jsx- Frontend entrycontracts/dojo_world_sepolia.toml- Deployment configcontracts/src/lib.cairo- Contract entry
Game Logic:
contracts/src/systems/draft.cairo- Card selectioncontracts/src/systems/battle.cairo- Combat logiccontracts/src/models/game.cairo- Core game state
Monster Abilities: Each creature has unique abilities in:
contracts/src/systems/monster_abilities/client/src/battle/creature/abilities/
-
Contract Changes:
- Modify Cairo files
- Run
sozo buildto verify compilation - Run
sozo testfor affected systems - Run
scarb fmtbefore committing
-
Frontend Changes:
- GraphQL queries are generated from
client/src/queries/ - Card assets are in
client/src/assets/cards/ - Battle animations use Lottie files in
client/src/assets/animations/
- GraphQL queries are generated from
-
Adding New Features:
- Define models in
contracts/src/models/ - Implement systems in
contracts/src/systems/ - Update frontend queries and components
- Copy new manifest to client after migration
- Define models in
- Local: Katana + Torii (development)
- Sepolia: Testnet deployment
- Mainnet: Production deployment
- Slot: Cartridge infrastructure deployment
Each environment has its own manifest file (manifest_*.json) generated after deployment.