# avnipahal624/polaris_ architecture

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

- Interactive diagram: https://gitdiagram.com/avnipahal624/polaris_
- Repository: https://github.com/avnipahal624/polaris_

## Overview

POLARIS is an Antarctic expedition-operations command center. Visitors enter through the landing page, authenticate with email OTP or as a guest, then reach the protected dashboard to monitor and manage field operations. The repository also contains distinct mapping, safety, intelligence, offline-sync, and HomeLink capabilities, backed by Convex authentication and operational data functions. The route and auth relationships are visible in the entry-point and auth excerpts; most operational UI and backend modules were not sampled, so their connections are left unverified rather than inferred.

Main entry points: [`pages/Dashboard.tsx`](https://github.com/avnipahal624/polaris_/blob/main/pages/Dashboard.tsx) (Operations dashboard), [`convex/polaris/lib.ts`](https://github.com/avnipahal624/polaris_/blob/main/convex/polaris/lib.ts) (Backend core), [`main.tsx`](https://github.com/avnipahal624/polaris_/blob/main/main.tsx) (App routes), [`components/RequireAuth.tsx`](https://github.com/avnipahal624/polaris_/blob/main/components/RequireAuth.tsx) (Route guard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and routing"]
  node_app["App routes<br/>[main.tsx]"]
  node_landing["Landing page<br/>[Landing.tsx]"]
  node_authpage["Sign-in page<br/>[Auth.tsx]"]
  node_routeguard["Route guard<br/>[RequireAuth.tsx]"]
  node_authhook["Auth hook<br/>[use-auth.ts]"]
end

subgraph group_ops["Operations workspace"]
  node_dashboard["Operations dashboard<br/>[Dashboard.tsx]"]
  node_opsconsole["Operator console"]
  node_moduleviews["Module views<br/>[module-views.tsx]"]
  node_homelink["HomeLink views<br/>[homelink-views.tsx]"]
end

subgraph group_field["Field and safety"]
  node_map["Antarctic map<br/>[antarctic-map.tsx]"]
  node_fieldmode["Field mode<br/>[field-mode.tsx]"]
  node_safety["Safety views<br/>[safety-views.tsx]"]
  node_offlinesync["Offline sync<br/>[offline-sync.tsx]"]
end

subgraph group_data["Operational data"]
  node_polargeo["Geospatial logic<br/>[polar-geo.ts]"]
  node_polarintel["Intelligence logic<br/>[polar-intel.ts]"]
  node_polardata["Operational data<br/>[polar-data.ts]"]
  node_polardb["Local data helpers<br/>[polar-db.ts]"]
end

subgraph group_backend["Convex backend"]
  node_authbackend["Auth providers<br/>[auth.ts]"]
  node_convexlib["Backend core<br/>[lib.ts]"]
  node_queries["Operational queries<br/>[queries.ts]"]
  node_mutations["Operational mutations<br/>[mutations.ts]"]
  node_schema[("Data schema<br/>[schema.ts]")]
end

node_operator(("Operator"))

node_operator -.->|"opens"| node_landing
node_operator -.->|"signs in"| node_authpage
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_authpage
node_app -->|"guards route"| node_routeguard
node_routeguard -->|"renders when authorized"| node_dashboard
node_routeguard -->|"checks auth"| node_authhook
node_authpage -->|"signs in through"| node_authhook
node_authhook -.->|"uses auth service"| node_authbackend
node_dashboard -.->|"renders"| node_opsconsole
node_dashboard -.->|"renders"| node_moduleviews
node_dashboard -.->|"renders"| node_homelink
node_dashboard -.->|"renders"| node_map
node_dashboard -.->|"renders"| node_fieldmode
node_dashboard -.->|"renders"| node_safety
node_dashboard -.->|"uses"| node_offlinesync
node_convexlib -->|"imports helpers"| node_polardb
node_convexlib -->|"calls geospatial logic"| node_polargeo
node_convexlib -.->|"supports"| node_queries
node_convexlib -.->|"supports"| node_mutations
node_mutations -.->|"writes records"| node_schema
node_queries -.->|"reads records"| node_schema
node_polardata -.->|"uses"| node_polarintel
node_polardata -.->|"uses"| node_polardb

click node_app "https://github.com/avnipahal624/polaris_/blob/main/main.tsx"
click node_landing "https://github.com/avnipahal624/polaris_/blob/main/pages/Landing.tsx"
click node_authpage "https://github.com/avnipahal624/polaris_/blob/main/pages/Auth.tsx"
click node_routeguard "https://github.com/avnipahal624/polaris_/blob/main/components/RequireAuth.tsx"
click node_authhook "https://github.com/avnipahal624/polaris_/blob/main/hooks/use-auth.ts"
click node_authbackend "https://github.com/avnipahal624/polaris_/blob/main/convex/auth.ts"
click node_dashboard "https://github.com/avnipahal624/polaris_/blob/main/pages/Dashboard.tsx"
click node_opsconsole "https://github.com/avnipahal624/polaris_/blob/main/components/operator-console.tsx"
click node_moduleviews "https://github.com/avnipahal624/polaris_/blob/main/components/module-views.tsx"
click node_homelink "https://github.com/avnipahal624/polaris_/blob/main/components/homelink-views.tsx"
click node_map "https://github.com/avnipahal624/polaris_/blob/main/components/antarctic-map.tsx"
click node_fieldmode "https://github.com/avnipahal624/polaris_/blob/main/components/field-mode.tsx"
click node_safety "https://github.com/avnipahal624/polaris_/blob/main/components/safety-views.tsx"
click node_offlinesync "https://github.com/avnipahal624/polaris_/blob/main/components/offline-sync.tsx"
click node_polargeo "https://github.com/avnipahal624/polaris_/blob/main/lib/polar-geo.ts"
click node_polarintel "https://github.com/avnipahal624/polaris_/blob/main/lib/polar-intel.ts"
click node_polardata "https://github.com/avnipahal624/polaris_/blob/main/lib/polar-data.ts"
click node_polardb "https://github.com/avnipahal624/polaris_/blob/main/lib/polar-db.ts"
click node_convexlib "https://github.com/avnipahal624/polaris_/blob/main/convex/polaris/lib.ts"
click node_queries "https://github.com/avnipahal624/polaris_/blob/main/convex/polaris/queries.ts"
click node_mutations "https://github.com/avnipahal624/polaris_/blob/main/convex/polaris/mutations.ts"
click node_schema "https://github.com/avnipahal624/polaris_/blob/main/convex/schema.ts"

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_app,node_landing,node_authpage,node_routeguard,node_authhook toneBlue
class node_dashboard,node_opsconsole,node_moduleviews,node_homelink toneAmber
class node_map,node_fieldmode,node_safety,node_offlinesync toneMint
class node_polargeo,node_polarintel,node_polardata,node_polardb toneRose
class node_authbackend,node_convexlib,node_queries,node_mutations,node_schema,node_operator toneIndigo
```

## Components

### Access and routing

- [App routes](https://github.com/avnipahal624/polaris_/blob/main/main.tsx): `main.tsx`
- [Landing page](https://github.com/avnipahal624/polaris_/blob/main/pages/Landing.tsx): `pages/Landing.tsx`
- [Sign-in page](https://github.com/avnipahal624/polaris_/blob/main/pages/Auth.tsx): `pages/Auth.tsx`
- [Route guard](https://github.com/avnipahal624/polaris_/blob/main/components/RequireAuth.tsx): `components/RequireAuth.tsx`
- [Auth hook](https://github.com/avnipahal624/polaris_/blob/main/hooks/use-auth.ts): `hooks/use-auth.ts`

### Operations workspace

- [Operations dashboard](https://github.com/avnipahal624/polaris_/blob/main/pages/Dashboard.tsx): `pages/Dashboard.tsx`
- [Operator console](https://github.com/avnipahal624/polaris_/blob/main/components/operator-console.tsx): `components/operator-console.tsx`
- [Module views](https://github.com/avnipahal624/polaris_/blob/main/components/module-views.tsx): `components/module-views.tsx`
- [HomeLink views](https://github.com/avnipahal624/polaris_/blob/main/components/homelink-views.tsx): `components/homelink-views.tsx`

### Field and safety

- [Antarctic map](https://github.com/avnipahal624/polaris_/blob/main/components/antarctic-map.tsx): `components/antarctic-map.tsx`
- [Field mode](https://github.com/avnipahal624/polaris_/blob/main/components/field-mode.tsx): `components/field-mode.tsx`
- [Safety views](https://github.com/avnipahal624/polaris_/blob/main/components/safety-views.tsx): `components/safety-views.tsx`
- [Offline sync](https://github.com/avnipahal624/polaris_/blob/main/components/offline-sync.tsx): `components/offline-sync.tsx`

### Operational data

- [Geospatial logic](https://github.com/avnipahal624/polaris_/blob/main/lib/polar-geo.ts): `lib/polar-geo.ts`
- [Intelligence logic](https://github.com/avnipahal624/polaris_/blob/main/lib/polar-intel.ts): `lib/polar-intel.ts`
- [Operational data](https://github.com/avnipahal624/polaris_/blob/main/lib/polar-data.ts): `lib/polar-data.ts`
- [Local data helpers](https://github.com/avnipahal624/polaris_/blob/main/lib/polar-db.ts): `lib/polar-db.ts`

### Convex backend

- [Auth providers](https://github.com/avnipahal624/polaris_/blob/main/convex/auth.ts): `convex/auth.ts`
- [Backend core](https://github.com/avnipahal624/polaris_/blob/main/convex/polaris/lib.ts): `convex/polaris/lib.ts`
- [Operational queries](https://github.com/avnipahal624/polaris_/blob/main/convex/polaris/queries.ts): `convex/polaris/queries.ts`
- [Operational mutations](https://github.com/avnipahal624/polaris_/blob/main/convex/polaris/mutations.ts): `convex/polaris/mutations.ts`
- [Data schema](https://github.com/avnipahal624/polaris_/blob/main/convex/schema.ts): `convex/schema.ts`

### Other components

- **Operator**

## Connections

- Operator → Landing page: opens
- Operator → Sign-in page: signs in
- App routes → Landing page: routes to (evidence: `main.tsx`)
- App routes → Sign-in page: routes to (evidence: `main.tsx`)
- App routes → Route guard: guards route (evidence: `main.tsx`)
- Route guard → Operations dashboard: renders when authorized (evidence: `main.tsx`)
- Route guard → Auth hook: checks auth (evidence: `components/RequireAuth.tsx`)
- Sign-in page → Auth hook: signs in through (evidence: `pages/Auth.tsx`)
- Auth hook → Auth providers: uses auth service
- Operations dashboard → Operator console: renders
- Operations dashboard → Module views: renders
- Operations dashboard → HomeLink views: renders
- Operations dashboard → Antarctic map: renders
- Operations dashboard → Field mode: renders
- Operations dashboard → Safety views: renders
- Operations dashboard → Offline sync: uses
- Backend core → Local data helpers: imports helpers (evidence: `convex/polaris/lib.ts`)
- Backend core → Geospatial logic: calls geospatial logic (evidence: `convex/polaris/lib.ts`)
- Backend core → Operational queries: supports
- Backend core → Operational mutations: supports
- Operational mutations → Data schema: writes records
- Operational queries → Data schema: reads records
- Operational data → Intelligence logic: uses
- Operational data → Local data helpers: uses
