Running the Game

Prerequisites

Quick Start with Docker

# 1. Clone the repo
git clone https://github.com/your-org/conquerv5.git
cd conquerv5/new

# 2. Start everything
docker compose up -d

# 3. Run database migrations
docker compose exec backend alembic upgrade head

# 4. Open the game
#    Frontend:  http://localhost:5174
#    API docs:  http://localhost:8001/docs
The first docker compose up builds images and may take a few minutes. Subsequent starts are fast.

Services

ServiceURL / PortDescription
frontendlocalhost:5174React game UI (nginx)
backendlocalhost:8001FastAPI REST API
dblocalhost:5432PostgreSQL 16
redislocalhost:6379Redis (Celery broker)
workerCelery turn processor
beatCelery scheduler (every 6 hrs)

Local Development (no Docker)

Backend

cd new/backend
pip install -e ".[dev]" aiosqlite

# Run tests (uses SQLite in-memory, no database needed)
python3 -m pytest

# Start dev server (requires PostgreSQL)
DATABASE_URL=postgresql+asyncpg://user:pass@localhost/conquer \
  uvicorn app.main:app --reload

Frontend

cd new/frontend
npm install

# Set backend URL
echo "VITE_API_URL=http://localhost:8001" > .env

# Start dev server
npm run dev
# Open http://localhost:5173

Environment Variables

VariableDefaultDescription
DATABASE_URLpostgresql+asyncpg://conquer:conquer@db:5432/conquerPostgreSQL connection
REDIS_URLredis://redis:6379/0Redis/Celery broker
SECRET_KEYchange-me-in-productionJWT signing key — change this!
DEBUGfalseEnables SQL echo and stack traces
VITE_API_URLhttp://localhost:8001Frontend → backend URL
Production: Change SECRET_KEY to a random 32+ character string. Do not run with DEBUG=true in production.

Database Migrations

# Apply all migrations
docker compose exec backend alembic upgrade head

# Create a new migration after model changes
docker compose exec backend alembic revision --autogenerate -m "description"

Turn Scheduling

By default the Celery beat scheduler processes all active worlds every 6 hours. Admins can also trigger turns manually from the Admin Panel.

To change the schedule, edit app/tasks/celery_app.py:

beat_schedule={
    "process-all-turns": {
        "task": "app.tasks.turn_tasks.process_all_worlds",
        "schedule": crontab(minute=0, hour="*/6"),  # change interval here
    },
},

Stopping the Server

docker compose down          # stop containers, keep data
docker compose down -v       # stop and delete all data (reset)