# vishnu7332/ocean-guard architecture

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

- Interactive diagram: https://gitdiagram.com/vishnu7332/ocean-guard
- Repository: https://github.com/vishnu7332/ocean-guard

## Overview

OceanGuard is a coastal-hazard reporting and monitoring web app. Users enter through the application shell, authenticate when Supabase is configured, and can submit hazard reports or view reports and summary metrics; officials and analysts also have analytics and user-management views. The graph preserves the indexed feature modules, including features whose implementation was not excerpted. Edges are limited to relationships visible in excerpts or the source index; unsampled behavior is not inferred.

Main entry points: [`src/App.tsx`](https://github.com/vishnu7332/ocean-guard/blob/main/src/App.tsx) (Application Shell), [`src/lib/supabase.ts`](https://github.com/vishnu7332/ocean-guard/blob/main/src/lib/supabase.ts) (Supabase Client), [`src/hooks/useAuth.ts`](https://github.com/vishnu7332/ocean-guard/blob/main/src/hooks/useAuth.ts) (Auth State), [`src/components/HazardReporting.tsx`](https://github.com/vishnu7332/ocean-guard/blob/main/src/components/HazardReporting.tsx) (Hazard Reporting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application Shell"]
  node_entry["Web Entry<br/>[main.tsx]"]
  node_app["Application Shell<br/>[App.tsx]"]
  node_header["Header<br/>[Header.tsx]"]
  node_sidebar["Role Navigation<br/>[Sidebar.tsx]"]
end

subgraph group_identity["Identity and Localization"]
  node_authmodal["Sign-in Form<br/>[AuthModal.tsx]"]
  node_auth["Auth State<br/>[useAuth.ts]"]
  node_i18n["Translations<br/>[config.ts]"]
  node_language["Language Switcher"]
end

subgraph group_hazards["Hazard Operations"]
  node_reporting["Hazard Reporting"]
  node_dashboard["Report Dashboard<br/>[Dashboard.tsx]"]
  node_map["Hazard Map<br/>[HazardMap.tsx]"]
  node_supabase["Supabase Client<br/>[supabase.ts]"]
end

subgraph group_oversight["Monitoring and Administration"]
  node_analytics["Social Analytics"]
  node_users["User Management<br/>[UserManagement.tsx]"]
end

node_backend[("Supabase Backend")]
node_googlemaps["Google Maps"]

node_entry -->|"renders"| node_app
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_reporting
node_app -->|"routes to"| node_map
node_app -->|"routes to"| node_analytics
node_app -->|"routes to"| node_users
node_app -->|"renders"| node_authmodal
node_app -->|"renders"| node_sidebar
node_app -->|"renders"| node_header
node_app -->|"reads state"| node_auth
node_authmodal -->|"invokes auth"| node_auth
node_auth -->|"uses client"| node_supabase
node_header -->|"invokes logout"| node_auth
node_header -->|"renders"| node_language
node_entry -->|"initializes"| node_i18n
node_reporting -->|"reads user"| node_auth
node_reporting -->|"writes reports"| node_supabase
node_dashboard -->|"reads reports"| node_supabase
node_map -->|"reads reports"| node_supabase
node_analytics -->|"uses client"| node_supabase
node_supabase -->|"connects to"| node_backend
node_reporting -->|"geocodes location"| node_googlemaps
node_map -->|"renders map"| node_googlemaps

click node_entry "https://github.com/vishnu7332/ocean-guard/blob/main/src/main.tsx"
click node_app "https://github.com/vishnu7332/ocean-guard/blob/main/src/App.tsx"
click node_header "https://github.com/vishnu7332/ocean-guard/blob/main/src/components/Header.tsx"
click node_sidebar "https://github.com/vishnu7332/ocean-guard/blob/main/src/components/Sidebar.tsx"
click node_authmodal "https://github.com/vishnu7332/ocean-guard/blob/main/src/components/AuthModal.tsx"
click node_auth "https://github.com/vishnu7332/ocean-guard/blob/main/src/hooks/useAuth.ts"
click node_i18n "https://github.com/vishnu7332/ocean-guard/blob/main/src/i18n/config.ts"
click node_language "https://github.com/vishnu7332/ocean-guard/blob/main/src/components/LanguageSwitcher.tsx"
click node_reporting "https://github.com/vishnu7332/ocean-guard/blob/main/src/components/HazardReporting.tsx"
click node_dashboard "https://github.com/vishnu7332/ocean-guard/blob/main/src/components/Dashboard.tsx"
click node_map "https://github.com/vishnu7332/ocean-guard/blob/main/src/components/HazardMap.tsx"
click node_analytics "https://github.com/vishnu7332/ocean-guard/blob/main/src/components/SocialAnalytics.tsx"
click node_users "https://github.com/vishnu7332/ocean-guard/blob/main/src/components/UserManagement.tsx"
click node_supabase "https://github.com/vishnu7332/ocean-guard/blob/main/src/lib/supabase.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_entry,node_app,node_header,node_sidebar toneBlue
class node_authmodal,node_auth,node_i18n,node_language,node_backend toneAmber
class node_reporting,node_dashboard,node_map,node_supabase toneMint
class node_analytics,node_users toneRose
class node_googlemaps toneIndigo
```

## Components

### Application Shell

- [Web Entry](https://github.com/vishnu7332/ocean-guard/blob/main/src/main.tsx): `src/main.tsx`
- [Application Shell](https://github.com/vishnu7332/ocean-guard/blob/main/src/App.tsx): `src/App.tsx`
- [Header](https://github.com/vishnu7332/ocean-guard/blob/main/src/components/Header.tsx): `src/components/Header.tsx`
- [Role Navigation](https://github.com/vishnu7332/ocean-guard/blob/main/src/components/Sidebar.tsx): `src/components/Sidebar.tsx`

### Identity and Localization

- [Sign-in Form](https://github.com/vishnu7332/ocean-guard/blob/main/src/components/AuthModal.tsx): `src/components/AuthModal.tsx`
- [Auth State](https://github.com/vishnu7332/ocean-guard/blob/main/src/hooks/useAuth.ts): `src/hooks/useAuth.ts`
- [Translations](https://github.com/vishnu7332/ocean-guard/blob/main/src/i18n/config.ts): `src/i18n/config.ts`
- [Language Switcher](https://github.com/vishnu7332/ocean-guard/blob/main/src/components/LanguageSwitcher.tsx): `src/components/LanguageSwitcher.tsx`

### Hazard Operations

- [Hazard Reporting](https://github.com/vishnu7332/ocean-guard/blob/main/src/components/HazardReporting.tsx): `src/components/HazardReporting.tsx`
- [Report Dashboard](https://github.com/vishnu7332/ocean-guard/blob/main/src/components/Dashboard.tsx): `src/components/Dashboard.tsx`
- [Hazard Map](https://github.com/vishnu7332/ocean-guard/blob/main/src/components/HazardMap.tsx): `src/components/HazardMap.tsx`
- [Supabase Client](https://github.com/vishnu7332/ocean-guard/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`

### Monitoring and Administration

- [Social Analytics](https://github.com/vishnu7332/ocean-guard/blob/main/src/components/SocialAnalytics.tsx): `src/components/SocialAnalytics.tsx`
- [User Management](https://github.com/vishnu7332/ocean-guard/blob/main/src/components/UserManagement.tsx): `src/components/UserManagement.tsx`

### Other components

- **Supabase Backend**
- **Google Maps**

## Connections

- Web Entry → Application Shell: renders (evidence: `src/main.tsx`)
- Application Shell → Report Dashboard: routes to (evidence: `src/App.tsx`)
- Application Shell → Hazard Reporting: routes to (evidence: `src/App.tsx`)
- Application Shell → Hazard Map: routes to (evidence: `src/App.tsx`)
- Application Shell → Social Analytics: routes to (evidence: `src/App.tsx`)
- Application Shell → User Management: routes to (evidence: `src/App.tsx`)
- Application Shell → Sign-in Form: renders (evidence: `src/App.tsx`)
- Application Shell → Role Navigation: renders (evidence: `src/App.tsx`)
- Application Shell → Header: renders (evidence: `src/App.tsx`)
- Application Shell → Auth State: reads state (evidence: `src/App.tsx`)
- Sign-in Form → Auth State: invokes auth (evidence: `src/components/AuthModal.tsx`)
- Auth State → Supabase Client: uses client (evidence: `src/hooks/useAuth.ts`)
- Header → Auth State: invokes logout (evidence: `src/components/Header.tsx`)
- Header → Language Switcher: renders (evidence: `src/components/Header.tsx`)
- Web Entry → Translations: initializes (evidence: `src/main.tsx`)
- Hazard Reporting → Auth State: reads user (evidence: `src/components/HazardReporting.tsx`)
- Hazard Reporting → Supabase Client: writes reports (evidence: `src/components/HazardReporting.tsx`)
- Report Dashboard → Supabase Client: reads reports (evidence: `src/components/Dashboard.tsx`)
- Hazard Map → Supabase Client: reads reports (evidence: `src/components/HazardMap.tsx`)
- Social Analytics → Supabase Client: uses client (evidence: `src/components/SocialAnalytics.tsx`)
- Supabase Client → Supabase Backend: connects to (evidence: `src/lib/supabase.ts`)
- Hazard Reporting → Google Maps: geocodes location (evidence: `src/components/HazardReporting.tsx`)
- Hazard Map → Google Maps: renders map (evidence: `src/components/HazardMap.tsx`)
