This is a Next.js project integrated with Dojo for Starknet blockchain gaming.
Make sure you have the following installed:
This project requires both a Starknet node (Katana) and an indexer (Torii) to be running alongside the frontend.
First, clone the contracts repository and set up the Starknet environment:
# Clone the contract repo
git clone https://github.com/songifi/lyricsflip-contract.git
cd <CONTRACT_REPO_DIRECTORY>
# Run Katana local Starknet node with development settings
katana --dev --http.api dev,starknet --dev.no-fee --http.cors_origins '*'
In a new terminal, from the contracts directory:
# Build the contracts with TypeScript bindings
sozo build --typescript
# Deploy the contracts to the local Katana node
sozo migrate
After migration, note the WORLD_ADDRESS
from the output.
Start Torii indexer to sync blockchain data:
# Replace <WORLD_ADDRESS> with the actual world address from step 2
torii --world <WORLD_ADDRESS> --http.cors_origins "*"
Copy the generated TypeScript files from the contracts build to the frontend:
# From the contracts directory, copy generated files to frontend
cp target/dev/manifest_dev.json /path/to/lyricsflip_frontend/
cp target/dev/typescript/contracts.gen.ts /path/to/lyricsflip_frontend/src/lib/dojo/typescript/
cp target/dev/typescript/models.gen.ts /path/to/lyricsflip_frontend/src/lib/dojo/typescript/
Finally, start the Next.js development server:
# In the frontend directory
npm install
npm run dev
Open http://localhost:3000 with your browser to see the result.
The project supports both development (Katana) and production (Cartridge Controller) modes:
Uses Katana prefunded accounts for easy testing:
npm run dev
Uses Cartridge Controller for real wallet interactions:
npm run wallet:cartridge
npm run dev
src/lib/dojo/
- Dojo integration layersrc/components/
- React components organized by atomic designsrc/hooks/
- Custom React hookssrc/services/
- API and WebSocket servicesmanifest_dev.json
- Dojo world manifest (auto-generated)
npm run dev
- Start development servernpm run build
- Build for productionnpm test
- Run testsnpm run wallet:katana
- Switch to Katana wallet modenpm run wallet:cartridge
- Switch to Cartridge wallet mode
- Dojo Documentation - Learn about Dojo framework
- Next.js Documentation - Learn about Next.js features and API
- Starknet Documentation - Learn about Starknet blockchain
- Connection Issues: Ensure Katana is running on
http://localhost:5050
- State Sync Issues: Verify Torii is running on
http://localhost:8080
- Contract Not Found: Make sure you've run
sozo migrate
and updated the world address - Type Errors: Ensure generated TypeScript files are copied to
src/lib/dojo/typescript/