# om-singh-d/sih25092 architecture

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

- Interactive diagram: https://gitdiagram.com/om-singh-d/sih25092
- Repository: https://github.com/om-singh-d/sih25092

## Overview

This is a Next.js mental-health support platform with student-facing resources, mood assessment, chat, peer forum and consultation, plus account and admin functions. The apparent user journey begins at the landing page and branches into those support features; the available evidence does not establish a single end-to-end client-to-API workflow. The shown backend evidence covers account operations and MongoDB persistence. Other major routes are represented from the tree, but their internal behavior and connections are not inferred from unsampled source.

Main entry points: [`src/lib/users-repo.js`](https://github.com/om-singh-d/sih25092/blob/main/src/lib/users-repo.js) (User repository), [`src/app/landing/page.jsx`](https://github.com/om-singh-d/sih25092/blob/main/src/app/landing/page.jsx) (Landing page), [`src/app/resources/page.jsx`](https://github.com/om-singh-d/sih25092/blob/main/src/app/resources/page.jsx) (Resource library), [`src/components/header.jsx`](https://github.com/om-singh-d/sih25092/blob/main/src/components/header.jsx) (Site header)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Student experience"]
  node_landing["Landing page<br/>[page.jsx]"]
  node_hero["Hero section<br/>[hero-section.jsx]"]
  node_header["Site header<br/>[header.jsx]"]
  node_footer["Site footer<br/>[footer.jsx]"]
  node_resources["Resource library<br/>[page.jsx]"]
end

subgraph group_accounts["Accounts and administration"]
  node_login["Login page<br/>[page.jsx]"]
  node_register["Registration page<br/>[page.jsx]"]
  node_loginapi["Login endpoint<br/>[route.js]"]
  node_registerapi["Registration endpoint<br/>[route.js]"]
  node_initapi["Admin initialization<br/>[route.js]"]
  node_userapi["Current-user endpoint<br/>[route.js]"]
  node_logoutapi["Logout endpoint<br/>[route.js]"]
  node_dashboard["Student dashboard<br/>[page.jsx]"]
  node_admin["Admin pages"]
end

subgraph group_services["Support services"]
  node_mood["Mood assessment<br/>[page.jsx]"]
  node_peer["Peer forum<br/>[page.jsx]"]
  node_consult["Consultation<br/>[page.jsx]"]
  node_chatpage["Chat interface<br/>[page.jsx]"]
  node_chatapi["Chat API<br/>[route.js]"]
  node_anonymous["Anonymous session<br/>[route.js]"]
  node_anonymousform["Anonymous session form"]
end

subgraph group_persistence["Persistence and shared UI"]
  node_userrepo["User repository<br/>[users-repo.js]"]
  node_auth["JWT authentication<br/>[auth.js]"]
  node_usermodel["User model<br/>[User.js]"]
  node_mongo[("MongoDB connection<br/>[mongodb.js]")]
  node_logo["Logo<br/>[logo.jsx]"]
  node_ui["UI primitives"]
end

node_student(("Student / visitor"))

node_student -.->|"visits"| node_landing
node_student -.->|"opens"| node_resources
node_student -.->|"opens"| node_mood
node_student -.->|"opens"| node_peer
node_student -.->|"opens"| node_consult
node_student -.->|"opens"| node_chatpage
node_student -.->|"opens"| node_anonymousform
node_student -.->|"opens"| node_login
node_student -.->|"opens"| node_register
node_landing -->|"renders"| node_hero
node_landing -->|"renders"| node_footer
node_landing -->|"uses"| node_ui
node_hero -->|"renders"| node_header
node_hero -->|"uses"| node_ui
node_header -->|"renders"| node_logo
node_header -->|"uses"| node_ui
node_resources -->|"renders"| node_header
node_resources -->|"renders"| node_footer
node_resources -->|"uses"| node_ui
node_loginapi -->|"looks up"| node_userrepo
node_loginapi -->|"updates login"| node_userrepo
node_loginapi -->|"signs token"| node_auth
node_registerapi -->|"creates user"| node_userrepo
node_initapi -->|"initializes admin"| node_userrepo
node_userapi -->|"verifies token"| node_auth
node_userapi -->|"loads user"| node_userrepo
node_logoutapi -->|"uses cookie settings"| node_auth
node_userrepo -->|"connects"| node_mongo
node_userrepo -->|"queries and saves"| node_usermodel

click node_landing "https://github.com/om-singh-d/sih25092/blob/main/src/app/landing/page.jsx"
click node_hero "https://github.com/om-singh-d/sih25092/blob/main/src/components/hero-section.jsx"
click node_header "https://github.com/om-singh-d/sih25092/blob/main/src/components/header.jsx"
click node_footer "https://github.com/om-singh-d/sih25092/blob/main/src/components/footer.jsx"
click node_resources "https://github.com/om-singh-d/sih25092/blob/main/src/app/resources/page.jsx"
click node_mood "https://github.com/om-singh-d/sih25092/blob/main/src/app/mood-assessment/page.jsx"
click node_peer "https://github.com/om-singh-d/sih25092/blob/main/src/app/peer-forum/page.jsx"
click node_consult "https://github.com/om-singh-d/sih25092/blob/main/src/app/consult/page.jsx"
click node_chatpage "https://github.com/om-singh-d/sih25092/blob/main/src/app/dashboard/chat/page.jsx"
click node_chatapi "https://github.com/om-singh-d/sih25092/blob/main/src/app/api/chat/route.js"
click node_anonymous "https://github.com/om-singh-d/sih25092/blob/main/src/app/api/sessions/anonymous/route.js"
click node_anonymousform "https://github.com/om-singh-d/sih25092/blob/main/src/components/anonymous-session-form.jsx"
click node_login "https://github.com/om-singh-d/sih25092/blob/main/src/app/login/page.jsx"
click node_register "https://github.com/om-singh-d/sih25092/blob/main/src/app/register/page.jsx"
click node_loginapi "https://github.com/om-singh-d/sih25092/blob/main/src/app/api/users/login/route.js"
click node_registerapi "https://github.com/om-singh-d/sih25092/blob/main/src/app/api/users/register/route.js"
click node_initapi "https://github.com/om-singh-d/sih25092/blob/main/src/app/api/init/route.js"
click node_userapi "https://github.com/om-singh-d/sih25092/blob/main/src/app/api/users/me/route.js"
click node_logoutapi "https://github.com/om-singh-d/sih25092/blob/main/src/app/api/users/logout/route.js"
click node_dashboard "https://github.com/om-singh-d/sih25092/blob/main/src/app/dashboard/page.jsx"
click node_admin "https://github.com/om-singh-d/sih25092/tree/main/src/app/admin"
click node_userrepo "https://github.com/om-singh-d/sih25092/blob/main/src/lib/users-repo.js"
click node_auth "https://github.com/om-singh-d/sih25092/blob/main/src/lib/auth.js"
click node_usermodel "https://github.com/om-singh-d/sih25092/blob/main/src/models/User.js"
click node_mongo "https://github.com/om-singh-d/sih25092/blob/main/src/lib/mongodb.js"
click node_logo "https://github.com/om-singh-d/sih25092/blob/main/src/components/logo.jsx"
click node_ui "https://github.com/om-singh-d/sih25092/tree/main/src/components/ui"

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_landing,node_hero,node_header,node_footer,node_resources toneBlue
class node_login,node_register,node_loginapi,node_registerapi,node_initapi,node_userapi,node_logoutapi,node_dashboard,node_admin toneAmber
class node_mood,node_peer,node_consult,node_chatpage,node_chatapi,node_anonymous,node_anonymousform toneMint
class node_userrepo,node_auth,node_usermodel,node_mongo,node_logo,node_ui toneRose
class node_student toneIndigo
```

## Components

### Student experience

- [Landing page](https://github.com/om-singh-d/sih25092/blob/main/src/app/landing/page.jsx): `src/app/landing/page.jsx`
- [Hero section](https://github.com/om-singh-d/sih25092/blob/main/src/components/hero-section.jsx): `src/components/hero-section.jsx`
- [Site header](https://github.com/om-singh-d/sih25092/blob/main/src/components/header.jsx): `src/components/header.jsx`
- [Site footer](https://github.com/om-singh-d/sih25092/blob/main/src/components/footer.jsx): `src/components/footer.jsx`
- [Resource library](https://github.com/om-singh-d/sih25092/blob/main/src/app/resources/page.jsx): `src/app/resources/page.jsx`

### Accounts and administration

- [Login page](https://github.com/om-singh-d/sih25092/blob/main/src/app/login/page.jsx): `src/app/login/page.jsx`
- [Registration page](https://github.com/om-singh-d/sih25092/blob/main/src/app/register/page.jsx): `src/app/register/page.jsx`
- [Login endpoint](https://github.com/om-singh-d/sih25092/blob/main/src/app/api/users/login/route.js): `src/app/api/users/login/route.js`
- [Registration endpoint](https://github.com/om-singh-d/sih25092/blob/main/src/app/api/users/register/route.js): `src/app/api/users/register/route.js`
- [Admin initialization](https://github.com/om-singh-d/sih25092/blob/main/src/app/api/init/route.js): `src/app/api/init/route.js`
- [Current-user endpoint](https://github.com/om-singh-d/sih25092/blob/main/src/app/api/users/me/route.js): `src/app/api/users/me/route.js`
- [Logout endpoint](https://github.com/om-singh-d/sih25092/blob/main/src/app/api/users/logout/route.js): `src/app/api/users/logout/route.js`
- [Student dashboard](https://github.com/om-singh-d/sih25092/blob/main/src/app/dashboard/page.jsx): `src/app/dashboard/page.jsx`
- [Admin pages](https://github.com/om-singh-d/sih25092/tree/main/src/app/admin): `src/app/admin`

### Support services

- [Mood assessment](https://github.com/om-singh-d/sih25092/blob/main/src/app/mood-assessment/page.jsx): `src/app/mood-assessment/page.jsx`
- [Peer forum](https://github.com/om-singh-d/sih25092/blob/main/src/app/peer-forum/page.jsx): `src/app/peer-forum/page.jsx`
- [Consultation](https://github.com/om-singh-d/sih25092/blob/main/src/app/consult/page.jsx): `src/app/consult/page.jsx`
- [Chat interface](https://github.com/om-singh-d/sih25092/blob/main/src/app/dashboard/chat/page.jsx): `src/app/dashboard/chat/page.jsx`
- [Chat API](https://github.com/om-singh-d/sih25092/blob/main/src/app/api/chat/route.js): `src/app/api/chat/route.js`
- [Anonymous session](https://github.com/om-singh-d/sih25092/blob/main/src/app/api/sessions/anonymous/route.js): `src/app/api/sessions/anonymous/route.js`
- [Anonymous session form](https://github.com/om-singh-d/sih25092/blob/main/src/components/anonymous-session-form.jsx): `src/components/anonymous-session-form.jsx`

### Persistence and shared UI

- [User repository](https://github.com/om-singh-d/sih25092/blob/main/src/lib/users-repo.js): `src/lib/users-repo.js`
- [JWT authentication](https://github.com/om-singh-d/sih25092/blob/main/src/lib/auth.js): `src/lib/auth.js`
- [User model](https://github.com/om-singh-d/sih25092/blob/main/src/models/User.js): `src/models/User.js`
- [MongoDB connection](https://github.com/om-singh-d/sih25092/blob/main/src/lib/mongodb.js): `src/lib/mongodb.js`
- [Logo](https://github.com/om-singh-d/sih25092/blob/main/src/components/logo.jsx): `src/components/logo.jsx`
- [UI primitives](https://github.com/om-singh-d/sih25092/tree/main/src/components/ui): `src/components/ui`

### Other components

- **Student / visitor**

## Connections

- Student / visitor → Landing page: visits
- Student / visitor → Resource library: opens
- Student / visitor → Mood assessment: opens
- Student / visitor → Peer forum: opens
- Student / visitor → Consultation: opens
- Student / visitor → Chat interface: opens
- Student / visitor → Anonymous session form: opens
- Student / visitor → Login page: opens
- Student / visitor → Registration page: opens
- Landing page → Hero section: renders (evidence: `src/app/landing/page.jsx`)
- Landing page → Site footer: renders (evidence: `src/app/landing/page.jsx`)
- Landing page → UI primitives: uses (evidence: `src/app/landing/page.jsx`)
- Hero section → Site header: renders (evidence: `src/components/hero-section.jsx`)
- Hero section → UI primitives: uses (evidence: `src/components/hero-section.jsx`)
- Site header → Logo: renders (evidence: `src/components/header.jsx`)
- Site header → UI primitives: uses (evidence: `src/components/header.jsx`)
- Resource library → Site header: renders (evidence: `src/app/resources/page.jsx`)
- Resource library → Site footer: renders (evidence: `src/app/resources/page.jsx`)
- Resource library → UI primitives: uses (evidence: `src/app/resources/page.jsx`)
- Login endpoint → User repository: looks up (evidence: `src/app/api/users/login/route.js`)
- Login endpoint → User repository: updates login (evidence: `src/app/api/users/login/route.js`)
- Login endpoint → JWT authentication: signs token (evidence: `src/app/api/users/login/route.js`)
- Registration endpoint → User repository: creates user (evidence: `src/app/api/users/register/route.js`)
- Admin initialization → User repository: initializes admin (evidence: `src/app/api/init/route.js`)
- Current-user endpoint → JWT authentication: verifies token (evidence: `src/app/api/users/me/route.js`)
- Current-user endpoint → User repository: loads user (evidence: `src/app/api/users/me/route.js`)
- Logout endpoint → JWT authentication: uses cookie settings (evidence: `src/app/api/users/logout/route.js`)
- User repository → MongoDB connection: connects (evidence: `src/lib/users-repo.js`)
- User repository → User model: queries and saves (evidence: `src/lib/users-repo.js`)
