The Stellarcade Frontend is a high-performance React application built with Vite, providing a modern and responsive user interface for the Stellarcade platform.
- Framework: Vite + React 18
- Language: TypeScript
- Styling: Vanilla CSS (Premium Aesthetics)
- State Management: Zustand
- Wallet Integration: Stellar Freighter & Stellar SDK
- Testing: Vitest + Testing Library
frontend/
├── src/
│ ├── components/ # Reusable UI components
│ ├── pages/ # Page components
│ ├── services/ # API clients and utilities
│ ├── hooks/ # Custom React hooks
│ ├── stores/ # Zustand state stores
│ ├── utils/ # Helper functions
│ └── styles/ # Global styles
├── tests/ # Test suites
├── .env.example # Environment template
├── index.html # HTML entry point
└── package.json
- Node.js v18+
- pnpm (recommended) or npm
- Backend API running (see Backend README)
-
Install pnpm (if not already installed):
npm install -g pnpm
-
Install dependencies:
pnpm install
-
Set up environment variables:
cp .env.example .env
Edit
.envwith your local settings:# Stellar Network Configuration VITE_STELLAR_NETWORK=testnet VITE_SOROBAN_RPC_URL=https://soroban-testnet.stellar.org VITE_NETWORK_PASSPHRASE=Test SDF Network ; September 2015 # Contract IDs (update after deploying contracts) VITE_PRIZE_POOL_CONTRACT_ID=C... VITE_ACHIEVEMENT_BADGE_CONTRACT_ID=C... VITE_ACCESS_CONTROL_CONTRACT_ID=C... VITE_COIN_FLIP_CONTRACT_ID=C... VITE_RANDOM_GENERATOR_CONTRACT_ID=C...
-
Start the development server:
pnpm run dev
The application will be available at
http://localhost:5173.
Run all tests:
pnpm testRun tests in watch mode:
pnpm run test:watchRun tests with coverage:
pnpm run test:coverage# Start development server
pnpm run dev
# Build for production
pnpm run build
# Preview production build
pnpm run preview
# Run type checking
pnpm run type-check
# Run tests
pnpm test
# Run tests in watch mode
pnpm run test:watch
# Run tests with coverage
pnpm run test:coverage
# Lint code
pnpm run lint- Modern React 18 with TypeScript
- Fast development with Vite HMR
- State management with Zustand
- Stellar wallet integration
- Responsive design
- Dashboard with real-time balance tracking
- Interactive game interfaces (Coin Flip, Dice, etc.)
- Transparent game history and verification tools
- Prize pool leaderboards
- Tournament system UI
- NFT reward displays
The frontend connects to the backend API. Configure the API base URL:
# In .env (optional, defaults to http://localhost:3000)
VITE_API_URL=http://localhost:3000import { apiClient } from "@/services/api";
// Example: Fetch games
const games = await apiClient.get("/api/v1/games");Stellarcade supports Stellar wallet connections:
- Freighter (browser extension)
- Other Stellar wallets via Wallets-JS
import { connectWallet } from "@/services/wallet";
const wallet = await connectWallet();
console.log(wallet.address); // User's Stellar addressAfter setup, verify the frontend is working:
- All dependencies installed successfully
- Development server starts without errors
- Application loads in browser at
http://localhost:5173 - Can connect to backend API (check browser console)
- Type checking passes:
pnpm run type-check - All tests pass:
pnpm test
Error: ERR_PNPM_... or peer dependency conflicts
Solutions:
# Clear cache and reinstall
rm -rf node_modules pnpm-lock.yaml
pnpm store prune
pnpm installError: Port 5173 is already in use
Solutions:
# Find process using port 5173
lsof -i :5173
# Kill the process
kill -9 <PID>
# Or use a different port
pnpm run dev --port 3001Error: Network errors or CORS issues
Solutions:
-
Verify backend is running:
curl http://localhost:3000/api/health
-
Check API URL in
.envmatches your backend:VITE_API_URL=http://localhost:3000
-
Ensure backend has CORS enabled for frontend origin
Error: Type errors during build or type-check
Solutions:
# Run type checking to see all errors
pnpm run type-check
# Fix errors in reported files
# Common issues: missing types, interface mismatchesError: Wallet not detected or connection fails
Solutions:
- Ensure Freighter extension is installed and unlocked
- Verify network configuration matches backend (testnet/mainnet)
- Check browser console for detailed error messages
# Build optimized production bundle
pnpm run build
# Preview production build locally
pnpm run previewBuild artifacts will be in the dist/ directory.
- Complete Setup Guide - End-to-end local development setup
- Backend API - Backend server documentation
- API Reference - REST API documentation
- Architecture - System design overview
- Alpha: ✅ Static UI mockups and component library
- Beta: 🔄 Backend API integration (in progress)
- Public: ⏳ Mainnet release
Stay tuned for updates! Built with ❤️ for the Stellarcade community.