Prerequisites
Before you begin, ensure you have the following installed:- npm v10.9.2 or higher - Download npm
- Git - For cloning the repository
- Modern web browser - Chrome, Firefox, Edge, or Safari
OpenFront is a browser-based game with both client and server components. This guide covers setting up the full development environment.
Installation
Running the development server
Full stack development
Start both the client and server with live reloading:- Starts the Vite development server for the client
- Launches the game server with development settings
- Opens the game in your default browser automatically
- Enables hot module reloading for rapid development
To prevent the browser from opening automatically, set the environment variable:
- Client:
http://localhost:5173(Vite default) - Server:
http://localhost:3000(Master server) - Workers: Ports assigned by
config.workerPortByIndex(workerId)
Client only development
Run just the frontend with hot reloading:- Working on UI components only
- Testing visual changes
- Developing client-side features
Server only development
Run just the backend with development settings:- Testing game logic
- Debugging server issues
- Working on API endpoints
Connecting to remote backends
Staging environment
Connect your local client to staging API servers:- Test against staging data
- Verify user profiles and authentication
- Debug purchase flows
Production environment
Connect your local client to production API servers:Project structure
Understanding the codebase organization:Key directories:
/src/client- All frontend React/Lit components and game rendering/src/core- Game mechanics shared between client and server/src/server- Server logic, networking, and game state management/resources- Contains 40+ maps and all game assets
Development tools
Code formatting
Format all files using Prettier:- Prettier for code formatting
- Plugin for organizing imports
- Plugin for shell script formatting
Linting
Check for code issues:- ESLint 9 with TypeScript support
- Prettier integration for consistent formatting
- GitHub Actions formatter for CI output
Testing
Run the full test suite:- Unit tests with Vitest
- Server integration tests
Performance testing
Run performance benchmarks:Building for production
Development build
- TypeScript type checking
- Source maps for debugging
- Development mode optimizations
Production build
- Type checking enforced (fails on errors)
- Minification and tree shaking
- Production optimizations
The build process uses Vite for fast compilation and Concurrent execution for parallel TypeScript checking.
Map generation
OpenFront uses a Go-based map generator:View map generator documentation
Generate new maps
- Runs the Go map generator (
cd map-generator && go run .) - Formats the output with Prettier
Format map generator code
Git hooks
The project uses Husky for Git hooks with lint-staged:- Pre-commit: Automatically runs ESLint and Prettier on staged files
- Validation: Ensures code quality before commits
npm run inst.
Contributing to development
Before you start
Join the Discord
Request to join the development Discord server to coordinate with the team.
Understand the contribution path
OpenFront uses a progressive contribution system:
- New contributors: Limited to UI improvements and small bug fixes
- Established contributors: Can work on complex features after several successful PRs
- Core contributors: May modify critical game systems with extensive project experience
Code quality requirements
Pull request process
- Fork the repository on GitHub
- Create a feature branch:
git checkout -b amazing-feature - Make your changes following the code style
- Test thoroughly on multiple browsers if applicable
- Commit with clear messages:
git commit -m 'Add amazing feature' - Push to your fork:
git push origin amazing-feature - Open a pull request with:
- Description of changes
- Screenshots for UI changes
- Testing methodology
- Rationale for the change
The project maintainer (evan) has final authority on all code changes. Not all contributions will be accepted - the focus is on long-term project health.
Additional resources
Architecture documentation
Review
docs/Architecture.md for system design detailsAPI documentation
See
docs/API.md for endpoint specificationsAuthentication
Learn about auth flows in
docs/Auth.mdContribution guidelines
Read
CONTRIBUTING.md for detailed contribution rulesTroubleshooting
Port conflicts If you see port already in use errors:- Default client port: 5173 (Vite)
- Default server port: 3000 (Master)
- Worker ports: Dynamically assigned
npm run inst and not npm install:
Getting help
Development Discord
Ask questions and get help from the dev community
GitHub issues
Report bugs or request features
Translation Discord
Join the translation community
Crowdin project
Help translate the game into your language