Overview
Hyperscape uses Docker for local development services:- Asset CDN: nginx serving game assets (development only)
- PostgreSQL: Database for player data (development only)
In production, assets are served from Cloudflare R2 and the database runs on Railway. Docker is only used for local development.
Prerequisites
- Docker Desktop (macOS/Windows)
- Or Docker Engine on Linux:
apt install docker.io
CDN Container (Development Only)
The local CDN serves assets during development. In production, assets are served from Cloudflare R2.Start CDN
packages/server/world/assets/ on port 8080.
The CDN script (scripts/cdn.mjs) uses --force-recreate to refresh volume mounts when assets are updated.
Stop CDN
Automatic Start
The CDN starts automatically withbun run dev. Only run manually if using services separately.
CDN Architecture
Hyperscape uses a fully CDN-based architecture with automatic fallback: Required Manifests:npcs.json- NPC definitionsworld-areas.json- World area databiomes.json- Biome definitionsstores.json- Shop dataitems/{weapons,tools,resources,food,misc}.json- Item categories
http://localhost:8080) is missing required manifests, the server automatically falls back to the production CDN (https://assets.hyperscape.club):
Asset Management
ensure-assets.mjs script detects whether you have full assets (models, audio, textures) or just manifests:
PostgreSQL Container
PostgreSQL starts automatically when the server runs via Docker Compose.Configuration
Default connection:Manual Control
Docker Compose
The server package includesdocker-compose.yml:
Resetting Containers
Reset Database
Reset CDN
No Docker Alternative
If you can’t run Docker locally:External PostgreSQL
Use a hosted database (e.g., Neon):External CDN
Point to the production CDN (or host your own):Container Status
Check running containers:Logs
View container logs:Production Docker Build
The repository includesDockerfile.server for production deployments.
Multi-Stage Build
The Dockerfile uses a two-stage build for optimal image size: Stage 1: Builder- Installs build dependencies (Python, Cairo, etc.)
- Runs
bun installwith all dependencies - Builds packages in order: physx-js-webidl → shared → client → server
- Copies client build to
packages/server/public/
- Minimal production image with only runtime dependencies
- Copies built artifacts from builder stage
- Installs production dependencies only
- Exposes port 5555 for game server
Building Locally
Test the production Docker build:Railway Deployment
Railway can use either Nixpacks or Dockerfile: Nixpacks (default):- Configured in
nixpacks.toml - Faster builds with caching
- Automatic dependency detection
- More control over build process
- Consistent with local builds
- Useful for debugging build issues
- Go to project settings
- Change “Builder” from “Nixpacks” to “Dockerfile”
- Set “Dockerfile Path” to
Dockerfile.server
The current production deployment uses Nixpacks for faster builds. The Dockerfile is maintained for local testing and alternative deployment platforms.