Project Structure
Next.js Configuration
Fromnext.config.ts:
Routing Strategy
Route Groups
Next.js uses route groups to organize layouts without affecting URLs:Dynamic Routes
Player profiles use dynamic routing:Catch-all Routes
Rankings support optional segments:State Management
1. TanStack Query (Server State)
Manages all API data fetching and caching:2. Dexie (Client Persistence)
IndexedDB wrapper for offline-first user data:- Main player ID
- Friends list
- Background preferences
- Overlay settings
- Chart legend states
3. Zustand (Global State)
Lightweight state management for UI state:4. React Context
For component-tree scoped state:Component Architecture
Root Layout
- LazyMotion: Lazy-loads Framer Motion features
- PageTransitionProvider: Smooth page transitions
- ViewportProvider: Responsive breakpoint detection
- QueryProvider: TanStack Query client
Custom Hooks
Reusable logic extraction:API Integration
All API calls go through the shared@ssr/common package:
Real-time Features
WebSocket Integration
Performance Optimizations
1. React Compiler
Automatic memoization eliminates manualuseMemo/useCallback: