Info
- How the parts of Polis fit together, for anyone who writes code for it or runs it
- Details live on the linked pages. This page is the map
The parts
flowchart TB
App["Polis app"]
Browser["Browser<br/>console"]
Host["Session host<br/>app or headless server"]
Relay["PurrLay relay"]
CI["TeamCity CI"]
Hub["Service Hub<br/>API + console"]
LiveKit["LiveKit<br/>streaming, data, RPCs"]
GlitchTip["GlitchTip<br/>crash reports"]
Store[("PostgreSQL<br/>+ files")]
App <==>|"PurrNet game sync"| Host
App <==>|"behind NAT"| Relay <==> Host
App -->|"API"| Hub
Browser --> Hub
Host -->|"login, lobby"| Hub
CI -->|"uploads"| Hub
Hub <-->|"rooms, webhooks"| LiveKit
Hub --- Store
Hub -->|"reads"| GlitchTip
App <==>|"LiveKit sync"| LiveKit
Browser <-.->|"streams"| LiveKit
App -.->|"crashes"| GlitchTip
- Polis apps - Unity 6 apps for Quest, PC and phones. Each is a project built on Polis Core (shared code,
Packages/PolisCore) and the XR Content Kit (shared prefabs, UI, avatars, Packages/PolisXrContentKit). Project files live in Assets/_Projects/<Project>. See Unity Core
- Multiplayer - PurrNet. One app hosts a session (Host mode) or a headless server build runs it (Server mode), the others join as clients. Clients connect over UDP directly, or through our PurrLay relay. Sessions are found through the Service Hub lobby, the local network or a join code. See Networking and Running a Headless Server
- Service Hub - one ASP.NET Core app with PostgreSQL. It serves the REST API for apps and game servers, the web console for people, and public pages (the Apps download page, terms, privacy, device sign-in). See Service Hub and API
- Service Hub SDK - the Unity client of the API inside Polis Core: sign-in, save data, lobby, content, releases, streaming, crash reports, analytics, terms. See Service Hub SDK
- Optional services - Lobby, Servers, Streams, Save data, Content, Releases, Crash reports and Analytics are switched on per app in the console. An app with a service off keeps working without it
- LiveKit - the second sync channel next to PurrNet, both ways: streaming (shared views, presenters, displays, in the apps and the console), data and RPCs. Service Hub tracks who is in which session (presence), controls the rooms, hands out stream tokens and gets LiveKit's webhooks
- Crash reports - the Sentry SDK in the apps sends to GlitchTip, which the console shows per app
- CI - TeamCity builds the Unity apps and uploads builds and content updates to Releases with an upload key. See JetBrains TeamCity
- Hosting - Service Hub, LiveKit, GlitchTip, monitoring (Prometheus, Grafana) and the admin tools run with Docker Compose behind Traefik, deployed by GitHub Actions. See Operations
What happens when a player joins
- The app starts from its root scene. The App Loader loads the managers and services, see App Loader
- The Service Hub SDK checks the stored sign-in in the background. Without one it signs in anonymously (Anonymous Login By Default in
ServiceHubSettings, on by default), unless the user logged out
- Release content asks Releases for the app's channel and downloads newer content if there is any, see Release Content
- The server list fills from the lobby, the local network, a typed address or a join code
- PurrNet connects to the host directly over UDP, or through the relay