Prerequisites
Before you begin, ensure you have the following installed:Node.js
Recent version (LTS recommended)
npm
Version 10.9.2 or higher
Git
For version control
Modern Browser
Chrome, Firefox, Edge, or Safari
Installation
Fork the Repository
Go to github.com/openfrontio/OpenFrontIO and click the “Fork” button in the top right.
Running the Game
Full Development Mode
Run both client and server with live reloading:- Starts the Vite dev server on port 9000
- Launches the game server with development settings
- Opens the game in your default browser
- Enables hot module replacement (HMR)
Set
SKIP_BROWSER_OPEN=true in your environment to prevent automatic browser opening.Client Only
Run just the frontend with Vite:http://localhost:9000.
Server Only
Run just the game server:The
start:server-dev script sets GAME_ENV=dev for development-specific behavior.Connecting to Remote APIs
During development, you may want to connect to staging or production API servers for testing authentication, profiles, or replays.Staging API
Connect to staging servers:API_DOMAIN=api.openfront.dev.
Production API
Connect to production servers:API_DOMAIN=api.openfront.io.
Development Workflow
Creating a Branch
Create a feature or bugfix branch:Code Quality Tools
OpenFront enforces code quality using ESLint and Prettier:The project uses Husky and lint-staged to automatically format and lint code before commits.
Building the Project
- Runs TypeScript type checking
- Builds with Vite in development mode
- Outputs to
/staticdirectory
- Runs type checking with
--kill-others-on-fail - Optimizes and minifies code
- Splits vendor chunks for better caching
Project Structure
Development Ports
| Service | Port | Description |
|---|---|---|
| Client (Vite) | 9000 | Frontend development server |
| Main Server | 3000 | Lobby and coordination server |
| Worker 0 | 3001 | Game server instance 1 |
| Worker 1 | 3002 | Game server instance 2 |
Vite proxies WebSocket connections and API requests to the appropriate backend servers.
Environment Variables
Create a.env file in the project root for local configuration:
.env
Additional Tools
Map Generator
OpenFront includes a Go-based map generator:- Runs the map generator in the
/map-generatordirectory - Generates new map data
- Automatically formats the output
Performance Testing
Run performance benchmarks:Troubleshooting
Dependencies not installing correctly
Dependencies not installing correctly
Make sure you’re using
npm run inst instead of npm install. If issues persist, try:Port already in use
Port already in use
If port 9000 or 3000 is already in use, kill the existing process:
TypeScript errors
TypeScript errors
Ensure you’re using the correct TypeScript version:The project uses TypeScript 5.7.2 as specified in
package.json.WebSocket connection issues
WebSocket connection issues
Check that:
- The server is running (
npm run start:server-dev) - Vite proxy configuration is correct in
vite.config.ts - No firewall is blocking local connections
Getting Help
Discord Community
Join the development Discord for help
GitHub Issues
Report bugs or request features
Next Steps
Architecture
Understand OpenFront’s system design
Contributing
Learn how to contribute code
Testing
Write and run tests