TankSafe Overview
TankSafe is a React + Supabase portal that digitises tanker inspection workflows. This documentation describes the features implemented in the tank-wise-portal repository and is limited to functionality that can be verified in source code.
Current surface area
| Area | What you can do today |
|---|---|
| Authentication | Email/password sign-in backed by Supabase Auth, invite-based onboarding, time-based one-time passcode (TOTP) MFA. |
| Dashboard | View counts of active, completed-this-month, and overdue inspections. Launch the inspection wizard or search for existing jobs by job number. |
| Inspection Wizard | Complete the guided 10-step workflow covering risk assessment, vapour tightness, leakproofness, hydro/pneumatic, EPRV, checklist, continuity, RVI, charge sheet, and thickness capture. |
| Search & Reporting | Filter inspections by status/date, review completeness, and open inspection detail pages. |
| Inspector Workspace | Inspectors view assigned jobs, track completeness, and jump into the wizard. |
| Admin Console | Manage jobs, edit inspection data, view job dossiers, assign inspectors, maintain the drag-and-drop schedule, manage users, and enforce MFA. |
Key roles represented in code
- Administrators (profile
role: 'administrator') can access all admin routes:/admin/jobs,/admin/jobs/:job,/admin/jobs/:job/edit,/admin/schedule,/admin/users, and/admin/settings. - Inspectors (profile
role: 'inspector') can run inspections, view their job list at/inspector/jobs, and use the dashboard/search surfaces.
The portal does not implement separate supervisor personas, incident management, or offline sync flows yet. Any legacy references to those capabilities have been removed or marked as future work.
Architectural snapshot
- Frontend: Vite + React + TypeScript with Tailwind, Shadcn UI, and Radix primitives. Routes live under
src/pagesand are wrapped byProtectedRouteto enforce role checks. - Data access: All data operations call Supabase directly through the generated client (
src/integrations/supabase/client.ts). Queries for jobs, forms, grids, and schedule data reside inside the relevant page components and helper utilities (src/lib/api.ts,src/lib/gridConfigs.ts,src/lib/formSchemas.ts). - Edge functions: Admin user administration calls the Supabase Edge Functions located at
supabase/functions/admin-*. No other automation layers are implemented. - Assets: The portal renders PDFs client-side using React-PDF components in
src/components/pdf, but automated generation queues are not implemented.
See Technical Guides › Architecture for a deeper walkthrough with file pointers.
Primary workflows (code-backed)
- Create or resume an inspection — From the dashboard or Admin Jobs table, open
/inspect/:job/wizardto step through forms and grids, saving to Supabase at each step. - Search inspections —
/searchsurfaces inspection records with filters for status and date range, using Supabase queries plus completeness calculations. - Admin job review —
/admin/jobs/:jobloads inspection details, form responses, checklist data, continuity readings, and charge sheet summaries in read-only tabs. - Edit inspection data —
/admin/jobs/:job/editlets administrators update inspection metadata, form responses, and grid rows via shared helper utilities. - Plan the schedule —
/admin/scheduledisplays a drag-and-drop calendar built withreact-big-calendar, drawing frominspections,inspectors, and availability tables. - Manage users —
/admin/usersinvokes edge functions to invite, update, delete users, and check MFA status; administrators can assign inspectors to jobs via dropdowns in Admin Jobs. - Configure MFA —
/admin/settingsopens an authenticator management dialog powered by theSecuritySettingsDialogcomponent.
What is deliberately out of scope right now
- Incident reporting, support playbooks, automated exports, and custom analytics dashboards.
- Offline-first functionality or background sync for the wizard.
- Integration connectors beyond the Supabase resources referenced above.
As new features land in the repository, extend this page and linked guides accordingly. Until then, stick to the workflows surfaced above so the docs stay aligned with the codebase.