Mirage Source 6
Getting Started

Clone it, run it, see it work

Four processes make up a full local setup: a MySQL/MariaDB database, the game server, the Phaser client, and the standalone admin editor. This page gets all four running from a fresh clone.

On ms6.draignet.uk specifically, this site's own repo doubles as a live showcase — the engine + demo game live under /demo in that repo rather than at its root. Every path and command below is written for a standalone clone of the engine itself (packages/* at the repo root); if you're working from the showcase repo, run them from its demo/ directory instead.

1. Prerequisites

  • Node.js 22 or newer
  • pnpm (the repo pins a version via packageManager in the root package.json — corepack enable will pick it up automatically)
  • A MySQL or MariaDB server reachable from your machine (the schema targets MySQL — see packages/server/prisma/schema.prisma)

2. Install and configure

1

pnpm install at the repo root — this installs every package in the pnpm workspace (packages/*) in one pass.

2

Copy each package's .env.example to .env and fill it in:

cp packages/server/.env.example packages/server/.env
cp packages/client/.env.example packages/client/.env
cp packages/editor/.env.example packages/editor/.env

The server's .env is the one that matters most — set DATABASE_URL to a real MySQL/MariaDB connection string (create an empty database first; Prisma creates the tables) and generate a real JWT_SECRET (the file itself tells you how). The client/editor .env files just need to be present — their defaults (relative API paths, ws://localhost:2567) work for local dev unmodified.

3

Generate the Prisma client and push the schema to your database:

pnpm --filter @ms6/server db:generate
pnpm --filter @ms6/server db:push

Prefer plain SQL over the Prisma CLI? database/ms6-schema.sql is an equivalent schema-only dump (same tables, zero rows) generated from prisma/schema.prisma — import it directly instead of running db:push:

mysql -u <user> -p <database> < database/ms6-schema.sql

3. First run — an empty database is normal

There's no auto-seeding — a freshly-created database is genuinely empty (zero items, zero maps, everything) and the server starts fine that way. That's the right starting point for building your own game from scratch: create content through the admin editor as you go.

Want the shipped demo content (a full working world — 1000 maps, items, NPCs, spells, shops) instead of starting blank? Import content/ms6-demo-content.sql once the schema exists (via either method above):

mysql -u <user> -p <database> < content/ms6-demo-content.sql

4. Run the three dev servers

Each runs independently; start all three in separate terminals (or one, with the combined script):

CommandWhat it startsDefault URL
pnpm dev:serverThe Colyseus game server + REST APIhttp://localhost:2567
pnpm dev:clientThe Phaser game client (Vite dev server)http://localhost:5173
pnpm dev:editorThe standalone admin editor (Vite dev server)http://localhost:5174 (or similar — check the Vite output)
pnpm devAll three at once, in parallel—

On first boot, register an account through the client's login screen — the very first account created is automatically granted Creator access (the highest access level), so you can log into the admin editor with it immediately. See AccessLevel in packages/shared/src/enumerations.ts for the full access ladder.

5. Verify everything works

pnpm check at the repo root runs typecheck + lint + format check + the unit test suite across every package — this is also what the .githooks/pre-push hook runs before allowing a push. For a deeper, live end-to-end check against a running server (combat, spells, items, shops, trade, party, guild), run:

pnpm --filter @ms6/server test:bot

(Server must already be running via pnpm dev:server — this script drives it like a real player would, creating and cleaning up its own throwaway test accounts.)

6. Production notes

  • pnpm build builds shared → server → client in order (the editor is built separately via its own package, since index.ts serves it from config.EDITOR_DIR only if that directory exists).
  • Set NODE_ENV=production and a strong, random JWT_SECRET — the server refuses to start in production with a missing or weak one (see config.ts).
  • CORS_ORIGIN should be your real client origin in production, not *.
  • A Dockerfile and docker-entrypoint.sh are provided at the repo root for containerized deploys.