Introduction
Nakama is an open-source game server built by Heroic Labs that handles the common backend needs of multiplayer games. Instead of building matchmaking, leaderboards, user accounts, and real-time messaging from scratch, game developers can deploy Nakama and use its client SDKs to integrate these features into Unity, Unreal, Godot, or web-based games.
What Nakama Does
- Manages user accounts, authentication, and social profiles
- Provides real-time multiplayer via WebSockets with authoritative or relayed modes
- Runs matchmaking with custom logic for pairing players
- Maintains leaderboards, tournaments, and in-app notifications
- Supports server-side game logic written in Go, Lua, or TypeScript
Architecture Overview
Nakama is a single Go binary backed by CockroachDB or PostgreSQL for persistent storage. The server exposes gRPC and HTTP/WebSocket APIs that client SDKs connect to. Game-specific server logic runs as registered hooks in Go, Lua, or a bundled TypeScript runtime. Nakama can run as a single instance for development or scale horizontally behind a load balancer for production.
Self-Hosting & Configuration
- Run via Docker with
docker run heroiclabs/nakamafor quick setup - Configure database, ports, and runtime settings via YAML or command-line flags
- Deploy on Kubernetes using the official Helm chart for production clusters
- Write custom server logic in Go plugins, Lua scripts, or TypeScript modules
- Monitor with built-in Prometheus metrics and the web-based admin console
Key Features
- Client SDKs for Unity, Unreal, Godot, JavaScript, Java, Swift, and more
- Authoritative multiplayer where the server validates game state
- Built-in social features: friends, groups, chat channels, and status updates
- Persistent and session storage for player data and game state
- Extensible with server-side hooks for custom matchmaking and game logic
Comparison with Similar Tools
- PlayFab (Microsoft) — managed cloud service with vendor lock-in; Nakama is self-hosted and open source
- Colyseus — Node.js-focused with simpler API; Nakama offers broader engine support and more built-in features
- Photon — proprietary real-time networking; Nakama provides full backend features beyond just networking
- Firebase — general-purpose BaaS; Nakama is purpose-built for games with matchmaking and leaderboards
FAQ
Q: What databases does Nakama support? A: PostgreSQL and CockroachDB for persistent data, with an in-memory layer for real-time session state.
Q: Can Nakama handle thousands of concurrent players? A: Yes. It is designed to scale horizontally and has been used in production titles with large player bases.
Q: Do I need to write server-side code to use Nakama? A: Not necessarily. Many features work out of the box. Custom logic is only needed for game-specific rules like matchmaking criteria or authoritative game loops.
Q: Is Nakama free to use? A: The open-source version under Apache 2.0 is free. Heroic Labs also offers a managed cloud service with additional features.