# optimusprimeg/enip architecture

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

- Interactive diagram: https://gitdiagram.com/optimusprimeg/enip
- Repository: https://github.com/optimusprimeg/enip

## Overview

This is a Next.js alumni-network product for students to discover IIT alumni, join through email verification and a referral-aware waitlist, chat with mentors, and request instant CV reviews. Staff and administrators manage conversations, profiles, students, and analytics. The graph emphasizes those user workflows and the supporting domain modules; some page-to-module links are based on the SOURCE INDEX, since those page implementations were not sampled.

Main entry points: [`src/modules/chat/index.ts`](https://github.com/optimusprimeg/enip/blob/main/src/modules/chat/index.ts) (Chat rules and messages), [`src/modules/growth/index.ts`](https://github.com/optimusprimeg/enip/blob/main/src/modules/growth/index.ts) (Referrals and rewards), [`src/adapters/db/postgres.ts`](https://github.com/optimusprimeg/enip/blob/main/src/adapters/db/postgres.ts) (Postgres records), [`src/app/(site)/page.tsx`](https://github.com/optimusprimeg/enip/blob/main/src/app/(site)/page.tsx) (Home and discovery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Student experience"]
  node_home["Home and discovery<br/>[page.tsx]"]
  node_search["Alumni search<br/>[page.tsx]"]
  node_content["Guides and resources<br/>[index.ts]"]
  node_join["Join and verify<br/>[actions.ts]"]
  node_waitlist["Waitlist<br/>[page.tsx]"]
  node_referral_link["Referral redirect<br/>[route.ts]"]
  node_chat_page["Student chat<br/>[page.tsx]"]
  node_chat_file["Chat file download<br/>[route.ts]"]
  node_cv_form["Instant CV review"]
end

subgraph group_community["Network and growth"]
end

subgraph group_services["Domain services"]
  node_student_domain["Student accounts<br/>[index.ts]"]
  node_growth["Referrals and rewards<br/>[index.ts]"]
  node_chat_domain["Chat rules and messages<br/>[index.ts]"]
  node_cv_guest["Guest review session<br/>[guest-session.ts]"]
  node_cv_domain["Review processing<br/>[index.ts]"]
  node_files["File handling<br/>[index.ts]"]
end

subgraph group_operations["Staff and administration"]
  node_team_inbox["Team inbox<br/>[inbox.ts]"]
  node_team_domain["Team operations<br/>[index.ts]"]
  node_admin["Admin portal<br/>[page.tsx]"]
  node_admin_domain["Admin operations<br/>[index.ts]"]
  node_analytics["Product analytics<br/>[index.ts]"]
end

subgraph group_infrastructure["Adapters and persistence"]
  node_enip["Alumni and chat adapter<br/>[local.ts]"]
  node_storage["Object storage<br/>[index.ts]"]
  node_database[("Postgres records<br/>[postgres.ts]")]
  node_review_provider["CV review provider<br/>[hirelayer.ts]"]
end

node_visitor(("Visitor or student"))

node_visitor -->|"opens"| node_home
node_home -->|"loads categories"| node_content
node_home -->|"links to"| node_search
node_visitor -->|"submits signup"| node_join
node_join -->|"starts signup"| node_student_domain
node_student_domain -->|"records verification"| node_growth
node_student_domain -.->|"reads and writes"| node_database
node_visitor -->|"views progress"| node_waitlist
node_waitlist -->|"loads referral status"| node_growth
node_visitor -->|"opens code"| node_referral_link
node_referral_link -->|"records referral"| node_growth
node_visitor -->|"starts conversation"| node_chat_page
node_chat_page -.->|"uses chat service"| node_chat_domain
node_chat_domain -->|"sends and lists messages"| node_enip
node_chat_domain -->|"checks chat access"| node_growth
node_chat_domain -->|"validates attachments"| node_files
node_chat_domain -->|"notifies team"| node_team_domain
node_visitor -->|"submits resume"| node_cv_form
node_cv_form -->|"uses guest token"| node_cv_guest
node_cv_domain -->|"requests review"| node_review_provider
node_cv_domain -->|"handles review files"| node_files
node_visitor -->|"requests attachment"| node_chat_file
node_chat_file -->|"opens authorized file"| node_chat_domain
node_files -->|"stores and loads files"| node_storage
node_visitor -.->|"team handles conversations"| node_team_inbox
node_team_domain -->|"uses inbox functions"| node_team_inbox
node_visitor -.->|"administers network"| node_admin
node_admin -->|"loads admin data"| node_admin_domain
node_admin -->|"loads metrics"| node_analytics
node_admin_domain -->|"reads and writes"| node_database
node_analytics -.->|"queries metrics"| node_database
node_enip -->|"reads and writes"| node_database

click node_home "https://github.com/optimusprimeg/enip/blob/main/src/app/(site)/page.tsx"
click node_search "https://github.com/optimusprimeg/enip/blob/main/src/app/(site)/search/page.tsx"
click node_content "https://github.com/optimusprimeg/enip/blob/main/src/modules/content/index.ts"
click node_join "https://github.com/optimusprimeg/enip/blob/main/src/app/(site)/join/actions.ts"
click node_student_domain "https://github.com/optimusprimeg/enip/blob/main/src/modules/students/index.ts"
click node_waitlist "https://github.com/optimusprimeg/enip/blob/main/src/app/(site)/waitlist/page.tsx"
click node_growth "https://github.com/optimusprimeg/enip/blob/main/src/modules/growth/index.ts"
click node_referral_link "https://github.com/optimusprimeg/enip/blob/main/src/app/r/%5Bcode%5D/route.ts"
click node_chat_page "https://github.com/optimusprimeg/enip/blob/main/src/app/(site)/chat/%5BalumniId%5D/page.tsx"
click node_chat_domain "https://github.com/optimusprimeg/enip/blob/main/src/modules/chat/index.ts"
click node_chat_file "https://github.com/optimusprimeg/enip/blob/main/src/app/files/chat/%5BmessageId%5D/route.ts"
click node_cv_form "https://github.com/optimusprimeg/enip/blob/main/src/components/cv-review/instant-review-form.tsx"
click node_cv_guest "https://github.com/optimusprimeg/enip/blob/main/src/modules/cv-review/guest-session.ts"
click node_cv_domain "https://github.com/optimusprimeg/enip/blob/main/src/modules/cv-review/index.ts"
click node_team_inbox "https://github.com/optimusprimeg/enip/blob/main/src/modules/team/inbox.ts"
click node_team_domain "https://github.com/optimusprimeg/enip/blob/main/src/modules/team/index.ts"
click node_admin "https://github.com/optimusprimeg/enip/blob/main/src/app/admin/page.tsx"
click node_admin_domain "https://github.com/optimusprimeg/enip/blob/main/src/modules/admin/index.ts"
click node_analytics "https://github.com/optimusprimeg/enip/blob/main/src/modules/analytics/index.ts"
click node_enip "https://github.com/optimusprimeg/enip/blob/main/src/adapters/enip-app/local.ts"
click node_files "https://github.com/optimusprimeg/enip/blob/main/src/modules/files/index.ts"
click node_storage "https://github.com/optimusprimeg/enip/blob/main/src/adapters/storage/index.ts"
click node_database "https://github.com/optimusprimeg/enip/blob/main/src/adapters/db/postgres.ts"
click node_review_provider "https://github.com/optimusprimeg/enip/blob/main/src/adapters/cv-reviewer/hirelayer.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_home,node_search,node_content,node_join,node_waitlist,node_referral_link,node_chat_page,node_chat_file,node_cv_form toneBlue
class node_student_domain,node_growth,node_chat_domain,node_cv_guest,node_cv_domain,node_files toneMint
class node_team_inbox,node_team_domain,node_admin,node_admin_domain,node_analytics toneRose
class node_enip,node_storage,node_database,node_review_provider,node_visitor toneIndigo
```

## Components

### Student experience

- [Home and discovery](https://github.com/optimusprimeg/enip/blob/main/src/app/(site)/page.tsx): `src/app/(site)/page.tsx`
- [Alumni search](https://github.com/optimusprimeg/enip/blob/main/src/app/(site)/search/page.tsx): `src/app/(site)/search/page.tsx`
- [Guides and resources](https://github.com/optimusprimeg/enip/blob/main/src/modules/content/index.ts): `src/modules/content/index.ts`
- [Join and verify](https://github.com/optimusprimeg/enip/blob/main/src/app/(site)/join/actions.ts): `src/app/(site)/join/actions.ts`
- [Waitlist](https://github.com/optimusprimeg/enip/blob/main/src/app/(site)/waitlist/page.tsx): `src/app/(site)/waitlist/page.tsx`
- [Referral redirect](https://github.com/optimusprimeg/enip/blob/main/src/app/r/%5Bcode%5D/route.ts): `src/app/r/[code]/route.ts`
- [Student chat](https://github.com/optimusprimeg/enip/blob/main/src/app/(site)/chat/%5BalumniId%5D/page.tsx): `src/app/(site)/chat/[alumniId]/page.tsx`
- [Chat file download](https://github.com/optimusprimeg/enip/blob/main/src/app/files/chat/%5BmessageId%5D/route.ts): `src/app/files/chat/[messageId]/route.ts`
- [Instant CV review](https://github.com/optimusprimeg/enip/blob/main/src/components/cv-review/instant-review-form.tsx): `src/components/cv-review/instant-review-form.tsx`

### Domain services

- [Student accounts](https://github.com/optimusprimeg/enip/blob/main/src/modules/students/index.ts): `src/modules/students/index.ts`
- [Referrals and rewards](https://github.com/optimusprimeg/enip/blob/main/src/modules/growth/index.ts): `src/modules/growth/index.ts`
- [Chat rules and messages](https://github.com/optimusprimeg/enip/blob/main/src/modules/chat/index.ts): `src/modules/chat/index.ts`
- [Guest review session](https://github.com/optimusprimeg/enip/blob/main/src/modules/cv-review/guest-session.ts): `src/modules/cv-review/guest-session.ts`
- [Review processing](https://github.com/optimusprimeg/enip/blob/main/src/modules/cv-review/index.ts): `src/modules/cv-review/index.ts`
- [File handling](https://github.com/optimusprimeg/enip/blob/main/src/modules/files/index.ts): `src/modules/files/index.ts`

### Staff and administration

- [Team inbox](https://github.com/optimusprimeg/enip/blob/main/src/modules/team/inbox.ts): `src/modules/team/inbox.ts`
- [Team operations](https://github.com/optimusprimeg/enip/blob/main/src/modules/team/index.ts): `src/modules/team/index.ts`
- [Admin portal](https://github.com/optimusprimeg/enip/blob/main/src/app/admin/page.tsx): `src/app/admin/page.tsx`
- [Admin operations](https://github.com/optimusprimeg/enip/blob/main/src/modules/admin/index.ts): `src/modules/admin/index.ts`
- [Product analytics](https://github.com/optimusprimeg/enip/blob/main/src/modules/analytics/index.ts): `src/modules/analytics/index.ts`

### Adapters and persistence

- [Alumni and chat adapter](https://github.com/optimusprimeg/enip/blob/main/src/adapters/enip-app/local.ts): `src/adapters/enip-app/local.ts`
- [Object storage](https://github.com/optimusprimeg/enip/blob/main/src/adapters/storage/index.ts): `src/adapters/storage/index.ts`
- [Postgres records](https://github.com/optimusprimeg/enip/blob/main/src/adapters/db/postgres.ts): `src/adapters/db/postgres.ts`
- [CV review provider](https://github.com/optimusprimeg/enip/blob/main/src/adapters/cv-reviewer/hirelayer.ts): `src/adapters/cv-reviewer/hirelayer.ts`

### Other components

- **Visitor or student**

## Connections

- Visitor or student → Home and discovery: opens (evidence: `src/app/(site)/page.tsx`)
- Home and discovery → Guides and resources: loads categories (evidence: `src/app/(site)/page.tsx`)
- Home and discovery → Alumni search: links to (evidence: `src/app/(site)/page.tsx`)
- Visitor or student → Join and verify: submits signup (evidence: `src/app/(site)/join/actions.ts`)
- Join and verify → Student accounts: starts signup (evidence: `src/app/(site)/join/actions.ts`)
- Student accounts → Referrals and rewards: records verification (evidence: `src/modules/students/index.ts`)
- Student accounts → Postgres records: reads and writes
- Visitor or student → Waitlist: views progress (evidence: `src/app/(site)/waitlist/page.tsx`)
- Waitlist → Referrals and rewards: loads referral status (evidence: `src/app/(site)/waitlist/page.tsx`)
- Visitor or student → Referral redirect: opens code (evidence: `src/app/r/[code]/route.ts`)
- Referral redirect → Referrals and rewards: records referral (evidence: `src/app/r/[code]/route.ts`)
- Visitor or student → Student chat: starts conversation
- Student chat → Chat rules and messages: uses chat service
- Chat rules and messages → Alumni and chat adapter: sends and lists messages (evidence: `src/modules/chat/index.ts`)
- Chat rules and messages → Referrals and rewards: checks chat access (evidence: `src/modules/chat/index.ts`)
- Chat rules and messages → File handling: validates attachments (evidence: `src/modules/chat/index.ts`)
- Chat rules and messages → Team operations: notifies team (evidence: `src/modules/chat/index.ts`)
- Visitor or student → Instant CV review: submits resume (evidence: `src/components/cv-review/instant-review-form.tsx`)
- Instant CV review → Guest review session: uses guest token
- Review processing → CV review provider: requests review (evidence: `src/modules/cv-review/index.ts`)
- Review processing → File handling: handles review files (evidence: `src/modules/cv-review/index.ts`)
- Visitor or student → Chat file download: requests attachment (evidence: `src/app/files/chat/[messageId]/route.ts`)
- Chat file download → Chat rules and messages: opens authorized file (evidence: `src/app/files/chat/[messageId]/route.ts`)
- File handling → Object storage: stores and loads files (evidence: `src/modules/files/index.ts`)
- Visitor or student → Team inbox: team handles conversations
- Team operations → Team inbox: uses inbox functions (evidence: `src/modules/team/index.ts`)
- Visitor or student → Admin portal: administers network
- Admin portal → Admin operations: loads admin data (evidence: `src/app/admin/page.tsx`)
- Admin portal → Product analytics: loads metrics (evidence: `src/app/admin/page.tsx`)
- Admin operations → Postgres records: reads and writes (evidence: `src/modules/admin/index.ts`)
- Product analytics → Postgres records: queries metrics
- Alumni and chat adapter → Postgres records: reads and writes (evidence: `src/adapters/enip-app/local.ts`)
