# lanzmallorca14/aquareg2 architecture

> Architecture diagram of the GitHub repository lanzmallorca14/aquareg2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lanzmallorca14/aquareg2
- Repository: https://github.com/lanzmallorca14/aquareg2

## Overview

AquaReg is a vessel-registration and maritime permit application with public registration/verification and authenticated admin and inspector portals. The principal workflow runs from registration and supporting documents, through inspection and permit issuance, to permit verification; the app also includes renewals, records, analytics, account administration, and offline persistence/sync. Routing and the sampled context establish the main structure; unsampled feature-page internals are represented by their exact paths, and edges are limited to documented routing or visible references.

Main entry points: [`src/app/routes.tsx`](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/routes.tsx) (Route dispatch), [`src/app/components/adminlayout.tsx`](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/components/adminlayout.tsx) (Admin workspace), [`src/app/components/context/AquaRegCONTEXT.tsx`](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/components/context/AquaRegCONTEXT.tsx) (Shared registry state), [`src/app/pages/admin/PermitGeneration.tsx`](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/admin/PermitGeneration.tsx) (Permit generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry and access"]
  node_router["Route dispatch<br/>[routes.tsx]"]
  node_session["Application bootstrap<br/>[main.tsx]"]
  node_auth["Sign-in and registration<br/>[login.tsx]"]
  node_public["Public landing<br/>[heropage.tsx]"]
end

subgraph group_registry["Vessel registry"]
  node_registration["Vessel registration"]
  node_renewal["Permit renewal<br/>[renewal.tsx]"]
  node_verification["Permit verification<br/>[VerifyPermit.tsx]"]
  node_qrpermit["QR permit lookup<br/>[qr_permit.tsx]"]
end

subgraph group_operations["Admin and inspections"]
  node_admin["Admin workspace<br/>[adminlayout.tsx]"]
  node_dashboard["Admin dashboard<br/>[Dashboard.tsx]"]
  node_audit["Audit queue<br/>[AuditQueuePage.tsx]"]
  node_permits["Permit generation"]
  node_analytics["Analytics reports<br/>[Analytics.tsx]"]
  node_records["Registry records<br/>[records.tsx]"]
  node_accounts["Account administration<br/>[accounts.tsx]"]
  node_inspectorlayout["Inspector workspace"]
  node_inspectordash["Inspector dashboard"]
  node_inspection["Vessel inspection<br/>[InspectionCOI.tsx]"]
  node_tally["Inspection records<br/>[tally.tsx]"]
end

subgraph group_offline["Offline data"]
  node_offline_db[("Offline database<br/>[db.tsx]")]
  node_sync["Offline synchronization<br/>[sync.tsx]"]
  node_queue["Sync queue<br/>[queue.tsx]"]
end

subgraph group_shared["Shared application state"]
  node_state["Shared registry state<br/>[AquaRegCONTEXT.tsx]"]
  node_supabaseclient["Supabase client<br/>[supabaseClient.tsx]"]
end

node_user(("Applicant or staff"))
node_supabase[("Supabase services")]

node_user -->|"navigates"| node_router
node_session -->|"mounts routes"| node_router
node_router -->|"routes to"| node_public
node_router -->|"routes to"| node_auth
node_router -->|"routes to"| node_registration
node_router -->|"routes to"| node_renewal
node_router -->|"routes to"| node_verification
node_router -->|"routes to"| node_qrpermit
node_router -->|"routes to"| node_admin
node_router -->|"routes to"| node_inspectorlayout
node_admin -->|"renders"| node_dashboard
node_admin -->|"renders"| node_audit
node_admin -->|"renders"| node_permits
node_admin -->|"renders"| node_analytics
node_admin -->|"renders"| node_records
node_admin -->|"renders"| node_accounts
node_admin -->|"renders"| node_renewal
node_admin -->|"renders"| node_inspection
node_inspectorlayout -->|"renders"| node_inspectordash
node_inspectorlayout -->|"renders"| node_inspection
node_inspectorlayout -->|"renders"| node_tally
node_session -->|"provides context"| node_state
node_session -->|"configures"| node_supabaseclient
node_supabaseclient -->|"connects"| node_supabase
node_state -->|"reads and writes"| node_offline_db
node_state -->|"loads"| node_sync
node_sync -->|"uses"| node_offline_db
node_registration -->|"adds vessels"| node_state
node_registration -->|"saves images"| node_offline_db
node_permits -->|"updates vessel"| node_state
node_permits -->|"queries permits"| node_supabaseclient
node_permits -->|"caches permits"| node_offline_db
node_verification -->|"uses registry context"| node_state
node_auth -->|"uses auth context"| node_state

click node_router "https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/routes.tsx"
click node_session "https://github.com/lanzmallorca14/aquareg2/blob/main/src/main.tsx"
click node_auth "https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/login.tsx"
click node_public "https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/heropage.tsx"
click node_registration "https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/home/NewRegistration.tsx"
click node_renewal "https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/home/renewal.tsx"
click node_verification "https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/VerifyPermit.tsx"
click node_qrpermit "https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/admin/qr_permit.tsx"
click node_admin "https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/components/adminlayout.tsx"
click node_dashboard "https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/admin/Dashboard.tsx"
click node_audit "https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/admin/AuditQueuePage.tsx"
click node_permits "https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/admin/PermitGeneration.tsx"
click node_analytics "https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/admin/Analytics.tsx"
click node_records "https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/admin/records.tsx"
click node_accounts "https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/admin/accounts.tsx"
click node_inspectorlayout "https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/components/inspectorlayout.tsx"
click node_inspectordash "https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/inspector/inspectordashboard.tsx"
click node_inspection "https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/inspector/InspectionCOI.tsx"
click node_tally "https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/inspector/tally.tsx"
click node_state "https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/components/context/AquaRegCONTEXT.tsx"
click node_supabaseclient "https://github.com/lanzmallorca14/aquareg2/blob/main/src/supabaseClient.tsx"
click node_offline_db "https://github.com/lanzmallorca14/aquareg2/blob/main/src/offline/db.tsx"
click node_sync "https://github.com/lanzmallorca14/aquareg2/blob/main/src/offline/sync.tsx"
click node_queue "https://github.com/lanzmallorca14/aquareg2/blob/main/src/offline/queue.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_router,node_session,node_auth,node_public toneBlue
class node_registration,node_renewal,node_verification,node_qrpermit,node_supabase toneAmber
class node_admin,node_dashboard,node_audit,node_permits,node_analytics,node_records,node_accounts,node_inspectorlayout,node_inspectordash,node_inspection,node_tally toneMint
class node_offline_db,node_sync,node_queue toneRose
class node_state,node_supabaseclient,node_user toneIndigo
```

## Components

### App entry and access

- [Route dispatch](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/routes.tsx): `src/app/routes.tsx`
- [Application bootstrap](https://github.com/lanzmallorca14/aquareg2/blob/main/src/main.tsx): `src/main.tsx`
- [Sign-in and registration](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/login.tsx): `src/app/login.tsx`
- [Public landing](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/heropage.tsx): `src/app/heropage.tsx`

### Vessel registry

- [Vessel registration](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/home/NewRegistration.tsx): `src/app/pages/home/NewRegistration.tsx`
- [Permit renewal](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/home/renewal.tsx): `src/app/pages/home/renewal.tsx`
- [Permit verification](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/VerifyPermit.tsx): `src/app/pages/VerifyPermit.tsx`
- [QR permit lookup](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/admin/qr_permit.tsx): `src/app/pages/admin/qr_permit.tsx`

### Admin and inspections

- [Admin workspace](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/components/adminlayout.tsx): `src/app/components/adminlayout.tsx`
- [Admin dashboard](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/admin/Dashboard.tsx): `src/app/pages/admin/Dashboard.tsx`
- [Audit queue](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/admin/AuditQueuePage.tsx): `src/app/pages/admin/AuditQueuePage.tsx`
- [Permit generation](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/admin/PermitGeneration.tsx): `src/app/pages/admin/PermitGeneration.tsx`
- [Analytics reports](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/admin/Analytics.tsx): `src/app/pages/admin/Analytics.tsx`
- [Registry records](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/admin/records.tsx): `src/app/pages/admin/records.tsx`
- [Account administration](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/admin/accounts.tsx): `src/app/pages/admin/accounts.tsx`
- [Inspector workspace](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/components/inspectorlayout.tsx): `src/app/components/inspectorlayout.tsx`
- [Inspector dashboard](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/inspector/inspectordashboard.tsx): `src/app/pages/inspector/inspectordashboard.tsx`
- [Vessel inspection](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/inspector/InspectionCOI.tsx): `src/app/pages/inspector/InspectionCOI.tsx`
- [Inspection records](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/pages/inspector/tally.tsx): `src/app/pages/inspector/tally.tsx`

### Offline data

- [Offline database](https://github.com/lanzmallorca14/aquareg2/blob/main/src/offline/db.tsx): `src/offline/db.tsx`
- [Offline synchronization](https://github.com/lanzmallorca14/aquareg2/blob/main/src/offline/sync.tsx): `src/offline/sync.tsx`
- [Sync queue](https://github.com/lanzmallorca14/aquareg2/blob/main/src/offline/queue.tsx): `src/offline/queue.tsx`

### Shared application state

- [Shared registry state](https://github.com/lanzmallorca14/aquareg2/blob/main/src/app/components/context/AquaRegCONTEXT.tsx): `src/app/components/context/AquaRegCONTEXT.tsx`
- [Supabase client](https://github.com/lanzmallorca14/aquareg2/blob/main/src/supabaseClient.tsx): `src/supabaseClient.tsx`

### Other components

- **Applicant or staff**
- **Supabase services**

## Connections

- Applicant or staff → Route dispatch: navigates (evidence: `src/app/routes.tsx`)
- Application bootstrap → Route dispatch: mounts routes (evidence: `src/main.tsx`)
- Route dispatch → Public landing: routes to (evidence: `src/app/routes.tsx`)
- Route dispatch → Sign-in and registration: routes to (evidence: `src/app/routes.tsx`)
- Route dispatch → Vessel registration: routes to (evidence: `src/app/routes.tsx`)
- Route dispatch → Permit renewal: routes to (evidence: `src/app/routes.tsx`)
- Route dispatch → Permit verification: routes to (evidence: `src/app/routes.tsx`)
- Route dispatch → QR permit lookup: routes to (evidence: `src/app/routes.tsx`)
- Route dispatch → Admin workspace: routes to (evidence: `src/app/routes.tsx`)
- Route dispatch → Inspector workspace: routes to (evidence: `src/app/routes.tsx`)
- Admin workspace → Admin dashboard: renders (evidence: `src/app/routes.tsx`)
- Admin workspace → Audit queue: renders (evidence: `src/app/routes.tsx`)
- Admin workspace → Permit generation: renders (evidence: `src/app/routes.tsx`)
- Admin workspace → Analytics reports: renders (evidence: `src/app/routes.tsx`)
- Admin workspace → Registry records: renders (evidence: `src/app/routes.tsx`)
- Admin workspace → Account administration: renders (evidence: `src/app/routes.tsx`)
- Admin workspace → Permit renewal: renders (evidence: `src/app/routes.tsx`)
- Admin workspace → Vessel inspection: renders (evidence: `src/app/routes.tsx`)
- Inspector workspace → Inspector dashboard: renders (evidence: `src/app/routes.tsx`)
- Inspector workspace → Vessel inspection: renders (evidence: `src/app/routes.tsx`)
- Inspector workspace → Inspection records: renders (evidence: `src/app/routes.tsx`)
- Application bootstrap → Shared registry state: provides context (evidence: `src/main.tsx`)
- Application bootstrap → Supabase client: configures (evidence: `src/main.tsx`)
- Supabase client → Supabase services: connects (evidence: `src/supabaseClient.tsx`)
- Shared registry state → Offline database: reads and writes (evidence: `src/app/components/context/AquaRegCONTEXT.tsx`)
- Shared registry state → Offline synchronization: loads (evidence: `src/app/components/context/AquaRegCONTEXT.tsx`)
- Offline synchronization → Offline database: uses (evidence: `src/offline/sync.tsx`)
- Vessel registration → Shared registry state: adds vessels (evidence: `src/app/pages/home/NewRegistration.tsx`)
- Vessel registration → Offline database: saves images (evidence: `src/app/pages/home/NewRegistration.tsx`)
- Permit generation → Shared registry state: updates vessel (evidence: `src/app/pages/admin/PermitGeneration.tsx`)
- Permit generation → Supabase client: queries permits (evidence: `src/app/pages/admin/PermitGeneration.tsx`)
- Permit generation → Offline database: caches permits (evidence: `src/app/pages/admin/PermitGeneration.tsx`)
- Permit verification → Shared registry state: uses registry context (evidence: `src/app/pages/VerifyPermit.tsx`)
- Sign-in and registration → Shared registry state: uses auth context (evidence: `src/app/login.tsx`)
