# utkrsh-verma/nearu architecture

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

- Interactive diagram: https://gitdiagram.com/utkrsh-verma/nearu
- Repository: https://github.com/utkrsh-verma/nearu

## Overview

NearU is a campus-verified dating web app for GL Bajaj students. Students sign in, verify campus eligibility, complete a profile, discover and like or pass on profiles, then use mutual matches to chat. The graph also shows profile-photo storage and realtime updates as supporting layers. The README and excerpts establish the product and several interactions; unsampled route details and integrations are left out or marked unverified.

Main entry points: [`src/services/api.ts`](https://github.com/utkrsh-verma/nearu/blob/main/src/services/api.ts) (API client), [`src/App.tsx`](https://github.com/utkrsh-verma/nearu/blob/main/src/App.tsx) (App routing), [`src/app.ts`](https://github.com/utkrsh-verma/nearu/blob/main/src/app.ts) (HTTP API), [`src/pages/OnboardingPage.tsx`](https://github.com/utkrsh-verma/nearu/blob/main/src/pages/OnboardingPage.tsx) (Profile onboarding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Student experience"]
  node_app["App routing<br/>[App.tsx]"]
  node_landing["Sign-in landing<br/>[LandingPage.tsx]"]
end

subgraph group_identity["Identity and profiles"]
  node_verify["Campus verification"]
  node_onboarding["Profile onboarding<br/>[OnboardingPage.tsx]"]
  node_profile["Profile management<br/>[ProfilePage.tsx]"]
  node_auth["Auth context<br/>[AuthContext.tsx]"]
  node_eligibility["Campus eligibility"]
end

subgraph group_matching["Discovery and messaging"]
  node_discover["Profile discovery<br/>[DiscoverPage.tsx]"]
  node_profilecard["Profile cards"]
  node_likes["Received likes<br/>[LikesPage.tsx]"]
  node_matcheschat["Matches and chat"]
  node_realtime["Realtime events<br/>[useRealtime.ts]"]
end

subgraph group_backend["API and persistence"]
  node_api["API client<br/>[api.ts]"]
  node_server["HTTP API<br/>[app.ts]"]
  node_authmw["Request authentication<br/>[auth.ts]"]
  node_queries["Domain queries<br/>[queries.ts]"]
  node_schema["Relational schema<br/>[schema.ts]"]
  node_database[("PostgreSQL")]
end

subgraph group_media["Photo storage"]
  node_photos["Photo storage<br/>[photoStorage.ts]"]
  node_compression["Image compression"]
  node_photo_upload["Photo upload helper"]
end

node_student(("Student"))
node_supabase["Supabase services"]

node_student -->|"opens"| node_app
node_app -->|"provides auth"| node_auth
node_app -->|"renders"| node_landing
node_app -->|"renders"| node_verify
node_app -->|"renders"| node_onboarding
node_app -->|"renders"| node_profile
node_app -->|"subscribes through"| node_realtime
node_auth -->|"loads profile"| node_api
node_auth -->|"authenticates with"| node_supabase
node_verify -->|"submits verification"| node_api
node_onboarding -->|"saves profile"| node_api
node_onboarding -->|"compresses images"| node_compression
node_onboarding -->|"uploads photos"| node_photo_upload
node_profile -->|"updates profile"| node_api
node_profile -->|"compresses images"| node_compression
node_profile -->|"uploads photos"| node_photo_upload
node_discover -->|"requests profiles"| node_api
node_discover -->|"renders cards"| node_profilecard
node_likes -->|"loads likes"| node_api
node_likes -->|"renders cards"| node_profilecard
node_matcheschat -->|"loads conversations"| node_api
node_api -->|"gets auth token"| node_supabase
node_api -.->|"calls HTTP API"| node_server
node_server -->|"authenticates requests"| node_authmw
node_server -->|"handles domain operations"| node_queries
node_server -->|"checks campus config"| node_eligibility
node_server -->|"verifies photo objects"| node_photos
node_queries -->|"reads and writes"| node_database
node_queries -->|"uses tables"| node_schema
node_queries -->|"deletes stored photos"| node_photos
node_photos -->|"manages photo objects"| node_supabase
node_photo_upload -.->|"uploads photos"| node_supabase
node_realtime -->|"subscribes to events"| node_supabase
node_eligibility -.->|"validates campus"| node_verify

click node_app "https://github.com/utkrsh-verma/nearu/blob/main/src/App.tsx"
click node_landing "https://github.com/utkrsh-verma/nearu/blob/main/src/pages/LandingPage.tsx"
click node_verify "https://github.com/utkrsh-verma/nearu/blob/main/src/pages/CampusVerifyPage.tsx"
click node_onboarding "https://github.com/utkrsh-verma/nearu/blob/main/src/pages/OnboardingPage.tsx"
click node_profile "https://github.com/utkrsh-verma/nearu/blob/main/src/pages/ProfilePage.tsx"
click node_auth "https://github.com/utkrsh-verma/nearu/blob/main/src/contexts/AuthContext.tsx"
click node_eligibility "https://github.com/utkrsh-verma/nearu/blob/main/src/lib/campusEligibility.ts"
click node_discover "https://github.com/utkrsh-verma/nearu/blob/main/src/pages/DiscoverPage.tsx"
click node_profilecard "https://github.com/utkrsh-verma/nearu/blob/main/src/components/ProfileCardView.tsx"
click node_likes "https://github.com/utkrsh-verma/nearu/blob/main/src/pages/LikesPage.tsx"
click node_matcheschat "https://github.com/utkrsh-verma/nearu/blob/main/src/pages/MatchesChatPage.tsx"
click node_realtime "https://github.com/utkrsh-verma/nearu/blob/main/src/hooks/useRealtime.ts"
click node_api "https://github.com/utkrsh-verma/nearu/blob/main/src/services/api.ts"
click node_server "https://github.com/utkrsh-verma/nearu/blob/main/src/app.ts"
click node_authmw "https://github.com/utkrsh-verma/nearu/blob/main/src/middleware/auth.ts"
click node_queries "https://github.com/utkrsh-verma/nearu/blob/main/src/db/queries.ts"
click node_schema "https://github.com/utkrsh-verma/nearu/blob/main/src/db/schema.ts"
click node_photos "https://github.com/utkrsh-verma/nearu/blob/main/src/lib/photoStorage.ts"
click node_compression "https://github.com/utkrsh-verma/nearu/blob/main/src/lib/imageCompression.ts"
click node_photo_upload "https://github.com/utkrsh-verma/nearu/blob/main/src/lib/profilePhotoUpload.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 toneBlue
class node_verify,node_onboarding,node_profile,node_auth,node_eligibility toneAmber
class node_discover,node_profilecard,node_likes,node_matcheschat,node_realtime toneMint
class node_api,node_server,node_authmw,node_queries,node_schema,node_database toneRose
class node_photos,node_compression,node_photo_upload,node_student,node_supabase toneIndigo
```

## Components

### Student experience

- [App routing](https://github.com/utkrsh-verma/nearu/blob/main/src/App.tsx): `src/App.tsx`
- [Sign-in landing](https://github.com/utkrsh-verma/nearu/blob/main/src/pages/LandingPage.tsx): `src/pages/LandingPage.tsx`

### Identity and profiles

- [Campus verification](https://github.com/utkrsh-verma/nearu/blob/main/src/pages/CampusVerifyPage.tsx): `src/pages/CampusVerifyPage.tsx`
- [Profile onboarding](https://github.com/utkrsh-verma/nearu/blob/main/src/pages/OnboardingPage.tsx): `src/pages/OnboardingPage.tsx`
- [Profile management](https://github.com/utkrsh-verma/nearu/blob/main/src/pages/ProfilePage.tsx): `src/pages/ProfilePage.tsx`
- [Auth context](https://github.com/utkrsh-verma/nearu/blob/main/src/contexts/AuthContext.tsx): `src/contexts/AuthContext.tsx`
- [Campus eligibility](https://github.com/utkrsh-verma/nearu/blob/main/src/lib/campusEligibility.ts): `src/lib/campusEligibility.ts`

### Discovery and messaging

- [Profile discovery](https://github.com/utkrsh-verma/nearu/blob/main/src/pages/DiscoverPage.tsx): `src/pages/DiscoverPage.tsx`
- [Profile cards](https://github.com/utkrsh-verma/nearu/blob/main/src/components/ProfileCardView.tsx): `src/components/ProfileCardView.tsx`
- [Received likes](https://github.com/utkrsh-verma/nearu/blob/main/src/pages/LikesPage.tsx): `src/pages/LikesPage.tsx`
- [Matches and chat](https://github.com/utkrsh-verma/nearu/blob/main/src/pages/MatchesChatPage.tsx): `src/pages/MatchesChatPage.tsx`
- [Realtime events](https://github.com/utkrsh-verma/nearu/blob/main/src/hooks/useRealtime.ts): `src/hooks/useRealtime.ts`

### API and persistence

- [API client](https://github.com/utkrsh-verma/nearu/blob/main/src/services/api.ts): `src/services/api.ts`
- [HTTP API](https://github.com/utkrsh-verma/nearu/blob/main/src/app.ts): `src/app.ts`
- [Request authentication](https://github.com/utkrsh-verma/nearu/blob/main/src/middleware/auth.ts): `src/middleware/auth.ts`
- [Domain queries](https://github.com/utkrsh-verma/nearu/blob/main/src/db/queries.ts): `src/db/queries.ts`
- [Relational schema](https://github.com/utkrsh-verma/nearu/blob/main/src/db/schema.ts): `src/db/schema.ts`
- **PostgreSQL**

### Photo storage

- [Photo storage](https://github.com/utkrsh-verma/nearu/blob/main/src/lib/photoStorage.ts): `src/lib/photoStorage.ts`
- [Image compression](https://github.com/utkrsh-verma/nearu/blob/main/src/lib/imageCompression.ts): `src/lib/imageCompression.ts`
- [Photo upload helper](https://github.com/utkrsh-verma/nearu/blob/main/src/lib/profilePhotoUpload.ts): `src/lib/profilePhotoUpload.ts`

### Other components

- **Student**
- **Supabase services**

## Connections

- Student → App routing: opens (evidence: `README.md`)
- App routing → Auth context: provides auth (evidence: `src/App.tsx`)
- App routing → Sign-in landing: renders (evidence: `src/App.tsx`)
- App routing → Campus verification: renders (evidence: `src/App.tsx`)
- App routing → Profile onboarding: renders (evidence: `src/App.tsx`)
- App routing → Profile management: renders (evidence: `src/App.tsx`)
- App routing → Realtime events: subscribes through (evidence: `src/App.tsx`)
- Auth context → API client: loads profile (evidence: `src/contexts/AuthContext.tsx`)
- Auth context → Supabase services: authenticates with (evidence: `src/contexts/AuthContext.tsx`)
- Campus verification → API client: submits verification (evidence: `src/pages/CampusVerifyPage.tsx`)
- Profile onboarding → API client: saves profile (evidence: `src/pages/OnboardingPage.tsx`)
- Profile onboarding → Image compression: compresses images (evidence: `src/pages/OnboardingPage.tsx`)
- Profile onboarding → Photo upload helper: uploads photos (evidence: `src/pages/OnboardingPage.tsx`)
- Profile management → API client: updates profile (evidence: `src/pages/ProfilePage.tsx`)
- Profile management → Image compression: compresses images (evidence: `src/pages/ProfilePage.tsx`)
- Profile management → Photo upload helper: uploads photos (evidence: `src/pages/ProfilePage.tsx`)
- Profile discovery → API client: requests profiles (evidence: `src/pages/DiscoverPage.tsx`)
- Profile discovery → Profile cards: renders cards (evidence: `src/pages/DiscoverPage.tsx`)
- Received likes → API client: loads likes (evidence: `src/pages/LikesPage.tsx`)
- Received likes → Profile cards: renders cards (evidence: `src/pages/LikesPage.tsx`)
- Matches and chat → API client: loads conversations (evidence: `src/pages/MatchesChatPage.tsx`)
- API client → Supabase services: gets auth token (evidence: `src/services/api.ts`)
- API client → HTTP API: calls HTTP API
- HTTP API → Request authentication: authenticates requests (evidence: `src/app.ts`)
- HTTP API → Domain queries: handles domain operations (evidence: `src/app.ts`)
- HTTP API → Campus eligibility: checks campus config (evidence: `src/app.ts`)
- HTTP API → Photo storage: verifies photo objects (evidence: `src/app.ts`)
- Domain queries → PostgreSQL: reads and writes (evidence: `src/db/queries.ts`)
- Domain queries → Relational schema: uses tables (evidence: `src/db/queries.ts`)
- Domain queries → Photo storage: deletes stored photos (evidence: `src/db/queries.ts`)
- Photo storage → Supabase services: manages photo objects (evidence: `src/lib/photoStorage.ts`)
- Photo upload helper → Supabase services: uploads photos
- Realtime events → Supabase services: subscribes to events (evidence: `src/hooks/useRealtime.ts`)
- Campus eligibility → Campus verification: validates campus
