MMORPG entries
WhenRPG_TYPE=mmorpg, RPGJS now treats your project as a multi-entry application:
- a browser client
- a framework-agnostic server module
- optional hosting adapters such as Express
- Vite development
- Express in production
- another Node host such as Fastify or Hono
- a custom deployment target later
Recommended structure
Keep your game logic insrc/server.ts, and put host-specific bootstraps in src/entries.
src/client.ts: browser entry formmorpgsrc/server.ts: RPGJS server module, withoutexpress(),listen(), or platform codesrc/entries/express.ts: Node entry that mountssrc/server.tsin Expresssrc/standalone.ts: browser entry forRPG_TYPE=rpg
Configure rpgjs()
Declare the MMORPG entries explicitly in your Vite config.
Keep src/server.ts agnostic
src/server.ts should export your RPGJS server module and nothing else.
It should not:
- create an HTTP server
- call
listen() - import Express directly
- depend on a specific host runtime
Express adapter example
Put your Express bootstrap insrc/entries/express.ts.
- serving the built client from
dist/client - forwarding HTTP requests under
/parties - forwarding WebSocket upgrades to the RPGJS transport
Build output
Run the MMORPG build with:dist/client: browser assetsdist/server/server.js: built version of your agnosticsrc/server.tsdist/server/express.js: built version of your Express adapter
Development flow
During development, Vite still uses the server module you pass torpgjs({ server }).
That means:
src/server.tsstays the single source of truth for your game server- your adapter files are only needed when you want a specific production host
- you do not need a separate
server-dev.ts
Add another host later
To support another runtime, keepsrc/server.ts unchanged and add another adapter file:
src/entries/fastify.tssrc/entries/hono.tssrc/entries/custom.ts
entryPoints.mmorpg.adapters.
dist/server.
Related pages
- For the Node transport API and protected map updates, see /advanced/node-server-production