A web-based 3D town building application with real-time multiplayer collaboration.
- Python 3.14+
- Go 1.24+ (for WASM builds)
- Redis (for multiplayer)
- uv (recommended)
# Clone the repository
git clone https://github.com/your-repo/town-builder.git
cd town-builder
# Install dependencies
uv sync
# Make scripts executable
chmod +x scripts/*.sh
# Run setup (creates .env, checks dependencies)
./scripts/setup.shDevelopment mode:
./scripts/dev.sh- Starts server on http://127.0.0.1:5001
- Auto-reload on code changes
- Default CORS for localhost
Production mode:
./scripts/prod.sh- Starts server on http://127.0.0.1:5000
- Uses Gunicorn with gevent workers
- Requires proper JWT configuration
- 3D Town Building: Drag-and-drop buildings, roads, trees, and props
- Real-time Multiplayer: Collaborate with others using Server-Sent Events
- Physics Engine: Go WASM for high-performance collision detection and car physics
- Multiple Modes: Place, Edit, Delete, and Drive modes
- Save/Load: Persist your town layouts
- Mobile Controls: Touch-friendly interface
Create a .env file (or use ./scripts/setup.sh):
# Required for production
JWT_SECRET_KEY=your_secure_random_string
DISABLE_JWT_AUTH=false
# Redis
REDIS_URL=redis://localhost:6379/0
# CORS (comma-separated)
ALLOWED_ORIGINS=http://localhost:3000,http://localhost:5001
# Environment
ENVIRONMENT=developmentSecurity Note: Never commit your .env file with secrets!
The scripts/ directory contains helpful utilities:
setup.sh- Initial setup and dependency checkdev.sh- Start development serverprod.sh- Start production servercheck-health.sh- System health diagnosticsclean.sh- Clean build artifacts
See scripts/README.md for detailed usage.
- Mouse: Click & drag to rotate camera
- Arrow keys/WASD: Move camera
- Mouse wheel: Zoom in/out
- Z key: Zoom to selection
- Place Mode: Select model → Click to place
- Edit Mode: Click object → Adjust position/rotation
- Delete Mode: Click object to remove
- Drive Mode: Click vehicle → W/↑ accelerate, S/↓ brake, A/← left, D/→ right
- Backend: FastAPI (Python 3.14+) with Redis
- Frontend: Three.js with vanilla JavaScript
- Physics: Go WASM (spatial grid, collision detection, car physics)
- Multiplayer: Server-Sent Events + Redis Pub/Sub
- Docker: Production-ready container
- Kubernetes: Full deployment manifests in
k8s/ - Valkey/Redis: Required for multiplayer state
See docs/ARCHITECTURE.md for technical details.
./build_wasm.sh# Check system health
./scripts/check-health.sh
# Clean artifacts
./scripts/clean.shMIT License - See LICENSE.md for details.
- Inspired by Florian's Room
- Assets from Kaykit Bits