How joshua-onyekachukwu/provance-original works
Purpose and boundaries
Provance is a synthetic-media verification MVP: a public marketing site plus an authenticated workspace where invited users upload images, initiate verification scans, and review printable reports. The active implementation is React/Vite frontend + NestJS API/worker; api/ is explicitly legacy and should not receive new work. Paths: src/main.jsx, backend/src/main.ts, api/server.js.
Frontend application and routing
The Vite React entry mounts public pages, auth flows, and /app/* workspace routes. Authentication state and route protection are client-side concerns; API calls and Supabase client integration are centralized separately. Key paths: src/App.jsx, src/context/AuthContext.jsx, src/components/auth/ProtectedRoute.jsx.
Public onboarding and access control
Public visitors can submit waitlist applications, then use invite acceptance, sign-in, and password-reset flows. The Nest auth and waitlist modules expose versioned /v1 endpoints and mediate Supabase-backed identity operations. Admin-only controls are guarded server-side. Paths: backend/src/auth/auth.controller.ts, backend/src/waitlist/waitlist.service.ts, backend/src/common/guards/admin.guard.ts.
Authenticated verification workspace
Workspace pages cover dashboard, upload submission, scan/report history and detail, print output, account, team placeholder, and admin operations. The frontend obtains signed upload capability and scan state through its API layer; report presentation derives from scan payloads and MVP signals. Paths: src/pages/app/AppUploadsPage.jsx, src/pages/app/AppReportsPage.jsx, src/lib/api.js.
Scan lifecycle and asynchronous boundary
The primary control flow is: authenticated user selects a supported image → frontend requests scan/upload workflow → media is placed in Supabase Storage through signed access → API creates/updates a scan record → submission enqueues work → separate worker consumes the job and writes asynchronous status/results → UI polls scan endpoints and renders reports. The queue boundary keeps scan processing out of API request latency. Paths: backend/src/scans/scans.service.ts, backend/src/queue/queue.service.ts, backend/src/worker.ts.
Persistence and external infrastructure
Supabase supplies authentication, database persistence, and object storage; SQL migrations define waitlist/auth, scans, admin operations, and profiles. BullMQ-compatible queue wiring uses Upstash Redis. Production topology separates API and worker on Fly.io, while the frontend deploys to Vercel. Paths: backend/src/supabase/supabase.service.ts, supabase/migrations/0002_scans.sql, backend/fly.worker.toml.
API composition and operational controls
AppModule composes account, auth, admin, scans, waitlist, Supabase, queue, and health modules. Cross-cutting guards enforce Supabase authentication, admin access, and throttling; a global exception filter establishes API error handling. Account preferences presently remain local on the frontend despite backend account scaffolding, making profile persistence an intentional unfinished boundary. Paths: backend/src/app.module.ts, backend/src/common/guards/supabase-auth.guard.ts, backend/src/account/account.service.ts.
Main entry points: supabase.service.ts Supabase · app.module.ts Application modules · main.ts API bootstrap · App.jsx Routes and pages
Components 18
React frontend
Vite public and authenticated workspace.
- Vite entry
src/main.jsx - Routes and pages · Serves public onboarding, auth, and /app workspace pages.
src/App.jsx - Auth state · Maintains client authentication state.
src/context/AuthContext.jsx - Workspace guard · Protects authenticated workspace routes.
src/components/auth/ProtectedRoute.jsx - Uploads and reports · Submits images, polls scans, and presents printable reports.
src/pages/app/AppReportsPage.jsx - API client · Centralizes API calls and Supabase client integration.
src/lib/api.js
NestJS API
Versioned application API and access controls.
- API bootstrap
backend/src/main.ts - Application modules · Composes auth, scans, accounts, admin, queue, waitlist, Supabase, and health.
backend/src/app.module.ts - Auth and waitlist · Handles invitations, sign-in support, reset flows, and applications.
backend/src/auth/auth.controller.ts - Auth, admin, throttling · Supabase authentication and server-side admin enforcement.
backend/src/common/guards/supabase-auth.guard.ts - Scan workflow · Creates scan records, issues upload workflow, and exposes status/results.
backend/src/scans/scans.service.ts
Async scanning
Queue-backed scan processing.
- Job producer · Enqueues scan work outside request latency.
backend/src/queue/queue.service.ts - Scan worker · Consumes scan jobs and persists asynchronous results.
backend/src/worker.ts
Platform services
Managed persistence, queue infrastructure, and deployments.
- Supabase · Provides identity, scan persistence, and signed object storage.
backend/src/supabase/supabase.service.ts - SQL schema · Defines scans, profiles, waitlist/auth, and admin data.
supabase/migrations/0002_scans.sql - Upstash Redis
- Production deployment · Frontend deploys to Vercel; API and worker run separately on Fly.io.
backend/fly.worker.toml
Other components
- Legacy API · Explicitly excluded from new work.
api/server.js
Connections 21
- Vite entry → Routes and pages: mounts
- Routes and pages → Auth state: uses
- Routes and pages → Workspace guard: guards /app
- Workspace guard → Uploads and reports: allows
- Uploads and reports → API client: requests workflow and status
- API client → API bootstrap: calls /v1 API
- API bootstrap → Application modules: loads
- Application modules → Auth and waitlist: composes
- Application modules → Auth, admin, throttling: applies
- Application modules → Scan workflow: composes
- Auth and waitlist → Supabase: identity and applications
- Auth, admin, throttling → Supabase: validates identity
- Scan workflow → Supabase: scan records and signed uploads
- Scan workflow → Job producer: submits scan
- Job producer → Upstash Redis: publishes jobs
- Upstash Redis → Scan worker: delivers jobs
- Scan worker → Supabase: writes status and results
- SQL schema → Supabase: defines schema
- Production deployment → API bootstrap: hosts API
- Production deployment → Scan worker: hosts separately
- Legacy API → API bootstrap: replaced by