|
CITY_NET
A self-hosted, real-time 3D city for tabletop RPG sessions.
The GM generates a living cyberpunk city — procedural districts, roads, overpasses, traffic, and custom signs — while players connect live and interact with it. Run a battle map, manage the economy, roll dice, stream to an audience, and never touch a third-party platform.
Built with React + Three.js · Node.js + SQLite · Socket.IO · Docker
|
CITY_NET Trailer
For Game Masters — Getting Started
New to Docker or tunnels? Follow the step-by-step install guide. It starts from nothing, and covers getting a link to your players and what to do when something goes wrong.
Prerequisites
- Install Git: Git install
- Docker option: Docker Desktop (recommended, easiest setup)
- Manual option: Node.js 24.22.1 or newer (or 22.23.4+): older releases lack the October 2026 security fixes
- A terminal (PowerShell, bash, etc.)
1. Clone the repo
git clone https://github.com/over2take/CITY_NET.git
cd CITY_NET
Quick Setup (Guided Script)
⚠️ NEVER RUN SCRIPTS FROM AN UNTRUSTED SOURCE
Only use setup.ps1 / setup.sh if you downloaded them directly from this repository (github.com/over2take/CITY_NET). Scripts can do anything your user account can do — if someone sends you a "setup script" for CITY_NET from anywhere else (Discord, forums, a re-upload, a YouTube description), do not run it. When in doubt, open the script in a text editor and read it first, or use the manual setup below instead — it's only a few copy-paste steps.
If you'd rather not edit config files by hand, run the guided setup script. It supports both install methods — Docker (recommended) or manual with Node.js — generates a secure JWT_SECRET for you, asks for your admin login and port, optionally sets up DuckDNS (Docker only), writes the .env files, and can build and launch the app — all from a few prompts.
Windows: double-click setup.bat, or from PowerShell:
powershell -ExecutionPolicy Bypass -File setup.ps1
Linux/Mac:
bash setup.sh
Requires Docker (recommended) or Node.js v18+ to be installed. For manual configuration instead, follow the options below.
Starting the app later:
- Docker install: containers auto-restart; or run
docker compose up -d
- Node.js install: double-click
start.bat (Windows) or run bash start.sh (Linux/Mac). The server runs in that terminal — closing it stops the app.
Option A: Docker (Recommended)
2. Configure environment
Linux/Mac:
cp backend/.env.example backend/.env
cp backend/.env .env
Windows (PowerShell):
Copy-Item backend\.env.example backend\.env
Copy-Item backend\.env .env
Edit backend/.env with your values. See backend/.env.example for all options and defaults.
Note: We copy to both locations because docker-compose needs the root .env to substitute variables like DUCKDNS_SUBDOMAINS in the compose file itself.
Required in both files:
ADMIN_USER=your_admin_name
ADMIN_PASS=your_secure_password
JWT_SECRET=some_long_random_string
Generate a strong token:
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
Optional settings (safe to leave as-is):
PORT=5000
SECURE_MODE=false
APP_PORT=80
DUCKDNS_SUBDOMAINS=yourname
DUCKDNS_TOKEN=your-token-from-duckdns.org
TZ=America/Chicago
Never commit .env files. They're already in .gitignore.
3. Start Docker
docker compose up -d
Everything runs automatically. Access the app at http://localhost:$APP_PORT (default http://localhost:80).
Option B: Manual Setup
2. Configure the backend
Linux/Mac:
cd backend
cp .env.example .env
Windows (PowerShell):
cd backend
Copy-Item .env.example .env
Edit backend/.env with your values (same required/optional settings as above).
3. Install dependencies
cd backend && npm install
cd ../frontend && npm install
4. Run in development
Open two terminals:
# Terminal 1 — backend
cd backend
node server.js
# Terminal 2 — frontend
cd frontend
npm run dev
Frontend is at http://localhost:5173, backend at http://localhost:5000.
5. Build for production
cd frontend
npm run build
cd ../backend
node server.js
Connectivity & Deployment
Not sure how to do this? The install guide walks through a Cloudflare tunnel and DuckDNS one step at a time.
The app runs locally on localhost:5000 (manual) or localhost:$APP_PORT (Docker). To let players connect over the internet, you need to expose it publicly:
Cloudflare Tunnel (recommended — free, no port forwarding, works behind NAT)
- Install cloudflared
cloudflared tunnel --url http://localhost:5000 (or http://localhost:$APP_PORT for Docker)
- Cloudflare prints a public
https:// URL — share that with your players
DuckDNS (free persistent subdomain — good for home servers with dynamic IPs)
DuckDNS gives you a free subdomain like yourcity.duckdns.org that always points to your home IP even when it changes. Unlike Cloudflare Tunnel it requires port forwarding on your router, but it gives players a clean, permanent URL.
Port note: port 80 gives a clean URL (http://yourcity.duckdns.org) but many residential ISPs block inbound port 80. If yours does, set APP_PORT=8080 in backend/.env and players connect to http://yourcity.duckdns.org:8080. Port 443 enables a clean HTTPS URL but requires an SSL certificate (see Certbot below).
Firewall note: OS firewalls (e.g. Windows Defender Firewall) will need a rule to allow incoming connections on your selected port (80 or 8080). Without it, the router forwards the port but the host machine silently drops the connection.
- Register a free subdomain and copy your token at duckdns.org
- In
backend/.env set:DUCKDNS_SUBDOMAINS=yourcity
DUCKDNS_TOKEN=your-token-here
APP_PORT=80 # or 8080 if your ISP blocks 80
TZ=America/Chicago # your timezone
- The
duckdns service in docker-compose.yml runs automatically and keeps your IP updated — no cron job needed
- Forward the chosen port (e.g.
80 or 8080) on your router to the host machine
- Players connect to
http://yourcity.duckdns.org (or :8080 if you used that port)
Adding HTTPS with Let's Encrypt (optional but recommended)
# Install Certbot with the DuckDNS plugin
pip install certbot certbot-dns-duckdns
# Issue a cert (DNS-01 challenge — no port 443 needed for issuance)
certbot certonly \
--authenticator dns-duckdns \
--dns-duckdns-token your-token-here \
-d yourcity.duckdns.org
Then update nginx.conf to listen on 443 with the issued cert and set APP_PORT=443.
IPv6 direct connect (LAN play — no internet, no port forwarding)
If your players are on the same local network, they can connect directly via your machine's IPv6 address — no router config needed.
- Find your IPv6 address:
- Windows:
ipconfig → look for IPv6 Address under your network adapter
- Linux/Mac:
ip addr or ifconfig → look for inet6 (use the global address, not fe80::)
- Make sure Docker is running (
docker compose up -d)
- Players open
http://[your-ipv6-address] in their browser (brackets required)
- Example:
http://[2001:db8:85a3::8a2e:370:7334]
- If using a custom
APP_PORT: http://[2001:db8::1]:8080
Tip: IPv6 LAN addresses are stable on most home networks but can change if the router restarts. For regular sessions, set a static IPv6 address on the host machine.
ngrok (quick and easy, free tier has session limits)
- Sign up at ngrok.com and install the CLI
ngrok http 5000 (or $APP_PORT for Docker)
- ngrok prints a public URL good for the session
Nginx reverse proxy (self-hosted VPS, requires a domain)
- An
nginx.conf is included in the repo — it proxies HTTP and WebSocket traffic to port 5000
- Point your domain's DNS at your server, install Nginx, drop the config in
/etc/nginx/sites-available/, and enable it
- Pair with Certbot for free HTTPS via Let's Encrypt
Checking for updates
The admin panel includes a Check for update button that queries Docker Hub for new versions.
The GitHub Actions workflow automatically tags Docker images with version numbers from package.json. When you bump the version and run the release workflow, new images are available on Docker Hub with version tags.
Checking for new environment variables after updates
When you update the Docker images, new required environment variables may have been added. If you're missing any, the backend logs a warning on startup with the missing var names.
To see the latest .env.example from a running container:
docker cp citynet-backend:/app/.env.example ./backend/.env.example.new
diff backend/.env.example backend/.env.example.new
Compare the diff and add any new vars to your backend/.env, then restart:
docker compose up -d
Secure Mode
When SECURE_MODE=false (default), players just enter a name to join — no password required.
When SECURE_MODE=true, players must register an account before they can access the map. Registration is self-service from the login screen.
Admin first login with Secure Mode ON:
Enter your .env admin credentials on the player login screen. The app will recognise them as admin credentials, log you in, and open the admin dashboard automatically — no separate player account needed.
Admin Panel
Click ADMIN_LOGIN in the top bar once you're on the map. Enter your .env ADMIN_USER / ADMIN_PASS. This gives you access to:
- Full map editing (create, move, edit, delete locations)
- Player token management (place and move player characters)
- HP / injury tracking for all players
- Bank ledger and scheduled pay
- Dice roll history
- Battle map uploads
- City database and district management
- Custom sign placement (text, image, multi-line; free-transform gizmo for wall placement; custom font upload)
- Character sheets — game system selection, house rules, NPC library, per-system admin actions (CP:R LUCK reset, SR6 Edge replenishment)
Project Structure