# FieldLens FieldLens is the Arrowstack-hosted production application around the reusable, local-first FieldLens Core. ## Repository boundary - `apps/web` owns Arrowstack browser authentication, sync, station/device status and the production PWA shell. - `apps/api` owns JWT/RBAC, sync ingestion, PostgreSQL, device/station registration and server-side provider adapters. - `packages/contracts` is the versioned network contract shared by the browser and API. - `packages/fieldlens-core` is a pinned vendor copy of the public reusable core. - `migrations` contains versioned PostgreSQL schema changes. The public source of truth is `dmparrow/feildlens-core` (spelling intentional). The initial vendor import is pinned to commit: `90d38751eea2bed79f4c9f54c75687ea9aba350a` The private prototype `dmparrow/net` is not a production dependency and is not modified by this repository. ## Local-first invariant Capture writes to IndexedDB first. Remote authentication, API availability, PostgreSQL availability and reference-data availability are not prerequisites for scanner, EAN pallet, OCR/conformity or local review workflows. ## Configuration See the root and app-specific `.env.example` files. Never commit production secrets. ## Validation ```bash npm install npm run verify docker build -t fieldlens . ``` For Arrowstack `database-per-tenant` deployments, the restricted application runtime identity owns DDL inside its dedicated database. The API applies versioned migrations at startup under a PostgreSQL advisory lock before it begins listening; applied migration filenames and checksums are recorded so startup is idempotent and changed historical migrations fail closed.