PartyKit is a place to run a server. This is the server
PartyKit, now part of Cloudflare, gives each room its own small server running close to the players. You write that server as a class: what happens when someone connects, what to do with each message, what to send back and to whom. It is a clean model and it can be bent into almost anything, which is why it powers collaborative editors as well as games.
For a game, though, that class is where the multiplayer work actually lives. Tracking who is in the room, keeping a copy of every player's state, sending changes to everyone else, handling a player who drops and comes back, deciding what the server trusts: all of it is code you write and maintain.
Here that layer is already built. Rooms are created the first time someone joins. Each player sets fields on their own entity and everyone else receives the change. Room-wide state is one call. You write the game, not the networking.
What a game needs after the first hour
Getting two cursors to move together is the easy part. A game that people come back to needs more, and on PartyKit each of these is a separate piece of work:
- Rules the player's browser cannot fake: here, a short script that runs on the server on a tick, deployed with one call, versioned, with rollback and error logs.
- Players who are still themselves tomorrow: anonymous-first identity, with an optional login so progress survives a new device.
- Saved progress and leaderboards, per game or shared across your games.
- Hosting: publish the game and get a share link, so a friend can join without you setting up a website.
- Analytics on sessions, retention and concurrent players, per game.
If you build with an AI coding agent
Ask an agent like Claude Code to add multiplayer with PartyKit and it has to write a server, a client protocol to match it, and a deploy step, then keep all three in agreement every time the game changes. That is a lot of surface for an agent to get subtly wrong.
Multiplayer Agent connects to the agent directly. The agent creates the game, defines the room, writes a client against the real API, deploys server rules and publishes a share link, all through tool calls. There is no server for it to write, so there is no server for it to get wrong.
Where PartyKit is the better answer
It is the right tool for a lot of projects, and not only non-game ones.
- Collaborative apps rather than games: shared documents, whiteboards, cursors, CRDTs and Yjs. PartyKit is excellent at this, and it is not what we are built for.
- You want to own and read every line of the server, or need a custom wire protocol.
- You are already on Cloudflare and want the realtime piece to live next to your Workers and storage.
- Your rooms need behaviour that does not fit players, shared state and server rules, and you would rather write it than work around a model.
If you want to write a realtime server, PartyKit is a very good place to run one. If you want a multiplayer game and not a server project, start here.
Common questions
Is Multiplayer Agent built on PartyKit?
No. It is its own hosted backend. You do not deploy anything to it except, optionally, small server-side game rules.
How is the pricing different?
PartyKit runs on Cloudflare, so you pay Cloudflare's usage-based pricing for requests, compute time and storage. We bill by monthly active players, which you can estimate from your own traffic and which does not change when your game is busier on a given day.
Can I build a fast real-time game, not just a turn-based one?
Yes. Action games, shooters and .io games are built with client-side prediction and interpolation over a reliable connection, and hit detection or scoring can run in server rules so a client cannot fake it.
Can I move a PartyKit game over?
Usually by deleting code. The server you wrote goes away; the client sets fields on its own player and reads shared state instead of sending custom messages. Rules that must be authoritative move into a server script.
Try it on your own game
The free tier does not expire and asks for no card. Add one script tag and have two people playing in about a minute.