- Python 58.7%
- JavaScript 18.3%
- CSS 12.2%
- HTML 8.7%
- Mako 1.1%
- Other 1%
| alembic | ||
| app | ||
| docs | ||
| web | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| alembic.ini | ||
| docker-compose.yml | ||
| Dockerfile | ||
| pyproject.toml | ||
| README.md | ||
| SECURITY_TODO.md | ||
| todo.md | ||
battlechores-server
BattleChores is a self-hosted household chore RPG with:
- PostgreSQL database
- FastAPI backend API
- Responsive web client (for current development/testing)
The web app is the primary client for now, with Android planned later.
Prerequisites
- Docker
- Docker Compose (v2)
- Poetry (optional for local non-Docker development)
Quick start
-
Copy environment variables:
cp .env.example .env -
Build and start the stack:
docker compose up --build -
Open:
- Web client: http://localhost:3000/
- API root: http://localhost:8000/
- API docs: http://localhost:8000/docs
- API db health: http://localhost:8000/db-health
Services
web- Nginx-served responsive test client.api- FastAPI app running with hot reload and Poetry.db- PostgreSQL 16 with persisted volumepostgres_data.
Poetry commands (local API development)
Install dependencies:
poetry install
Run API locally:
poetry run uvicorn app.main:app --reload
Run migrations:
poetry run alembic upgrade head
Create a new migration after model changes:
poetry run alembic revision --autogenerate -m "describe change"
Chore admin and users
Self-hosted installs define a single chore admin (GM) in .env:
CHORE_ADMIN_USERNAME— only this user can create new family groups (POST /households).CHORE_ADMIN_PASSWORD— password; on each API startup the admin row in the database is updated to match these values.
There is no public registration. The admin logs in, then:
POST /admin/users— create accounts for family members (username/password).POST /households— create a family group (admin becomes owner).POST /households/{household_id}/members— add those users with roles (parent,family_member, etc.).
Initial API endpoints
POST /auth/login-> login and return bearer tokenPOST /admin/users-> chore admin creates a family user accountPOST /households-> chore admin creates a family group (owner role)POST /households/{household_id}/members-> owner/parent can add member with rolePOST /chores-> owner/parent creates choreGET /households/{household_id}/chores-> list chores for a household memberPOST /chore-completions-> member submits chore completionPOST /chore-completions/{completion_id}/review-> owner/parent approves/rejects, approval grants XP
Use Authorization: Bearer <token> for protected routes.
Development notes
-
App code lives in
app/. -
API routes are split into
app/routes/modules. -
SQLAlchemy models are in
app/models.py. -
Alembic migrations live in
alembic/versions/. -
Web client code lives in
web/. -
Default PostgreSQL host for containerized app is
db. -
Stop stack:
docker compose down -
Stop and remove volumes:
docker compose down -v
Early domain model (suggested)
Start with these core entities:
Userwith role:owner,parent,family_memberHouseholdand membership tableChorewith XP reward, optional item rewardChoreCompletionrequiring manager/admin approvalCharacterwith level, XP, basic statsInventoryItemand optional item grants
Suggested first gameplay loop:
- Admin/Manager creates chore
- Family member marks complete
- Admin/Manager approves completion
- XP and items are granted to character
- Character can level up when XP threshold is met