The KYBER CLI is a powerful Dart-based command-line tool that provides headless server hosting, game launching, and administrative functions for the KYBER platform.
Overview
The CLI enables users to:
Host dedicated game servers without a GUI
Launch the game with custom configurations
Manage authentication and tokens
Download and verify game files
Automate server deployment and management
The CLI is the preferred tool for dedicated server hosting and automation scenarios.
Tech Stack
FFI Bridge Rust via flutter_rust_bridge
CLI Framework args + cli_completion
Key Dependencies
name : kyber_cli
version : 2.0.0-beta9+1
environment :
sdk : ">=3.10.1 <4.0.0"
dependencies :
args : ^2.4.1 # CLI argument parsing
cli_completion : ^0.5.0 # Shell completion
mason_logger : ^0.3.0 # Structured logging
dio : ^5.4.0 # HTTP client
grpc : ^5.0.0 # gRPC client
flutter_rust_bridge : ^2.11 # Rust FFI
sentry : ^9.7.0 # Error tracking
kyber : # Shared KYBER package
path : ../Packages/kyber
kyber_collection : # Collection utilities
path : ../Packages/kyber_collection
executables :
kyber_cli :
Architecture
The CLI uses a command pattern with isolated command handlers:
lib/
├── commands/
│ ├── start_server_command.dart # Host dedicated server
│ ├── start_game.dart # Launch game client
│ ├── get_token.dart # Get KYBER auth token
│ ├── get_ea_token.dart # Get EA auth token
│ └── download_game.dart # Download game files
├── models/
│ └── maxima_instance.dart # Maxima backend model
├── utils/
│ ├── api_service.dart # API client
│ ├── env_helper.dart # Environment configuration
│ └── collection_helper.dart # Data utilities
└── command_runner.dart # Main CLI runner
Entry Point
bin/kyber_cli.dart
lib/command_runner.dart
import 'dart:async' ;
import 'dart:io' ;
import 'package:kyber_cli/command_runner.dart' ;
import 'package:kyber_cli/gen/frb_generated.dart' ;
import 'package:sentry/sentry.dart' ;
Future < void > main ( List < String > args) async {
// Initialize Rust FFI bindings
await RustLib . init ();
await runZonedGuarded (() async {
// Initialize error tracking
await Sentry . init ((options) {
options.dsn = 'https://[email protected] /5' ;
});
// Run CLI command
await _flushThenExit ( await KyberCliCommandRunner (). run (args));
}, (exception, stackTrace) async {
await Sentry . captureException (exception, stackTrace : stackTrace);
print ( 'Error: $ exception ' );
exit ( 1 );
});
}
Future < void > _flushThenExit ( int status) {
return Future . wait < void >([
stdout. close (),
stderr. close (),
]). then < void >((_) => exit (status));
}
Commands
Start Server
Host a dedicated game server:
kyber_cli start-server \
--name "My KYBER Server" \
--region "US-West" \
--max-players 40 \
--map "Naboo" \
--mode "Supremacy"
Start Game
Launch the game with custom settings:
kyber_cli start-game \
--profile "MyProfile" \
--server-id "abc123"
Get Token
Obtain authentication tokens:
Output: Token: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...
Expires: 2026-03-04T12:00:00Z
Output: EA Token: QVQxOjEuMDo...
Persona ID: 1234567890
Download Game
Download game files from EA servers:
kyber_cli download-game \
--output-dir "C:/Games/Battlefront2" \
--verify
Building
Prerequisites
Install Dart SDK
Install Dart 3.10 or later: # Windows (Chocolatey)
choco install dart-sdk
# macOS (Homebrew)
brew install dart
# Linux (apt)
sudo apt install dart
Install Rust
Install Rust nightly toolchain: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup toolchain install nightly
Bootstrap Workspace
cd ~/workspace/source
dart pub global activate melos
melos bootstrap
Build Commands
Compile Binary
Using Dart Build
cd CLI
# Install dependencies
flutter pub get
# Generate FFI bindings
flutter_rust_bridge_codegen generate
# Compile to native binary
dart compile exe bin/kyber_cli.dart -o kyber_cli
Output: CLI/kyber_cli (or kyber_cli.exe on Windows) cd CLI
dart build cli bin/kyber_cli.dart
Output: build/cli/<platform>/bundle/bin/kyber_cli
Deployment
After building, copy the Rust library from build/cli/<platform>/bundle/lib/ next to the binary.
Required files next to kyber_cli.exe: kyber_cli.exe
kyber_cli_rust.dll
maxima-service.exe
maxima-bootstrap.exe
Required files next to kyber_cli: kyber_cli
libkyber_cli_rust.so
maxima-bootstrap
Configuration
Environment Variables
# API Configuration
KYBER_API_URL = https://api.kyber.gg
KYBER_API_GRPC_PORT = 9027
# Game Configuration
GAME_INSTALL_PATH = C:/Program Files (x86)/Star Wars Battlefront II
KYBER_DATA_DIR = C:/ProgramData/Kyber
# Logging
LOG_LEVEL = info # Options: error, warn, info, verbose, debug
# Maxima Backend
MAXIMA_PORT = 3216
MAXIMA_USE_HTTPS = false
Config File
Create ~/.kyber/config.yaml:
server :
default_name : "My Server"
default_region : "US-East"
default_max_players : 40
game :
install_path : "C:/Games/Battlefront2"
launch_args : [ "-fullscreen" , "-high" ]
api :
url : "https://api.kyber.gg"
timeout : 30s
Advanced Usage
Server Automation
Create a systemd service for auto-restart:
/etc/systemd/system/kyber-server.service
[Unit]
Description =KYBER Dedicated Server
After =network.target
[Service]
Type =simple
User =kyber
WorkingDirectory =/opt/kyber
ExecStart =/opt/kyber/kyber_cli start-server \
--name "24/7 Supremacy" \
--region "US-East" \
--mode "Supremacy"
Restart =always
RestartSec =10
[Install]
WantedBy =multi-user.target
Enable and start:
sudo systemctl enable kyber-server
sudo systemctl start kyber-server
Scripting
Automate server rotation:
#!/bin/bash
MAPS = ( "Naboo" "Hoth" "Endor" "Tatooine" )
for map in "${ MAPS [ @ ]}" ; do
echo "Starting $map rotation..."
kyber_cli start-server \
--name "Map Rotation - $map " \
--map " $map " \
--mode "Supremacy" \
--max-players 40 &
sleep 3600 # 1 hour per map
# Graceful shutdown
killall kyber_cli
sleep 10
done
Shell Completion
Enable auto-completion:
# Generate completion script
kyber_cli completion bash > /etc/bash_completion.d/kyber_cli
# Or for current user
kyber_cli completion bash > ~/.local/share/bash-completion/completions/kyber_cli
# Add to ~/.zshrc
eval "$( kyber_cli completion zsh)"
kyber_cli completion fish > ~/.config/fish/completions/kyber_cli.fish
Logging
Structured logging with mason_logger:
_logger. info ( 'Server starting...' );
_logger. success ( 'Server started successfully!' );
_logger. warn ( 'Low player count: 5/40' );
_logger. err ( 'Failed to connect to API' );
_logger. detail ( 'Debug information: $ data ' );
Log output format:
[2026-03-03 14:30:15] [info] - Server starting...
[2026-03-03 14:30:20] [success] - Server started successfully!
[2026-03-03 14:32:10] [warn] - Low player count: 5/40
Troubleshooting
Ensure the Rust library is in the same directory as the CLI binary: # Copy from build output
cp build/cli/linux-x64/bundle/lib/libkyber_cli_rust.so .
Verify Maxima binaries are present: # Check files
ls -la maxima- *
# Test Maxima directly
./maxima-bootstrap
Check network and API availability: # Test API connectivity
curl https://api.kyber.gg/health
# Check environment variables
echo $KYBER_API_URL
Binary size: ~15MB (compiled)
Memory usage: ~50MB (idle), ~200MB (running server)
Startup time: <1 second
CPU usage: Minimal (event-driven I/O)
Launcher - GUI alternative to CLI
API - Backend services consumed by CLI
Module - Game module loaded by CLI