Environment Files
Each package has its own.env file:
| Package | File | Purpose |
|---|---|---|
| Server | packages/server/.env | Server configuration |
| Client | packages/client/.env | Client configuration |
| Plugin | packages/plugin-hyperscape/.env | AI agent config |
| AssetForge | packages/asset-forge/.env | Asset tools config |
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:- Production/CI: Always fetches from CDN
- Development: Skips if local manifests exist
- Test: Can skip with
SKIP_MANIFESTS=true
- 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.
Client Environment
Required
Production (Cloudflare Pages)
- Production
- Staging
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:| Port | Service | Environment Variable | Started By |
|---|---|---|---|
| 3333 | Game Client | VITE_PORT | bun run dev |
| 5555 | Game Server | PORT | bun run dev |
| 8080 | Asset CDN | - | Docker |
| 5432 | PostgreSQL | - | Docker |
| 4001 | ElizaOS API | ELIZAOS_PORT | bun run dev:elizaos |
| 3400 | AssetForge UI | ASSET_FORGE_PORT | bun run dev:forge |
| 3401 | AssetForge API | ASSET_FORGE_API_PORT | bun run dev:forge |
CDN Configuration
Development CDN
The local CDN serves assets frompackages/server/world/assets/:
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.jsonworld-areas.jsonbiomes.jsonstores.jsonitems.jsonORitems/{weapons,tools,resources,food,misc}.json
Production CDN
SetPUBLIC_CDN_URL to your asset hosting URL:
/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:.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:Adding Custom Domains
If you deploy to a custom domain, add it to the allowlist: Option 1: Environment variablePUBLIC_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”- Check that your frontend domain is in the allowlist
- Verify
PUBLIC_APP_URLis set correctly - Check browser console for the exact origin being blocked
- Add the origin to
allowedOriginsarray inhttp-server.ts
abc123.hyperscape.pages.dev. These are automatically allowed by the regex pattern:
Debug Controls
FPS Debug Panel
Toggle the FPS debug panel with:- F5 (matches Minecraft’s debug screen)
- Backslash (\) (alternative keybind)
- 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 fromPUBLIC_CDN_URL/manifests/:
items.json- Item definitionsammunition.json- Ammunition definitions for ranged combatnpcs.json- NPC and mob dataresources.json- Gathering resourcestools.json- Tool definitionsbiomes.json- Biome configurationsworld-areas.json- World area definitionsstores.json- Shop inventoriesmusic.json- Music track metadatavegetation.json- Vegetation spawningbuildings.json- Building placements
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
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=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
- Create account at dashboard.privy.io
- Create a new app
- Copy App ID and App Secret
- Set in both client and server
.envfiles
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
goalsPausedflag to prevent auto-goal setting - Agent enters idle state
- Chat commands still work
POST /api/agents/:agentId/goal/resume):
- Clears
goalsPausedflag - Agent resumes autonomous goal selection
- Returns to normal behavior
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:- Automated code review on every PR
- Checks for bugs and CLAUDE.md compliance
- Posts review comments directly on PRs
- Uses
pull_request_targetfor fork PR support
Claude PR Assistant
Responds to@claude mentions in issues and PRs:
- Comment
@claudein 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:- Triggers Railway deployment via GraphQL API
- Monitors deployment status
- Only deploys when relevant files change
- Requires
RAILWAY_TOKENsecret
Cloudflare Pages Deployment
Deploys frontend to Cloudflare Pages:- 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:- 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:| Secret | Purpose |
|---|---|
CLAUDE_CODE_OAUTH_TOKEN | Claude Code authentication |
RAILWAY_TOKEN | Railway deployment API token |
CLOUDFLARE_API_TOKEN | Cloudflare Pages deployment |
CLOUDFLARE_ACCOUNT_ID | Cloudflare account ID |
MINTLIFY_API_KEY | Documentation updates |
MINTLIFY_PROJECT_ID | Documentation project ID |
RAILWAY_TOKEN | Railway deployment automation |
CORS Configuration
The server is configured to allow requests from production and development origins:Allowed Origins
Production Domains:https://hyperscape.club- Main production sitehttps://www.hyperscape.club- WWW subdomainhttps://hyperscape.pages.dev- Cloudflare Pages primaryhttps://hyperscape-production.up.railway.app- Railway server
http://localhost:*- Any localhost port (3000, 3333, 5555, etc.)https://*.hyperscape.pages.dev- Cloudflare Pages preview deploymentshttps://*.up.railway.app- Railway preview environments
https://*.farcaster.xyz- Farcaster frame integrationhttps://*.warpcast.com- Warpcast integrationhttps://*.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:- Edit
packages/server/src/startup/http-server.ts - Add your domain to the
allowedOriginsarray: - Redeploy the server