A product-minded monorepo starter for detection-first computer vision apps built with Next.js and FastAPI.
It gives you a polished upload-to-inference UI, a typed OpenAPI contract, CPU-friendly starter pipelines, and a clean path into webcam capture, segmentation, and heavier model backends later.
Quick start · Screenshots · What you get · Contributing · Security · Roadmap
Most computer-vision starters fall into one of two buckets:
- model notebooks with no product layer
- web templates with no real inference contract
This kit sits in the middle. It starts with a real product flow:
- upload an image
- run a detection-oriented pipeline
- inspect typed boxes, metrics, and image metadata
- keep the same contract when you add segmentation or webcam capture later
- detection-first starter UX with annotated preview overlays
- inference-first architecture with a separate Next.js frontend and FastAPI backend
- shared OpenAPI contract in
docs/openapi.yaml - generated frontend API types from
openapi-typescript - optional webcam extension that reuses the same API surface
- first live segmentation extension with polygons, masks, and derived boxes
- CPU-first OpenCV sample pipelines that are easy to replace later
- root dev and verification scripts for a monorepo-style workflow
- GitHub Actions template CI
- Next.js 16
- React 19
- TypeScript
- Tailwind CSS 4
- Python 3.12+
- FastAPI
- OpenCV
- Docker Compose
starter-detection: default object-style detection flow for the main UIforeground-segmentation: first extension pipeline with polygons plus derived boxesdocument-layout: document-style region extraction for capture and scanning productsdominant-color: metrics-only example for QA and analytics workflows
These pipelines are intentionally lightweight. They prove the repo shape and developer workflow without forcing you into toy logic forever. Swap them for YOLO, ONNX Runtime, PyTorch, TensorRT, or a hosted inference service when you are ready.
frontend/: Next.js app shell, upload flow, webcam flow, and generated API typesbackend/: FastAPI service, pipeline registry, validation, and starter image logicdocs/: OpenAPI contract and screenshot assetsscripts/: root development and verification commands.github/: template CI workflowSECURITY.md: vulnerability reporting guidance
- Install Node.js 22+ and Python 3.12+.
- Run
npm installin the repo root. - Run
npm installinfrontend/. - Run
python -m pip install -e ./backend[dev]. - Run
npm run api:types. - Run
npm run dev.
Frontend: http://localhost:3000
Backend: http://127.0.0.1:8000
If you create backend/.venv, the root scripts will prefer that interpreter automatically.
npm run dev
npm run dev:down
npm run api:types
npm run check:contract
npm run check:images
npm run report:licenses
npm run check:secrets
npm run check:workflows
npm run checkThe root check runs:
- frontend lint
- frontend typecheck
- frontend production build
- backend Ruff lint
- backend
pytest - backend
compileall
check:images is separate and intended for environments where a Docker daemon is available.
report:licenses generates local npm and Python license inventories in reports/licenses/.
check:secrets scans tracked git content with a pinned gitleaks version via Go.
check:workflows lints .github/workflows/ with a pinned actionlint version via Go.
CodeQL code scanning also runs on GitHub for javascript-typescript, python, and workflow files.
A separate GitHub workflow generates license-report artifacts for the root workspace, frontend workspace, and backend Python environment.
An SBOM workflow also publishes SPDX artifacts for the repository source plus the frontend and backend runner images.
- Release Drafter keeps a draft release updated from merged pull requests on
mainand can auto-label incoming pull requests by path. - Path-based labels help sort PRs into frontend, backend, CI/CD, docs, and maintenance categories automatically.
- Release Drafter defaults to a patch bump unless a maintainer applies
minorormajorto the pull request. - Pushing a tag like
v0.1.0triggers the release workflow. - That workflow verifies the tagged commit, publishes backend/frontend images to GHCR, and creates a GitHub Release with generated notes.
- The release workflow also generates build-provenance attestations for the published GHCR images and links them from the release notes.
- The GitHub Release also includes attached SPDX SBOM assets for the source tree and both runner images.
- A follow-up smoke workflow pulls those published GHCR images and checks backend health, a real inference request, and the frontend shell before you treat the release as healthy.
- Maintainers can re-run the same check manually with
BACKEND_IMAGE=... FRONTEND_IMAGE=... npm run check:release-smoke.
docs/openapi.yamlis the source of truth for the HTTP contract.frontend/src/generated/openapi.tsis generated from that spec.- Run
npm run api:typeswhenever backend payloads change. - Run
npm run check:contractto confirm the generated types are committed and in sync.
- Keep the main story detection-first.
- Add webcam polish once upload mode feels strong.
- Add segmentation depth without changing the response boundary.
- Introduce a real model adapter layer.
- Split training and experimentation into a separate workspace later.
The short public roadmap lives in soon.md. A sign-language adaptation roadmap for this template lives in roadmap.md.

