Photon is a network application for Niwer's stuff such as the engine/framework, official content-packs. It also provide the official discord bot, database for anti-cheat reports, crash-reports, accounts & much more.
The main entry point is niwer.photon.PhotonEngine. You can execute the jar itself.
But we recommand to use docker-compose with the suggested config down below :
services:
photon:
image: ghcr.io/<organization_name>/photon:latest
container_name: photon-app
restart: unless-stopped
ports:
- "127.0.0.1:7070:7070"
volumes:
- ./app_data:/photon_server/network/If errors occur, check the logs but it may be due to JNA not being able to load the native library. You can try to run the jar with the following flags to disable JNA unpacking and use a temporary directory for the native library:
java -jar YOUR_JAR_FILE -Djna.nosys=true -Djna.nounpack=true -Djna.tmpdir=/tmpPhoton is configured via a JSON file : network/config.json, which contains settings for the network, database, Stripe integration and more.
-
Database backups
database_backup_enabledcontrols whether the backup system runs at all.database_backup_on_startupcontrols whether a backup is created during startup.database_backup_interval_minutescontrols how often recurring backups run.database_backup_directorycontrols where backup files are written.database_backup_file_prefixcontrols the generated backup filename prefix.
-
Stripe (Checkout & webhooks)
- In
network/config.jsonsetstripe_webhook_signatureto the private signature key from your Stripe dashboard (not the public API key). This is used to verify incoming webhook events from Stripe. - Set
stripe_api_keyinnetwork/config.jsonto enable Stripe checkout session creation.
- In
The routes below are the ones typically called by the game client, launcher, Stripe, or server processes. Admin-panel routes are kept in a separate section.
-
Accounts
POST /accounts/create_account— Create an account.- Required fields:
username,email,password. - Optional purchase flow fields:
tokenorcheckoutSessionId. - If no purchase token is provided, the email must already have an active subscription.
- Required fields:
POST /accounts/auth_account— Log in and return{ token, account }.- Required fields:
email,password.
- Required fields:
GET /accounts/me— Return the current account.- Auth via
X-Photon-User-TokenorAuthorization: Bearer <token>.
- Auth via
POST /accounts/change_password— Change a password.- Body fields:
email,currentPassword,newPassword.
- Body fields:
POST /accounts/update_profile— Update username, email, or password.- Body fields:
uuid,currentPassword, optionalusername,email,newPassword,confirmPassword.
- Body fields:
GET /accounts/licenses— List the caller’s licenses.POST /accounts/licenses— Create a license for the current subscriber.POST /accounts/licenses/revoke— Revoke one of the caller’s licenses.
-
Game / launcher
GET /game/config— Public runtime config used by the client.POST /game/add-crash-report— Upload a crash report.- Required fields:
fileMessage,userUUID,timestamp. - Optional field:
side.
- Required fields:
POST /game/add-anticheat-report— Upload an anti-cheat report.- Required fields:
fileMessage,userUUID,operatingSystem,timestamp.
- Required fields:
POST /game/add-hwid— Register a hardware ID.- Required fields:
hwid,userUUID,operatingSystem.
- Required fields:
POST /licenses/validate— Validate a license key on the client.- Required fields:
license_key,product_id,hardware_id.
- Required fields:
GET /download/mod— Download the current mod package.
-
Servers / status
POST /servers/add-server— Register or update a server entry.- The request IP must match the remote IP.
GET /servers/server-list— List known servers.GET /api/status/servers— Status-oriented server listing used by the web UI.
-
Stripe
POST /stripe/webhook— Stripe webhook endpoint.- Receives subscription events such as
customer.subscription.created,customer.subscription.updated,customer.subscription.deleted. - Also handles
checkout.session.completedfor the purchase-token flow.
- Receives subscription events such as
These routes require an admin session or admin token.
POST /api/admin/loginGET /api/admin/meGET /api/admin/tablesGET /api/admin/tables/{table}GET /api/admin/configPUT /api/admin/configPOST /api/admin/restartPOST /api/admin/updates/upload