Quick Reference Card
π One-Page Cheat Sheet
Start Development (4 Terminals)
# Terminal 1: Validator
solana-test-validator --reset --quiet
# Terminal 2: Programs
cd starter_program && anchor build && anchor deploy
# Terminal 3: Frontend
cd frontend && pnpm dev
# Terminal 4: Indexer
cd go_indexer && make run
Essential Commands
# Build & Test
anchor build # Compile programs
anchor test # Run all tests
pnpm run type-check # Check TypeScript
go test ./... # Test indexer
# Deploy
anchor deploy # Deploy to current cluster
anchor keys list # Show program IDs
# Solana CLI
solana config set --url localhost # Switch to localnet
solana airdrop 2 # Get test SOL
solana balance # Check balance
solana logs # Watch transactions
Docker Quick Start
docker-compose up -d # Start all services
docker-compose logs -f # View logs
docker-compose down # Stop services
docker-compose ps # Check status
URLs
- Frontend: http://localhost:3000
- Indexer API: http://localhost:8080
- Health Check: http://localhost:8080/health
- Program Demo: http://localhost:3000/programs
Environment Files
# Frontend
frontend/.env.local
NEXT_PUBLIC_SOLANA_RPC_HOST=http://localhost:8899
NEXT_PUBLIC_STARTER_PROGRAM_ID=<program-id>
# Indexer
go_indexer/.env
SOLANA_RPC_URL=http://localhost:8899
DATABASE_URL=postgres://...
# Docker
.env (or .env.docker)
Program IDs
# Get current IDs
cd starter_program && anchor keys list
# Example output:
# starter_program: gARh1g6...
# counter_program: CounzVs...
Common Issues
| Problem | Solution |
|---|---|
| Port 8899 in use | lsof -ti:8899 \| xargs kill -9 |
| Programs wonβt deploy | solana-test-validator --reset |
| Frontend type errors | rm -rf node_modules && pnpm install |
| Git nested repo | rm -rf starter_program/.git |
Project Structure
βββ starter_program/ # Anchor programs (Rust)
βββ frontend/ # Next.js app (TypeScript)
βββ go_indexer/ # Blockchain indexer (Go)
βββ *.md # Documentation (11 files)
βββ docker-compose.yml # Full stack deployment
Key Files
| File | Purpose |
|---|---|
| README.md | Main documentation |
| SETUP_GUIDE.md | First-time setup |
| INTEGRATION_GUIDE.md | Indexer integration |
| DOCKER_DEPLOYMENT.md | Docker guide |
| test-full-stack.sh | Automated testing |
Verification Checklist
# Check everything is ready
./test-full-stack.sh
# Or manually:
anchor build # β Programs compile
anchor test # β 96+ tests pass
cd frontend && pnpm run type-check # β No TS errors
cd go_indexer && go build # β Indexer builds
Documentation Quick Links
- 5-min tutorial:
starter_program/QUICKSTART.md - API reference:
starter_program/README.md - CPI patterns:
starter_program/CROSS_PROGRAM.md - Setup guide:
SETUP_GUIDE.md - Integration:
INTEGRATION_GUIDE.md
Network Switching
# Localnet
solana config set --url localhost
# RPC: http://localhost:8899
# Devnet
solana config set --url devnet
# RPC: https://api.devnet.solana.com
# Mainnet
solana config set --url mainnet-beta
# RPC: https://api.mainnet-beta.solana.com
Program Instructions
starter_program (17 total):
- Config (4): initialize, initialize_config, update_config, toggle_pause
- Users (3): create_user_account, update_user_account, close_user_account
- Tokens (5): create_mint, mint_tokens, transfer_tokens, transfer_tokens_with_pda, burn_tokens
- CPI (3): transfer_sol, transfer_sol_with_pda, + invoke counter
- RBAC (2): assign_role, revoke_role
counter_program (6 total):
- initialize, increment, decrement, add, reset, increment_with_payment
Frontend Hooks (13 total)
Wallet Hooks (4):
- useBalance, useAccount, useSendTransaction, useTransactionHistory
Starter Program Hooks (7):
- useStarterProgram, useTokenOperations, useGovernance, useRoleManagement
- useTreasury, useNftCollection, useNftMarketplace
Counter Hook (1):
- useCounterProgram
Go Indexer Events (26 total)
Starter Program (20):
- Token events (8): TokensMintedEvent, TokensTransferredEvent, TokensBurnedEvent, etc.
- User events (3): UserAccountCreatedEvent, UserAccountUpdatedEvent, UserAccountClosedEvent
- Config events (2): ConfigUpdatedEvent, ProgramPausedEvent
- NFT events (7): NftCollectionCreatedEvent, NftMintedEvent, NftListedEvent, NftSoldEvent, etc.
Counter Program (6):
- CounterInitializedEvent, CounterIncrementedEvent, CounterDecrementedEvent
- CounterAddedEvent, CounterResetEvent, CounterPaymentReceivedEvent
Testing Matrix
| Test Type | Command | Expected |
|---|---|---|
| Integration | anchor test | 39+ passing |
| TypeScript | pnpm run type-check | No errors |
| Go Indexer | go test ./... | All pass |
| Full Stack | ./test-full-stack.sh | All β |
Metrics Summary
- Programs: 2 programs, 23 instructions
- Tests: 39+ integration tests (100% pass)
- Code: ~15,000+ lines total
- Docs: ~5,000+ lines across 11+ files
- Components: 8 React feature components
- Hooks: 13 custom React hooks
- Events: 26+ event types (indexer)
- Frontend: Next.js 16.1.1 + React 19
- Indexer: Go 1.24+ with MongoDB/PostgreSQL
Help Resources
- Docs: Read all
*.mdfiles - Logs:
solana logsordocker-compose logs - Debug: Check browser console
- Community: Solana/Anchor Discord
Git Commands (Manual Step Required)
# First time only
rm -rf starter_program/.git
git add -A
git commit -m "Initial commit: Full-stack Solana starter"
git branch -M main
π― TL;DR: Start validator β Deploy programs β Run frontend β Test!
π New here? Read SETUP_GUIDE.md first.
π³ Use Docker? Just run docker-compose up -d.
β All working? Visit http://localhost:3000/programs
Quick reference for Solana Starter Program
For detailed docs, see README.md and other guides