Connect a game
Point the game library at your server: project, public key and base URL.
sbox Network Storage Server speaks the same HTTP API as the managed service at sbox.cool. The published s&box client library works without changes: you only change its base URL.
- s&box library: https://sbox.game/sboxcool/network-storage
- Client source: https://github.com/sbox-cool/sbox-network-storage
- API and library docs: https://sbox.cool/wiki/network-storage-v3
The client appends the API version itself (/v3/...), so the base URL is just
the scheme, host and port of your server, with no path and no trailing slash.
1. Find your server URL
| How players reach the server | Base URL |
|---|---|
Domain with HTTPS (tls.mode = acme or certificate, or a reverse proxy) |
https://ns.example.com |
| Domain over plain HTTP | http://ns.example.com:8080 |
| Public IP and port | http://203.0.113.10:8080 |
| Same machine as the game (development) | http://localhost:8080 |
Check the server responds from the machine running s&box:
curl -i http://your-server:8080/health
curl http://your-server:8080/v3/server-info
Make sure the port is open in your firewall and forwarded on your router if the server is behind NAT.
2. Create a project and API keys
Use the local-owner dashboard, or run the CLI on the server:
sbox-ns project create "My Game" # prints the project ID
sbox-ns key create <projectId> --type public --label game
sbox-ns key create <projectId> --type secret --label editor
3. Configure the editor
- Open your game in the s&box editor.
- Open Editor > Network Storage > Setup.
- Enter the Project ID, Public API Key and Secret Key from step 2.
- Set Base URL to your server URL from step 1.
- Leave CDN URL empty unless you serve a CDN in front of your server.
- Save, then use Editor > Network Storage > Sync Tool to push YAML Source
definitions for collections, endpoints and workflows (
.ymlpreferred;.yamlalso accepted).
The Setup window stores the base URL in your project's Network Storage
credentials, and the generated config is picked up automatically by
NetworkStorage.AutoConfigure() at runtime.
4. Or configure in code
NetworkStorage.Configure( projectId, publicKey, "https://ns.example.com" );
Configure also accepts an optional API version and CDN URL, exactly as with the
managed service. Only pass the public API key in game code; the secret key
belongs in the editor only.
Client reachability
Whether s&box allows game clients to call a given kind of URL has not been tested yet against a self-hosted server. Every row below is untested. Please report what works for you in an issue so this table can be filled in.
| Server URL type | Example | Status |
|---|---|---|
| HTTPS domain | https://ns.example.com |
untested |
| HTTP domain | http://ns.example.com:8080 |
untested |
| IP address and port | http://203.0.113.10:8080 |
untested |
| localhost | http://localhost:8080 |
untested |
If plain HTTP or bare IP addresses turn out to be blocked by the s&box sandbox, put the server behind a reverse proxy with a real domain and a TLS certificate (see self-hosting.md).
Moving an existing project from the managed service
- Create the project and keys on your server with
sbox-ns project createandsbox-ns key create. - Point the editor Setup window at your server (above) and sync your
Editor/Network Storage/source files with the Sync Tool to recreate collections, endpoints and workflows. - Publish a new build of your game.
Player data stored on the managed service is not copied by syncing. Moving existing player records is not covered by this guide yet. The synced sources describe schemas and server-side logic, not player save files. Runtime records live in your server's SQLite or PostgreSQL database.
Players running an older build keep talking to whichever server that build was configured for.