A practice repository for learning Claude Code. Mettle & Co is a fictional company that signs superheroes and sells their services to councils and businesses. All people, data and email addresses are invented.
The booking and dispatch API for Mettle & Co. Clients sign a contract on one of three plans, book heroes for missions, and get a monthly invoice.
Plans are priced per seat per month. A seat is one dedicated patrol post that a client reserves each month.
You need Python 3.12.
With uv:
uv sync
uv run pytest
With pip:
python3.12 -m venv .venv
source .venv/bin/activate
pip install -e . pytest httpx
pytest
uv run uvicorn --factory heroes_api.main:create_app --reload
The database is a SQLite file, heroes.db in the current folder. Set HEROES_DB to use another path. The 15 signed heroes are added on first start. Open http://127.0.0.1:8000/docs to try the endpoints.
POST /clientscreates a client with a name, plan, seats and optional contact emailGET /clientslists clientsPOST /clients/{id}/tierchanges a client's planGET /heroeslists the signed heroes and their powersPOST /bookingsbooks a hero for a mission, with a start and end timeGET /clients/{id}/bookingslists a client's bookingsGET /clients/{id}/invoices/{YYYY-MM}builds the invoice for one month
heroes_api/main.pyhas the FastAPI app and routesheroes_api/db.pyhas the schema and the hero rosterheroes_api/models.pyhas the request modelsheroes_api/plans.pyhas plan prices and included hoursheroes_api/bookings.pycreates and lists bookingsheroes_api/invoices.pybuilds monthly invoicestests/has the pytest suite
Open work is in issues.md.
