---
name: Server-Authoritative Architecture Refactor
description: Frontend gutted to pure renderer; all game logic (combat, walking, encounters) moved to server via WebSocket. Engine.ts is now state holder + render loop only.
type: project
---

Major architecture change completed 2026-03-27.

The frontend is now a thin WebSocket client + PixiJS renderer:
- `engine.ts` holds server-provided state and runs the render loop (no simulation)
- `ws-handler.ts` bridges WS messages to engine methods and React UI callbacks
- Position interpolation: server sends hero_move at 2Hz, engine interpolates to 60fps
- All commands (buff, potion, revive, NPC interactions) sent via WS, not REST
- REST API kept for: initHero, getTowns, getHeroQuests, getAchievements, getDailyTasks, equipment

**Why:** Server-authoritative model prevents cheating and enables shared-world features. Spec: `docs/spec-server-authoritative.md`.

**How to apply:** When adding new game features, all logic goes server-side. Frontend only renders state from WS messages and sends user commands via WS.
