This directory hosts the standalone CadQuery selection tutorial. It contains the FastAPI backend, sandbox utilities, authored lesson data, reusable CadQuery example scripts, and the React front-end that lives in ./web/.
/tutorial
├── Dockerfile # FastAPI + CadQuery backend image
├── README.md # You are here
├── cq_examples/ # Sample CadQuery models used for lessons/playground
├── data/ # JSON lesson definitions and example listings
├── fastapi_app.py # FastAPI entry point
├── requirements.txt # Backend Python dependencies
├── sandbox/ # Restricted execution utilities for user code/selectors
├── tests/ # Pytest suite exercising selector helpers
└── web/ # React + Vite front-end (react-three-fiber viewer)
From the repository root run:
docker-compose up --buildThis launches both the backend (tutorial-api on http://localhost:8000) and the front-end (web on http://localhost:5173) with hot reloading enabled for local files.
python -m venv .venv
source .venv/bin/activate
pip install -r tutorial/requirements.txt
uvicorn tutorial.fastapi_app:app --reloadThe API is available at http://localhost:8000 with interactive Swagger docs under /docs.
cd tutorial/web
npm install
npm run dev -- --hostDuring development the Vite dev server proxies API calls to http://localhost:8000.
Run the backend tests with:
pytest tutorial/tests(Ensure CadQuery's OCP bindings are installed; see tutorial/requirements.txt.)
- Create or update a CadQuery example under
cq_examples/. - Add a JSON lesson file inside
data/lessons/referencing the example. - Restart the backend (or trigger an auto-reload) so the new lesson metadata is available to the UI.