Skip to main content

Environment Files

Each package has its own .env file: Copy from examples:

Server Environment

Required (Production)

PUBLIC_PRIVY_APP_ID is exposed to clients via /env.js endpoint. The PRIVY_APP_SECRET is server-only and never exposed.

Optional

Manifest Loading

The server fetches game manifests from CDN at startup:
Behavior:
  • Production/CI: Always fetches from CDN
  • Development: Skips if local manifests exist
  • Test: Can skip with SKIP_MANIFESTS=true
Manifest Files:
  • Root: biomes.json, npcs.json, prayers.json, stations.json, etc.
  • Items: items/food.json, items/weapons.json, items/tools.json, etc.
  • Gathering: gathering/fishing.json, gathering/mining.json, etc.
  • Recipes: recipes/cooking.json, recipes/smithing.json, etc.
Total: 25+ manifest files fetched and cached at startup.

Client Environment

Required

PUBLIC_PRIVY_APP_ID must match PRIVY_APP_ID on the server.

Production (Cloudflare Pages)

Development

The production CDN URL is https://assets.hyperscape.club which serves from Cloudflare R2.

AI Agent Environment

ElizaOS 1.7.0: Now supports Ollama for local LLM inference. Configure OLLAMA_API_URL to use local models.

AssetForge Environment

Port Allocation

All services have unique default ports:

CDN Configuration

Development CDN

The local CDN serves assets from packages/server/world/assets/:
Asset Structure:

CDN Fallback (Development)

If the local CDN is unavailable and required manifests are missing, the server automatically falls back to the production CDN (https://assets.hyperscape.club) to bootstrap local development. Required Manifests:
  • npcs.json
  • world-areas.json
  • biomes.json
  • stores.json
  • items.json OR items/{weapons,tools,resources,food,misc}.json
Bypass in Tests:

Production CDN

Set PUBLIC_CDN_URL to your asset hosting URL:
Supported Paths:
  • /manifests/{file}.json — Game data manifests
  • /models/{file}.glb — 3D models
  • /audio/music/{normal|combat}/{file}.mp3 — Music tracks
  • /world/{file} — Environment assets
  • /health — Health check endpoint

Zero-Config Development

Default values work out of the box for local development:
Only configure .env files when:
  • Using Privy authentication
  • Connecting to external database
  • Deploying to production
  • Running AI agents

CORS Configuration

The server automatically configures CORS to allow requests from the frontend and preview deployments.

Allowed Origins

Production domains:
Dynamic patterns:

Adding Custom Domains

If you deploy to a custom domain, add it to the allowlist: Option 1: Environment variable
The server automatically adds PUBLIC_APP_URL to the CORS allowlist. Option 2: Code modification

CORS Headers

The server sends these CORS headers:

Troubleshooting CORS

Error: “CORS policy: No ‘Access-Control-Allow-Origin’ header”
  1. Check that your frontend domain is in the allowlist
  2. Verify PUBLIC_APP_URL is set correctly
  3. Check browser console for the exact origin being blocked
  4. Add the origin to allowedOrigins array in http-server.ts
Preview deployments not working: Cloudflare Pages preview deployments use subdomains like abc123.hyperscape.pages.dev. These are automatically allowed by the regex pattern:
If you use a different preview domain pattern, add a regex for it.

Debug Controls

FPS Debug Panel

Toggle the FPS debug panel with:
  • F5 (matches Minecraft’s debug screen)
  • Backslash (\) (alternative keybind)
The debug panel shows:
  • FPS (frames per second)
  • Frame time (ms)
  • Memory usage
  • Entity count
  • Network stats
The F5 keybind was added to match Minecraft’s familiar debug screen shortcut.

CDN Manifest System

Hyperscape fetches game manifests from the CDN at server startup instead of bundling them in the deployment:

Manifest Files

The following manifests are fetched from PUBLIC_CDN_URL/manifests/:
  • items.json - Item definitions
  • ammunition.json - Ammunition definitions for ranged combat (updated Feb 2026)
  • npcs.json - NPC and mob data (includes new stores and mobs)
  • resources.json - Gathering resources
  • tools.json - Tool definitions
  • biomes.json - Biome configurations
  • world-areas.json - World area definitions
  • stores.json - Shop inventories (includes Lowe, Dommik, Horvik, Zamorin)
  • music.json - Music track metadata
  • vegetation.json - Vegetation spawning
  • buildings.json - Building placements
  • quests.json - Quest definitions with starter quests
  • stations.json - Crafting stations including runecrafting altars

Recent Manifest Updates (February 2026)

  • NPCs: Added new store NPCs (Lowe, Dommik, Horvik, Zamorin) and mobs (Bandits, Barbarians, Dark Rangers, Dark Wizards)
  • Items: Added magic staffs (Air, Water, Earth, Fire), bones, coin piles, and ammunition
  • Recipes: Added runecrafting and fletching recipe manifests
  • Stations: Added runecrafting altars and firemaking fire models
  • Quests: Added starter quest system
  • Assets: Optimized all 3D models and organized asset structure

Fetch Behavior

Production (NODE_ENV=production):
  • Always fetches manifests from CDN
  • Compares with cached versions
  • Only updates files that changed
  • Falls back to cache if CDN unreachable
Development (NODE_ENV=development):
  • Skips fetch if local manifests already exist
  • Allows working with local asset repository
  • Fetches from CDN if no local manifests found
CI/CD (CI=true or SKIP_ASSETS=true):
  • Skips asset download during build
  • Relies on CDN for all assets and manifests
  • Faster builds and smaller deployment size

Configuration

Manifests are cached in packages/server/world/assets/manifests/ and served to clients via /manifests/ route with 5-minute cache headers.

Privy Configuration

  1. Create account at dashboard.privy.io
  2. Create a new app
  3. Copy App ID and App Secret
  4. Set in both client and server .env files
Without Privy, the game runs in anonymous mode with temporary identities.

New API Endpoints (ElizaOS 1.7)

Agent Management

Data Endpoints

Goal Control

The stop/resume endpoints enable dashboard control of agent behavior: Stop Goal (POST /api/agents/:agentId/goal/stop):
  • Cancels current movement path
  • Sets goalsPaused flag to prevent auto-goal setting
  • Agent enters idle state
  • Chat commands still work
Resume Goal (POST /api/agents/:agentId/goal/resume):
  • Clears goalsPaused flag
  • Agent resumes autonomous goal selection
  • Returns to normal behavior
Response Format:

GitHub Actions

The repository includes automated workflows for code quality, deployment, and documentation:

Claude Code Review

Automatically reviews pull requests for bugs and code quality issues:
Features:
  • Automated code review on every PR
  • Checks for bugs and CLAUDE.md compliance
  • Posts review comments directly on PRs
  • Uses pull_request_target for fork PR support
Security: Checks out PR head commit explicitly to review actual changes.

Claude PR Assistant

Responds to @claude mentions in issues and PRs:
Usage:
  • Comment @claude in any issue or PR
  • Claude will respond with code suggestions
  • Can read CI results and provide context-aware help

Railway Deployment

Automatically deploys server to Railway on push to main:
Features:
  • Triggers Railway deployment via GraphQL API
  • Monitors deployment status
  • Only deploys when relevant files change
  • Requires RAILWAY_TOKEN secret

Cloudflare Pages Deployment

Deploys frontend to Cloudflare Pages:
Features:
  • Builds and deploys client to Cloudflare Pages
  • Automatic preview deployments for PRs
  • Production deployment on main branch

Documentation Updates

Automatically updates documentation when manifests change:
Features:
  • Triggers on pushes to main branch
  • Analyzes recent commits for manifest changes
  • Creates PRs with documentation updates

Required Secrets

Configure these in your repository settings:

CORS Configuration

The server is configured to allow requests from production and development origins:

Allowed Origins

Production Domains:
  • https://hyperscape.club - Main production site
  • https://www.hyperscape.club - WWW subdomain
  • https://hyperscape.pages.dev - Cloudflare Pages primary
  • https://hyperscape-production.up.railway.app - Railway server
Development Patterns:
  • http://localhost:* - Any localhost port (3000, 3333, 5555, etc.)
  • https://*.hyperscape.pages.dev - Cloudflare Pages preview deployments
  • https://*.up.railway.app - Railway preview environments
Integration Domains:
  • https://*.farcaster.xyz - Farcaster frame integration
  • https://*.warpcast.com - Warpcast integration
  • https://*.privy.io - Privy authentication
CORS configuration is defined in packages/server/src/startup/http-server.ts. If you add custom domains, update the allowedOrigins array.

Adding Custom Domains

To add a custom domain to CORS allowlist:
  1. Edit packages/server/src/startup/http-server.ts
  2. Add your domain to the allowedOrigins array:
  3. Redeploy the server
Never use origin: "*" in production - it disables CORS protection and exposes your API to abuse.