Colyseus authoritative room server + thin HTTP BFF for the Gotchiverse 2D walkable MVP.
- HTTP: auth nonce/token, realm config,
/realm/socketshim,/foundry/config,/health - Realtime: Colyseus rooms
citaadel+aarena(move + see other players) - Hybrid Grid Foundry PoC: wild veins, antennas, wall receivers, cargo/tithe
- Chain identity: Base Envio/Goldsky subgraphs (optional ownership check)
Deploy on DigitalOcean (aarcade host). The Next.js client is gotchiverse-2d on Vercel.
cp .env.example .env
npm install
npm run devOr start BE + sibling FE together (expects ../gotchiverse-2d):
npm run dev:all- HTTP health:
http://localhost:2567/health - Colyseus:
ws://localhost:2567(roomscitaadel,aarena) - FE:
http://localhost:3001(when usingdev:all)
Point the FE at:
NEXT_PUBLIC_API_URL=http://localhost:2567
NEXT_PUBLIC_COLYSEUS_URL=http://localhost:2567
NEXT_PUBLIC_NETCODE=colyseusGET /user/nonce/get?address=0x...→{ nonce, message }- Wallet signs
nonce(legacy FE) ormessage GET /user/authtoken/get?address=0x...&signature=0x...&gotchiId=123→{ token }- Client
joinOrCreate('citaadel' | 'aarena', { token, gotchiId }) - Room
onAuthverifies JWT (and optional subgraph ownership)
cp .env.example .env
docker compose -f docker-compose.dev.yml up --build- DNS: point
api.yourdomain.comat the droplet. - On the server:
git clone https://github.com/userdefault13/gotchiverse-realm-server.git
cd gotchiverse-realm-server
cp .env.example .env
# Edit .env: JWT_SECRET, PUBLIC_URL, CORS_ORIGINS, subgraph URLs
export REALM_DOMAIN=api.yourdomain.com
docker compose up -d --build
curl -s https://api.yourdomain.com/health- Open firewall for 80/443 only.
| Variable | Purpose |
|---|---|
PORT / HOST |
Listen address |
PUBLIC_URL |
URL returned by /realm/socket and config |
CORS_ORIGINS |
Comma-separated FE origins (*.vercel.app / https://*.vercel.app supported) |
JWT_SECRET |
Auth token signing |
CORE_SUBGRAPH_URL |
Base core GraphQL for ownership |
GOTCHIVERSE_SUBGRAPH_URL |
Gotchiverse GraphQL |
SKIP_OWNERSHIP_CHECK |
true for local sandbox |
COMBAT_IS_LIVE |
Expose Aarena as live in /realm/config/list |
Aarena only. AarenaRoom accepts combat.melee / combat.fire and broadcasts combat.enter / combat.positions / combat.leave. Citaadel has no combat handlers. Damage / hits are not authoritative yet.
-
GET /health→ok: true - Nonce → sign → authToken succeeds
- Two browsers join
citaadeland see each other move -
GET /foundry/configreturns wild nodes + wall receivers - Optional: join
aarenaafter settingCOMBAT_IS_LIVE=true - Attack on
/combator/play: melee slap/rush anim and/or missile projectile appear - Vercel FE
NEXT_PUBLIC_NETCODE=colyseusreaches this host over WSS