Print bug: remove hidden-iframe auto-print in printAttachment that fired the OS print dialog on iframe.onload; open attachment in a new tab instead so print only happens on an explicit Ctrl+P. Drop now-dead printIframeRef/cleanupPrintFrame. Cell format persistence: new CellFormatToolbar + cellFormat.js save the last saved per-claim-type header/item format to localStorage; new claims and added rows inherit it so users don't re-size/re-bold each time. Backend cell_format_service renders _cellFormat in Excel/PDF. Bun migration: replace Node/yarn with Bun for the frontend build. Dockerfile uses oven/bun:1-alpine; bun.lock replaces yarn.lock/package-lock.json; start.bat files use bun. Frontend dev uses relative baseURL + craco proxy on port 5000 (avoids CORS and the Grafana conflict on 3000). 1-click launch: root start.bat boots backend (uvicorn :8002) and frontend (craco :5000) in child windows and opens the browser. Repo cleanup: remove Node/yarn lockfiles, cursor sync scripts, stray test reports/PDFs, root package.json/requirements.txt duplicates. Backend services: claim_document_storage, payslip_storage, pdf_company_extractor; attachment filenames normalized from PDF text. Security: gitignore now excludes docker/local env files (with .env.example allowed) so the live JWT secret cannot be committed. Co-Authored-By: Claude <noreply@anthropic.com>
2.4 KiB
2.4 KiB
Docker Desktop (Windows / macOS / Linux)
A two-container stack: frontend (nginx + React build) and backend (FastAPI on port 8002). MongoDB stays on the host and is reached via host.docker.internal:27017.
Prerequisites
- Docker Desktop running
- A local MongoDB service (default
mongodb://127.0.0.1:27017, databaseclaim) backend/.envpopulated (seebackend/.env.example)
Build & start
# from the repo root
docker compose -f docker-compose.claim.yml up --build
URLs:
- SPA: http://localhost:8080
- API: http://localhost:8002 (also proxied as
/apifrom the SPA)
What runs where
| Service | Image | Port (host) | Notes |
|---|---|---|---|
| frontend | claim-frontend:local | 8080 → 80 | nginx serves the React build; proxies /api to backend:8002 |
| backend | claim-backend:local | 8002 → 8002 | FastAPI / uvicorn; uses LibreOffice for Excel → PDF |
The backend reads backend/.env plus the environment: overrides from compose, so MONGO_URL is forced to mongodb://host.docker.internal:27017 regardless of the .env value.
Data persistence
claim_uploadsnamed volume →/app/backend/claim_filesclaim_attachnamed volume →/app/backend/claim_attachments- MongoDB data lives on the host (Windows service) — make sure the
claimdatabase exists or is auto-created on first connection.
Rebuilding after code changes
docker compose -f docker-compose.claim.yml up --build
# or rebuild only one service
docker compose -f docker-compose.claim.yml build backend
CORS
FRONTEND_URL and CORS_ORIGINS are set to http://localhost:8080 by compose. The SPA also talks to the same origin via the nginx proxy, so cookies work without CORS pre-flights.
Common gotchas
- "ECONNREFUSED 127.0.0.1:27017" — the backend cannot reach your host Mongo. Confirm Mongo is listening on
127.0.0.1:27017and that you started Mongo before the container. Theextra_hosts: host.docker.internal:host-gatewayline is required for older Docker setups. - "JWT_SECRET missing" — copy
backend/.env.exampletobackend/.envand fill in the secrets. - Print/PDF issues on Windows — the backend uses LibreOffice Calc (not Excel COM) inside the container, so the printed layout may differ slightly from the Windows dev environment. This is a known difference.