Monorepo Overview
KYBER is developed using a monorepo structure that contains multiple projects and shared packages. This approach allows for:- Unified versioning and dependency management
- Shared code across multiple components
- Simplified development workflow
- Coordinated releases
Component Architecture
Module (C++)
The Module is the core component that gets injected into the STAR WARS Battlefront II game client.Technology Stack
- Language: C++11
- Build System: Bazel
- Platform: Windows (MSVC)
- IDE: Visual Studio Code with clangd
Key Responsibilities
- Game memory manipulation and hooking
- Custom game logic injection
- Communication with API service via gRPC
- Crash reporting via Sentry integration
- WebSocket communication for real-time features
Architecture Patterns
Memory Management
- Uses game’s native memory arenas instead of standard heap allocation
- Arena-specific allocation for client vs server contexts
- EASTL containers for STL replacements
Thread Safety
- Uses
ThreadExecutorfor game logic interaction from non-main threads Mutex<>wrapper for fields accessed from multiple threads
Function Hooking
- Hook Manager system for intercepting game functions
- Suffix
Hkfor all hooked functions - Trampoline pattern for calling original implementations
Third-Party Dependencies
- Zydis: x86/x64 disassembler
- Sentry: Crash reporting
- IXWebSocket: WebSocket client/server
- ImGui: Debug UI
- spdlog: Logging
- fmt: String formatting
Launcher (Flutter/Dart)
The Launcher is a cross-platform desktop application that serves as the primary user interface.Technology Stack
- Framework: Flutter (master channel)
- Language: Dart
- Platforms: Windows, macOS, Linux
- State Management: Bloc/Cubit
- Dependency Injection: GetIt
- FFI: Rust via flutter_rust_bridge
Feature-Based Architecture
The Launcher follows a clean architecture with feature-based organization:State Management
- Cubits for feature-level state management
- Located in
providers/with_cubit.dartsuffix - State classes defined alongside cubits
BlocBuilderfor UI rebuildsBlocListenerfor side effects
Dependency Injection
- GetIt service locator via global
slinstance - Services registered in
injection_container.dart - Singleton pattern for shared services
- Async initialization support
Naming Conventions
| Type | Pattern | Example |
|---|---|---|
| Cubits | <Feature>Cubit | ServerBrowserCubit |
| States | <Feature>State | KyberStatusState |
| Services | <Feature>Service | ModService |
| Helpers | <Feature>Helper | MaximaHelper |
| Screens | <Feature> | ServerBrowser |
CLI (Flutter/Dart)
Command-line interface tools for server management and automation.Technology Stack
- Framework: Flutter CLI support
- Language: Dart
- FFI: Rust via flutter_rust_bridge
- Build Output: Native executable
Key Features
- Server management commands
- Automated deployment
- Configuration management
- Integration with Maxima service
Dependencies
- maxima-service: Background service for server operations
- maxima-bootstrap: Bootstrapper for CLI operations
- rust_lib: Native Rust library for performance-critical operations
API (Go)
Backend service providing REST and gRPC APIs.Technology Stack
- Language: Go 1.24+
- Communication: gRPC, REST
- Protocol Buffers: For service definitions
Project Structure
Key Responsibilities
- User authentication and authorization
- Server registry and matchmaking
- Statistics and leaderboards
- Mod repository management
- WebSocket gateway for real-time updates
Proxy (Rust)
High-performance proxy for server connections.Technology Stack
- Language: Rust (nightly)
- Build System: Cargo
- Protocol Buffers: For communication protocols
Key Responsibilities
- Connection proxying and load balancing
- Protocol translation
- Traffic monitoring and logging
- DDoS mitigation
Packages (Dart)
Shared Dart packages used across Launcher and CLI.Package Structure
Workspace Management
Managed via Melos for:- Unified dependency management
- Code generation coordination
- Cross-package versioning
- Shared build scripts
Communication Architecture
Module ↔ API Communication
- Protocol: gRPC over HTTP/2
- Definition: Protocol Buffers in
Module/Proto/ - Services:
kyber_api.proto: API service definitionskyber_interface.proto: Interface contractskyber_common.proto: Shared message typesmod_bridge.proto: Mod system integration
Launcher/CLI ↔ API Communication
- Protocol: gRPC (generated from Module proto files)
- Bindings: Generated via
protocduringmelos bootstrap - Location:
Packages/kyber/lib/gen/
Real-Time Features
- WebSocket: IXWebSocket library for bi-directional communication
- Use Cases:
- Live server status updates
- In-game notifications
- Chat systems
- Match coordination
Build System Integration
Melos Workspace
The rootpubspec.yaml defines Melos scripts for coordinated builds:
Key Melos Scripts
melos bootstrap: Initialize all packages and generate codemelos generate: Run build_runner across packagesmelos generate_proto: Generate Dart bindings from proto filesmelos generate_frb: Generate FFI bindings for Rustmelos build_launcher: Build Launcher releasemelos build_cli: Build CLI with dependencies
Protocol Buffer Flow
Development Workflow
Initial Setup
Build component of interest
See Building KYBER for component-specific instructions
Common Development Tasks
Updating Protocol Buffers
- Modify
.protofiles inModule/Proto/ - Regenerate bindings:
Adding FFI Functions
- Update Rust code in
Launcher/rust/orCLI/rust/ - Regenerate bindings:
Module Development Cycle
- Make changes to C++ code
- Build:
bazel --output_user_root="C:\bz" build --config=release Kyber - Copy DLL:
copy Module\bazel-bin\Kyber.dll C:\ProgramData\Kyber\Module\Kyber.dll - Test with Launcher or CLI
Code Standards
Each component maintains its own coding standards. See STANDARDS.md for:- Module: C++11 conventions, hook patterns, memory management
- Launcher: Dart/Flutter best practices, feature architecture
- API: Go idioms and project structure
- Proxy: Rust conventions
Next Steps
Building KYBER
Detailed build instructions for each component
Contributing
Guidelines for contributing to the project