Skip to main content

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

This starts an nginx container serving assets from 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 with bun 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 definitions
  • world-areas.json - World area data
  • biomes.json - Biome definitions
  • stores.json - Shop data
  • items/{weapons,tools,resources,food,misc}.json - Item categories
Production CDN Fallback: In development mode, if the local CDN (http://localhost:8080) is missing required manifests, the server automatically falls back to the production CDN (https://assets.hyperscape.club):
This allows developers to start the server without cloning the full assets repository.

Asset Management

The ensure-assets.mjs script detects whether you have full assets (models, audio, textures) or just manifests:
If only manifests are present, the script clones the full assets repository and pulls Git LFS objects.

PostgreSQL Container

PostgreSQL starts automatically when the server runs via Docker Compose.

Configuration

Default connection:

Manual Control

Docker Compose

The server package includes docker-compose.yml:

Resetting Containers

Reset Database

This deletes all local data (characters, inventory, progress).

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):
Manifest fetching: The server will automatically fetch manifests from the CDN at startup. You don’t need to clone the assets repository. Asset serving: All 3D models, textures, and audio will be loaded from the CDN. The local Docker CDN is not required.

Container Status

Check running containers:
Expected output when running:

Logs

View container logs:

Production Docker Build

The repository includes Dockerfile.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 install with all dependencies
  • Builds packages in order: physx-js-webidl → shared → client → server
  • Copies client build to packages/server/public/
Stage 2: Runtime
  • 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
Dockerfile (alternative):
  • More control over build process
  • Consistent with local builds
  • Useful for debugging build issues
To switch to Dockerfile on Railway:
  1. Go to project settings
  2. Change “Builder” from “Nixpacks” to “Dockerfile”
  3. 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.