TraceCheck AI is a hackathon prototype for pharma incoming-material verification. It helps receiving or QA teams compare a delivery note, certificate of analysis, and material label before releasing a batch into production.
frontend/contains the Vite + React product UIbackend/contains the Express API and the Azure Functions appshared/contains the TraceCheck domain types and validation logic used by the frontend and Express API
- Multi-page React + TypeScript frontend built with Vite
- Shared routed product shell with landing, features, and workspace pages
- Node + TypeScript API layer for secure Azure integration
- API-backed field extraction for uploaded documents
- Editable field-review workflow with OCR baseline restore and approval state
- Cross-document validation and mismatch detection
- Risk scoring and
release / manual review / holdrecommendation - Exportable verification report
GET /api/integration/statusreports whether Azure Document Intelligence is configuredPOST /api/documents/extractextracts text and fields from uploaded documentsPOST /api/analysisreturns the current TraceCheck decision payload- Binary image and PDF uploads use Azure Document Intelligence when credentials are configured
- Text uploads stay fast by using direct API-side parsing plus TraceCheck field extraction
- A standalone Azure Functions v4 TypeScript app now lives in
backend/function-app/ - It mirrors the same backend routes as the local Express API:
GET /api/integration/statusPOST /api/documents/extractPOST /api/analysis
- Use this when you want a real Azure deployment target instead of the local development server
- OCR for binary files when Azure credentials are missing
- ERP and supplier master-data integration
- Historical analytics and approval workflow
npm install
npm run devThis starts both:
- the frontend in
frontend/ - the Express API in
backend/on port8787
If you only want the frontend:
npm run dev:frontendIf you only want the Express backend:
npm run dev:backendIf you want the Azure Function App instead:
npm run dev:functionsBuild every app:
npm run buildPreview the frontend bundle:
npm run previewRun the split app with Docker Compose:
npm run docker:upThat stack exposes:
- frontend on
http://127.0.0.1:4173 - backend on
http://127.0.0.1:8787
Copy backend/.env.example to backend/.env and fill in:
AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT=
AZURE_DOCUMENT_INTELLIGENCE_KEY=
AZURE_DOCUMENT_INTELLIGENCE_MODEL_ID=prebuilt-read
PORT=8787Copy frontend/.env.example to frontend/.env when you want to override the default API wiring:
TRACECHECK_DEV_API_TARGET=http://127.0.0.1:8787
VITE_TRACECHECK_API_BASE_URL=Without these values, the app still works in fallback mode and the API status endpoint will report that Azure is not configured.
Frontend wiring options:
- Default local Express API:
- Keep
TRACECHECK_DEV_API_TARGET=http://127.0.0.1:8787
- Keep
- Docker Compose preview proxy:
- Set
TRACECHECK_PREVIEW_API_TARGET=http://backend:8787inside the frontend container
- Set
- Local Azure Functions host:
- Set
TRACECHECK_DEV_API_TARGET=http://127.0.0.1:7071
- Set
- Deployed Azure Function App:
- Set
VITE_TRACECHECK_API_BASE_URL=https://<your-function-app>.azurewebsites.net - The frontend will call the same
/api/...routes against that base URL
- Set
If the frontend is served from a different domain than the deployed Function App, configure Azure CORS on the Function App to allow the frontend origin.
The root docker-compose.yml is set up for the split repo structure:
frontendbuilds the Vite app, serves it withvite preview, and proxies/apito the backend containerbackendruns the Express API directly from the splitbackend/workspace- Azure credentials remain optional, so the compose stack still boots in fallback mode without extra secrets
Optional Azure values can be injected into Docker Compose from your shell or a root .env file:
AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT=
AZURE_DOCUMENT_INTELLIGENCE_KEY=
AZURE_DOCUMENT_INTELLIGENCE_MODEL_ID=prebuilt-readUseful commands:
npm run docker:buildnpm run docker:upnpm run docker:up:detachednpm run docker:downnpm run docker:logs
- Open the landing page and navigate to the workspace.
- Upload the three incoming material documents.
- Review the extracted fields and correct OCR misses if needed.
- Confirm the validation matrix and flagged discrepancies.
- Approve reviewed documents and export the verification report.
- Use the Azure status card to explain the deployment path.
- Azure Static Web Apps for hosting
- Azure Functions or a serverless API layer for validation orchestration
- Azure AI Document Intelligence for structured document extraction
- Azure Vision for OCR on material-label images
- Azure Language for plain-language explanation or summarization
- The current app is intentionally honest about what is live and what remains roadmap work.
- The Azure integration layer is safe by default: when credentials are missing or a request fails, TraceCheck falls back instead of breaking the workflow.