Not translated yet — showing English.
Deploying with the CLI
You ship source, not containers. The CLI bundles your code with its platform.json and uploads it; the platform builds and runs it, so there is no Docker on your machine except for game servers on machine pools. Everything here runs inside a signed-in session, see Command Line Interface.
Quick start
From nothing to a deployed function:
playserv init --solution Acme --function hello-fn --kind cloud_function
cd Acme
playserv publish --dry-run
playserv publish --yes
playserv functions logs hello-fn --tail 50
init needs no sign-in and creates nothing on the platform; the function appears at its first deploy. publish finds every platform.json in the solution and deploys each function the same way functions deploy deploys one.
Languages
Functions can be written in C#, JavaScript, Python or Go; game servers in C# or JavaScript.
| Kind | C# (csharp) | JavaScript (node) | Python (python) | Go (go) |
|---|---|---|---|---|
cloud_function | ✓ | ✓ | ✓ | ✓ |
game_server | ✓ | ✓ | — | — |
When --language is left out, the CLI detects it: a .csproj means C#, package.json means JavaScript, go.mod means Go, and requirements.txt or main.py means Python; a single file is detected by its extension. With no marker it assumes C#. init scaffolds C# only; projects in the other languages are written by hand.
A C# function implements IPlatformFunction from the PlayServ SDK. A function in another language is a plain HTTP server that listens on $PORT and answers with JSON. These are complete, deployable functions:
using PlayServ.Sdk;
namespace HelloFunc;
public class Hello : IPlatformFunction
{
public Task<FunctionResponse> HandleAsync(FunctionRequest req, CancellationToken ct = default)
=> Task.FromResult(FunctionResponse.Json(new { message = "hello from playserv" }));
}const http = require('http');
const port = process.env.PORT || 8080;
http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ message: 'hello world' }));
}).listen(port);TypeScript works too: point --src at a folder with package.json, tsconfig.json and src/index.ts. The platform transpiles it during the build without type-checking, so run tsc in your own CI.
import json, os
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
class Handler(BaseHTTPRequestHandler):
def _respond(self):
data = json.dumps({"message": "hello world"}).encode()
self.send_response(200)
self.send_header("Content-Type", "application/json")
self.end_headers()
self.wfile.write(data)
do_GET = do_POST = _respond
ThreadingHTTPServer(("", int(os.environ.get("PORT", "8080"))), Handler).serve_forever()package main
import (
"encoding/json"
"net/http"
"os"
)
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]string{"message": "hello world"})
})
http.ListenAndServe(":"+port, nil)
}The manifest: platform.json
Every function directory carries a platform.json: the function's identity and bindings, committed to git. publish also uses it to find functions.
{
"name": "hello-fn",
"kind": "cloud_function",
"language": "csharp",
"auth": "player",
"execute": { "client": true, "server": true, "backend": false },
"env": { "GREETING": "hi" },
"secrets": ["STRIPE_API_KEY"],
"triggers": [ { "type": "scheduled", "cron": "0 5 * * *" } ]
}
| Field | Meaning |
|---|---|
name | Required. The slug: lowercase letters, digits and dashes, 3–50 characters, starting with a letter, with no trailing or double dashes. |
kind | Required. cloud_function or game_server. |
language | Required. csharp, node, python or go. |
entry | The handler type, for example MyNamespace.Server. Required for a C# game server; the scaffold writes it. |
description | Optional free text. |
sdk_version | The SDK version to build against when the project file pins none. A version the .csproj pins wins. |
auth | player (the default): a game calling with a client key must have a signed-in player, or gets 401 player_auth_required. none: no player needed. Calls with a server key aren't affected. Every call needs an API key. |
execute | Who may call the function at all: client, server, backend, each true or false. A denied caller gets 403 function_execute_forbidden. Subjects left out are allowed. |
env | Plain environment variables. Names starting with PLAYSERV_ or PLATFORM_ are reserved. |
secrets | The names of the secrets the function needs; values are set with playserv secrets set. |
scaling | policy, min_replicas, max_replicas, desired_replicas: the same spec functions scale sets. |
triggers | Extra triggers, such as cron schedules. |
The file may contain // comments and trailing commas. Validation is strict and the same everywhere: a malformed file fails with invalid_bundle, a broken rule with invalid_manifest, and --dry-run runs the local checks without uploading.
Deploy one function
playserv functions deploy --slug <slug> --kind cloud_function|game_server [--src <dir>] [--language <lang>] \
[--tag <tag>] [--poll-timeout <s>] [--dry-run | --detach]
| Option | Default | Meaning |
|---|---|---|
--slug | required | The function's name on the platform. |
--kind | required | cloud_function or game_server. |
--src | . | A directory, or a single source file. |
--language | detected | See Languages. |
--tag | — | Deploys under a named version, see Version tags. |
--poll-timeout | 1200 s | How long the CLI waits for the upload and build. The build continues on the platform if the CLI stops waiting. |
--dry-run | — | Validates everything that can be checked locally and prints what would upload. Nothing is uploaded. |
--detach | — | Returns as soon as the upload is accepted and prints the deploy id. Can't be combined with --dry-run. |
The bundle is everything under --src except bin/, obj/, .git/, .vs/, .idea/, node_modules/ and any file whose name starts with .env. Shared projects referenced from outside --src are bundled automatically.
| Outcome | Exit code | Meaning |
|---|---|---|
| deployed | 0 | Live. The CLI prints the function's address. |
| detached | 0 | --detach: the upload was accepted. Check later with functions deploys get <id>. |
| upload refused | 2 | The platform rejected the bundle. |
| build failed | 3 | The message says why; functions logs has the rest. |
| timeout | 4 | The CLI stopped waiting; the build may still finish. |
| session expired | 5 | The session ran out while waiting; the deploy id is printed. |
Publish the whole solution
playserv publish [--src <path>] [--solution-path <file>] [--only <slug>]... [--tag <tag>] \
[--parallel N] [--poll-timeout <s>] [--dry-run] [--yes]
publish finds every directory with a platform.json under the solution, compares the list with what is deployed in the environment, prints the plan and asks for confirmation. It then deploys each function, up to --parallel at a time (default 1). Pass --yes in CI. The command exits 1 if any function failed; retry just that one with --only <slug>.
Version tags
--tag <tag> on functions deploy or publish deploys a version next to the untagged latest. Normal traffic keeps going to latest; a caller selects the tagged version with the X-Playserv-Function-Version: <tag> header. An unknown tag returns 404 function_version_not_found, with no fallback to latest. Redeploying a tag re-points it.
A tag is 3–22 lowercase letters, digits and dashes, starting with a letter and ending with a letter or digit. A typical use is to ship --tag ver2-canary, point a test client at it, and deploy the same code untagged once it holds.
Call a function
From a Unity game, call a function with PlayServCode.CallAsync, see Cloud Functions & RPC. The calls below are for your own tools and servers.
Deployed functions answer at /fn/<slug> on the platform and are called with a runtime credential, not the CLI session. From a server, use a server key:
curl -X POST <platform-url>/fn/<slug> \
-H "Authorization: Bearer sk_..." \
-H "Content-Type: application/json" \
-d '{"n":5}'
On behalf of a player, use a client key plus the player's session token:
curl -X POST <platform-url>/fn/<slug> \
-H "X-PlayServ-Client: pk_..." \
-H "Authorization: Bearer <player-jwt>" \
-H "Content-Type: application/json" \
-d '{"n":5}'
Which shape a function accepts depends on its auth and execute settings.
Game servers
A game server ships in one of three ways, matching how it runs (see Servers).
| Runs on | How you ship it |
|---|---|
| PlayServ on Cloud Run | playserv functions deploy --kind game_server or publish, like any function. C# or JavaScript. |
| A PlayServ machine pool | playserv image push --slug <slug> --tag <version> --roll builds a linux/amd64 image, pushes it to the project's registry and rolls the pool onto it. Needs Docker with buildx. A C# game server needs no Dockerfile: the CLI writes one. |
| Your own machines | playserv functions declare <slug> --kind game_server registers it without any build, so its rooms can register right away. --hosting-mode multi-room (default) or process-per-room. |
Create the pool first, and keep pooled servers out of publish
image push --roll doesn't create a machine pool: if the game server has none in the environment, the image is pushed and the command fails with pool_not_found. Create the pool on the game server's Hosting tab in Servers. And leave a pooled game server out of publish with --only: a Cloud Run build would take it off the pool.
Room settings can also be set from the terminal, the same ones as in Servers → Room settings. rooms config set replaces the whole configuration, so every option except --idle-timeout is required:
| Option | Range | Meaning |
|---|---|---|
--capacity | 1–1000 | Players per room. |
--reservation-ttl | 1–60 s | How long a matchmaking reservation holds a seat. |
--lifetime | ≥ 0 s | Maximum room lifetime; 0 means no limit and then requires --idle-timeout. |
--idle-timeout | ≥ 1 s | Closes a room after this long with no players. Leave it out to unset it. |
--max-rooms | 1–10000 | Rooms this game server may run at once. |
rooms config get shows the current settings, and rooms config delete removes them; deleting is refused while any room is registered.
Next steps
- Command Line Interface — sign-in, every command, exit codes and errors
- Functions — deployed functions, their logs and settings in the Backoffice
- Servers — fleets, machine pools and room settings
Last updated on 14 Oct 2026