This project contains a number of hidden bugs. Your task is to debug and fix them. The goal is to solve as many as you can—it’s okay if you don’t find all of them.
Reference: The correct API behaviour is defined in api-specifications.md. Use it as the source of truth.
Workflow: Fork this repository and do all your work (and commits) in your fork.
Code quality: Read and understand the existing code and your own changes. Don’t apply fixes without understanding what the code does and why you’re changing it.
AI tools: You may use AI tools. If you do, you must share the relevant chat history with us during the interview.
- Bring your laptop.
- Ensure the project is set up on your machine before you come.
- If you used AI, have the chat history ready to share.
FastAPI-based REST API for a vending machine system. See api-specifications.md for full specifications.
python -m venv .venv
source .venv/bin/activate # or .venv\Scripts\activate on Windows
pip install -r requirements.txtSet environment variables (optional; defaults shown):
MAX_SLOTS– maximum number of slots (default:10)MAX_ITEMS_PER_SLOT– optional per-slot item limitDATABASE_URL– database URL (default:sqlite:///./vending.db)
Example:
export MAX_SLOTS=20uvicorn app.main:app --reloadAPI: http://127.0.0.1:8000
Docs: http://127.0.0.1:8000/docs
POST /slots– create slotGET /slots– list slotsGET /slots/full-view– slots with nested itemsDELETE /slots/{slot_id}– remove slotPOST /slots/{slot_id}/items– add item to slotPOST /slots/{slot_id}/items/bulk– bulk add itemsGET /slots/{slot_id}/items– list items in slotGET /items/{item_id}– get single itemPATCH /items/{item_id}/price– update item priceDELETE /slots/{slot_id}/items/{item_id}– remove item or quantityDELETE /slots/{slot_id}/items– clear slot or remove specific itemsPOST /purchase– purchase itemGET /purchase/change-breakdown?change=<amount>– change denomination breakdownGET /health– health check