This repository packages the Ambient Form workflow as:
backend/ Python CLI + FastAPI service
frontend/ Vite + React UI
examples/ Example PDF and transcript
.agents/skills/ Repo-scoped Codex skill
AGENTS.md Repo instructions for Codex
pyproject.toml Python project definition for uv
uv for Python environment managementOPENAI_API_KEY for model-based extraction| Variable | Default | Purpose |
|---|---|---|
OPENAI_API_KEY | — | Enables model-based field extraction |
DEBUG | false | Set to true for debug-level logging |
CORS_ALLOW_ORIGINS | * | Comma-separated allowed origins |
CORS_ALLOW_CREDENTIALS | false | Allow cookies/auth headers cross-origin |
AMBIENTFORM_CACHE_DIR | system temp | Upload cache directory |
FRONTEND_DIST_DIR | frontend/dist | Path to the compiled frontend |
MAX_PDF_BYTES | 20971520 | Maximum accepted PDF size (bytes) |
MAX_PDF_PAGES | (set in code) | Maximum pages per PDF |
UPLOAD_ID_SIGNING_SECRET | — | HMAC secret for upload ID signing |
uv sync --dev
Run the CLI:
uv run python backend/pdf_schema_extract_fill.py \
--pdf examples/Bilan_Prevention_45.pdf \
--text "examples/michael interview.txt"
Run the API server:
uv run python backend/pdf_schema_extract_fill.py serve --host 0.0.0.0 --port 8000
cd frontend
npm install
npm run dev
The Vite dev server proxies all /api requests to the backend at http://localhost:8000,
so no environment variables are needed. Start the backend first, then the frontend.
The repository includes a multi-stage Docker setup where:
frontend is built with Vite during image build — no build-time environment variables requiredfrontend/disthttp://localhost:8000/api/…), so the image is host-agnosticCORS is open (*) by default. To restrict to specific origins, set CORS_ALLOW_ORIGINS at
runtime (see docker-compose.yml for the commented example).
Build and run:
docker compose up --build
docker compose build
docker compose up -d
curl http://localhost:8000/api/health
http://localhost:8000http://localhost:8000/docsdocker compose logs -f ambientform
docker compose down
Then open:
http://localhost:8000http://localhost:8000/api/healthPersistent data:
./data on host is mounted to /app/data in containerupload_id) are stored under /app/data/cacheRun backend CLI inside the container:
docker compose run --rm ambientform \
/app/.venv/bin/python backend/pdf_schema_extract_fill.py \
--pdf examples/Bilan_Prevention_45.pdf \
--text "examples/michael interview.txt"
The frontend uses react-pdf backed by PDF.js. The PDF.js worker is bundled from
pdfjs-dist at build time and served as a local asset — no external CDN requests
are made at runtime.
The form preview supports:
/api/forms/fillThis repository is prepared for Codex-driven production work:
AGENTS.md contains repository instructions for Codex.agents/skills/bilan-prevention/SKILL.md gives Codex workflow-specific guidanceRecommended Codex work sequence:
codex "Review backend request and response contracts and suggest cleanup before production"
codex "Add frontend integration tests for schema upload, extraction, preview, and export"
codex "Improve local extraction rules for real-world French interviews"
codex "Refactor App.jsx into components while keeping pdf.js preview working"
/api/forms/fill route using upload_id returned by /api/forms/schema.react-pdf) with a self-hosted worker — no iframe embedding, no external CDN dependency.Content type
Image
Digest
sha256:7722cddf8…
Size
243.5 MB
Last updated
6 months ago
docker pull kuberlab/ambient-form