Mystic Numbers — Realm-Based Routing
Mystic Numbers uses a realm-based multi-server architecture where each realm operates as an independent game world with its own dedicated stack. Realms are accessed via subdomains (global1.mystic.tribewarez.com, global2.mystic.tribewarez.com, ...) and are managed by an external proxy that routes players to their assigned realm.
Architecture
Player Browser
|
global-N.mystic.tribewarez.com
|
External Proxy (185.163.116.53:80/443)
- TLS termination
- Realm routing (N → specific server stack)
- Rate limiting per realm
|
nginx-proxy (Docker internal)
|
+---------+---------+---------+---------+
| | | | |
app:3000 api:80 ws:8081 mercure:80
Next.js Symfony Socket.IO SSE Hub
PHP-FPMRealm Subdomains
| Subdomain | Purpose |
|---|---|
mystic.tribewarez.com | Landing page — leaderboards, stats, marketplace |
global1.mystic.tribewarez.com | Realm 1 game world |
global2.mystic.tribewarez.com | Realm 2 game world |
globalN.mystic.tribewarez.com | Additional realms on demand |
api.mystic.tribewarez.com | Symfony REST API (shared or per-realm) |
ws.mystic.tribewarez.com | WebSocket server for real-time chat |
Landing Page (mystic.tribewarez.com)
The main landing page serves as the game hub with three primary sections:
Leaderboards
Real-time rankings showing:
- Top players by score across all realms
- Top guilds by total shards
- Weekly/monthly/all-time leaderboards
- Per-realm leaderboard filters
Statistics
Aggregate game metrics:
- Active players online (total and per realm)
- Total games played
- Tokens earned and spent
- Realm population distribution
- Challenge completion rates
Marketplace
Player-to-player trading:
- Listed items with prices (NMTC/PTtC)
- Purchase history and volume charts
- Featured listings
- Buy orders and sell orders
- Recent transactions feed
Realm Assignment
Players are assigned to a realm on first login:
- Player authenticates via Google OAuth
- Backend checks realm capacity (players online, CPU/memory usage)
- Player is assigned to the least-loaded realm
- Subsequent logins route to the same realm (sticky session via cookie or DB)
Realms can be added dynamically by provisioning a new server stack and registering the globalN.mystic.tribewarez.com subdomain.
Cross-Realm Features
| Feature | Cross-Realm Support |
|---|---|
| Leaderboards | Aggregated across all realms |
| Chat | Per-realm only (WebSocket is realm-local) |
| Marketplace | Shared database, same listings across realms |
| Token balances | Shared Solana on-chain wallet (not per-realm) |
Technical Stack Per Realm
Each realm runs the full Mystic Numbers stack:
| Component | Stack | Internal Port |
|---|---|---|
| Web App | Next.js 16 | 3000 |
| REST API | Symfony (PHP) | 9000 (PHP-FPM) |
| WebSocket | Node.js, Socket.IO | 8081 |
| SSE Hub | Mercure | 80 |
| Database | MariaDB | 3306 |
Configuration
Realm routing is configured through the external proxy (haproxy/nginx on the v-server) and the Docker nginx-proxy. Adding a realm requires:
- Provisioning a new server stack (Docker Compose with realm-specific env vars)
- Adding the
globalN.mystic.tribewarez.comDNS record - Configuring the external proxy to route
globalNto the new stack's nginx-proxy