PlayMesh
GitHub
Open Source · MIT License

Build multiplayer worlds,
not networking infrastructure.

PlayMesh is an open-source multiplayer server framework for Node.js. Real-time networking, session management, presence, and horizontal scaling - so you can focus on the game.

Get Started →How It WorksOfficial Example
$npm install @playmesh/server @playmesh/client
↗ @playmesh/server↗ @playmesh/client
⚡

Real-time networking

Powered by Socket.IO. Handle thousands of concurrent connections with event-driven messaging, instance-scoped sends, request/response, filtered broadcasts, and optional msgpack encoding.

🌐

Horizontal scaling

Add Redis and run as many nodes as you need. Sessions, presence, state, and pub/sub are automatically synchronized across your cluster.

🗺️

Multi-instance sessions

A single player can be in multiple Instances simultaneously - world, guild, party, and global chat all at once.

🔑

Bring your own auth

PlayMesh does not implement authentication. Use JWT, OAuth, API keys, or any custom strategy via a simple hook. Grant roles per session, protect events and topology by role, and add opt-in ECDSA message signing.

🗃️

Runtime state

Per-instance state in three scopes: server-only, public state synced live to every member, and private per-user state synced only to its owner. Batched patches, per-player visibility to stop wall-hacks, atomic increment and compare-and-set, revision-ordered sync with gap recovery, Redis-backed in distributed mode.

⚙️

Background queues

BullMQ-powered queues built in. Use them for matchmaking, delayed tasks, event pipelines, and background processing.

Clear hierarchy, simple API

PlayMesh organizes multiplayer environments in a three-level hierarchy.

Universe (PlayMesh)
├── Domain - world, lobby, ranked, social
├── Instance - dungeon, match, city
└── Instance - guild hall, trade hub
└── Domain - matchmaking
Sessions join Instances and can be in multiple at once

Up in minutes

A multiplayer chat server in under 30 lines.

◆server.ts
import { PlayMesh } from '@playmesh/server';

const mesh = new PlayMesh({ port: 4000 });

mesh.onAuthenticate(async req => ({
  userId: String(req.auth.username),
}));

mesh.bootstrap(async ({ mesh }) => {
  const lobby = mesh
    .createDomain('social')
    .createInstance('lobby');

  lobby.on('chat', (session, payload) => {
    lobby.broadcast('chat', {
      sender: session.userId,
      message: payload.message,
    });
  });
});

mesh.onAdmission(async () => ({
  instances: ['social/lobby'],
}));

await mesh.start();
◆client.ts
import { PlayMeshClient } from '@playmesh/client';

const client = new PlayMeshClient({
  url: 'http://localhost:4000',
  auth: { username: 'alice' },
});

client.on('chat', payload => {
  console.log(
    `${payload.sender}: ${payload.message}`
  );
});

const session = await client.connect();
console.log('Joined:', session.instances);

client.emit('chat', {
  message: 'Hello, world!',
});
Full Getting Started guide →

You build the game. We handle the network.

PlayMesh is infrastructure, not a framework that owns your business logic.

CapabilityPlayMeshYour App
Socket communication✓
Session management✓
Presence tracking✓
Synced state replicas✓
Request/response messaging✓
Atomic state operations✓
Chat with moderation✓
Rate limiting with kick escalation✓
Visibility filtering (anti-wallhack)✓
Server-driven room moves✓
Matchmaking helper✓
Admin inspection & controls✓
Machine-readable error codes✓
Role-based access control✓
Distributed messaging✓
Multi-node support✓
Redis infrastructure✓
Queue infrastructure✓
Authentication logic✓
Databases & persistence✓
Game logic✓
Economy & inventory✓