Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Ashokaas/BeeHex/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you begin, ensure you have the following installed on your system:- Node.js 20.x or higher
- npm (comes with Node.js) or your preferred package manager
- Git for version control
- A code editor (VS Code recommended)
Quick Start
Get BeeHex running locally in minutes:Install Dependencies
Install all required npm packages:This will install:
- Next.js 14.2.20 (React framework)
- Socket.IO Client 4.7.5 (real-time communication)
- TypeScript 5.x (type safety)
- Styled Components 6.1.13 (styling)
- ECharts 5.6.0 (data visualization)
- And other dependencies
Configure Environment
Create your environment configuration file:Add your environment configuration:
src/env/env.ts
The
IP_HOST variable points to your game server. For local development, use 127.0.0.1 or localhost.Start Development Server
Environment Configuration
Environment Variables
BeeHex uses a custom environment configuration system located insrc/env/env.ts:
Required Configuration
| Variable | Description | Default | Required |
|---|---|---|---|
IP_HOST | Game server IP address for WebSocket connections | 127.0.0.1 | Yes |
Using Environment Variables
Import the configuration in your components:Project Structure
Understanding the BeeHex codebase organization:Available Scripts
BeeHex includes several npm scripts for development and production:Script Details
| Script | Command | Description |
|---|---|---|
dev | next dev | Starts development server on port 3000 with hot reload |
build | next build | Creates optimized production build |
start | next start | Runs production server (requires build first) |
lint | next lint | Runs ESLint with Next.js configuration |
TypeScript Configuration
BeeHex uses TypeScript with strict mode enabled for type safety:Main Configuration (tsconfig.json)
Web Worker Configuration (tsconfig.worker.json)
BeeHex uses Web Workers for game algorithm calculations:
public/workers/ for client-side execution.
Next.js Configuration
Configuration File (next.config.mjs)
React Strict Mode is disabled to prevent double-rendering issues with WebSocket connections and game state management.
Key Features
- App Router: BeeHex uses Next.js 14’s App Router for file-based routing
- Dynamic Routes: Game pages use dynamic routes (
hex/[gameId]) - Server Components: Leverages React Server Components for optimal performance
- Font Optimization: Automatic optimization for Nunito and Noto Sans fonts
Development Workflow
Make Changes
Edit files in
src/app/ or src/components/Changes hot-reload automatically in your browserTest Your Changes
Open http://localhost:3000 and verify your changes
Common Issues
Port Already in Use
If port 3000 is already in use:Module Not Found
If you see module resolution errors:WebSocket Connection Failed
If WebSocket connections fail:- Verify
IP_HOSTinsrc/env/env.tsis correct - Ensure the game server is running on port 3002
- Check browser console for connection errors
TypeScript Errors
If you encounter TypeScript errors:IDE Setup
VS Code (Recommended)
Recommended extensions:- ES7+ React/Redux/React-Native snippets: Code snippets
- TypeScript Vue Plugin (Volar): Enhanced TypeScript support
- ESLint: Real-time linting
- Prettier: Code formatting
- Error Lens: Inline error display
VS Code Settings
Create.vscode/settings.json:
Next Steps
Architecture Overview
Learn about BeeHex’s technical architecture
Contributing
Start contributing to the project
Deployment
Deploy BeeHex to production
Game Engine
Explore the game engine implementation