Guidance for coding agents working in this repository.
This repo is a product-minded starter for computer-vision apps.
The default story is:
- upload an image
- run a detection-first inference pipeline
- inspect typed detections, metrics, and image metadata
- extend into segmentation or webcam capture without changing the contract boundary
Keep that shape intact when making changes.
frontend/: Next.js app, upload flow, webcam flow, docs preview routes, generated API typesbackend/: FastAPI service, pipeline registry, validation, response schemas, testsdocs/openapi.yaml: source of truth for the API contractfrontend/src/generated/openapi.ts: generated types from the OpenAPI specscripts/dev.mjs: root dev runner for frontend + backendscripts/check.mjs: root verification entrypointscripts/check-contract-drift.mjs: ensures generated API types match the spec
- Prefer detection-first, inference-first changes over adding disconnected demo paths.
- Keep frontend and backend loosely coupled through the API contract, not direct assumptions.
- If you change response payloads or request shapes, update
docs/openapi.yaml, regenerate types, and verify both sides. - Treat
frontend/src/app/docs-preview/as docs-only seeded demo pages for README screenshots. They should stay stable and lightweight. - Do not commit
node_modules,.venv,.next, caches, or local-only helper files.
When changing the API contract:
- update
docs/openapi.yaml - update backend schemas and route behavior
- run
npm run api:types - update frontend usage if generated types changed
- run
npm run check
Use these commands before finishing work:
npm run check:contract
npm run check:secrets
npm run check:workflows
npm run checkThis repo uses Next.js 16. Do not assume older App Router behavior is still correct. Check current Next.js docs or the local Next.js bundled docs when making framework-sensitive changes.
The backend sample logic is intentionally CPU-first and easy to replace. Prefer keeping model-specific logic behind the small vision service boundary rather than leaking it into routes.