# prodip-shadow/alumnet architecture

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

- Interactive diagram: https://gitdiagram.com/prodip-shadow/alumnet
- Repository: https://github.com/prodip-shadow/alumnet

## Overview

#### Purpose and topology
This is a full-stack alumni/community platform: authentication, alumni profiles and migration, social posts and threaded interactions, connections, opportunities, events, projects, skills, departments/faculty, verification, payments, notifications, and an AI assistant. The frontend is a Next.js application; the backend is a Node.js HTTP API with realtime notification support.

#### Runtime entry points
- Backend startup is `Backend/server.js`, which delegates application assembly to `Backend/src/app.js`.
- The browser application uses the Next.js App Router root at `frontend/src/app/layout.jsx`; the main community/home route is `frontend/src/app/(common)/page.jsx`.
- Authentication screens are independently routed at `frontend/src/app/login/page.jsx` and `frontend/src/app/register/page.jsx`.

#### API composition and domain boundary
The backend follows route → controller → model/service layering. Route modules expose HTTP resource boundaries, controllers coordinate request handling, and models represent persistence operations.
- Auth and account lifecycle: `Backend/src/routes/auth.route.js`, `Backend/src/controllers/auth.controller.js`, `Backend/src/models/user.model.js`.
- Alumni identity and onboarding/migration: `Backend/src/routes/alumni.route.js`, `Backend/src/routes/alumniMigration.route.js`, `Backend/src/models/alumni.model.js`.
- Institutional and professional catalog domains: `Backend/src/routes/department.route.js`, `Backend/src/routes/opportunity.route.js`, `Backend/src/routes/project.route.js`.

#### Social graph and feed
Posts are the central community-content aggregate, with separately modeled comments, replies, likes, and user connections rather than a monolithic feed model.
- Feed content: `Backend/src/routes/post.route.js`, `Backend/src/controllers/post.controller.js`, `Backend/src/models/post.model.js`.
- Conversation/engagement: `Backend/src/routes/comment.route.js`, `Backend/src/routes/reply.route.js`, `Backend/src/models/commentLike.model.js`.
- Relationship graph: `Backend/src/routes/connection.route.js`, `Backend/src/controllers/connection.controller.js`, `Backend/src/models/connection.model.js`.
- The frontend renders and creates feed content through `frontend/src/components/home/PostCard.jsx` and `frontend/src/components/home/CreatePostCard.jsx`.

#### Security and request controls
Authentication is enforced at the middleware layer, with role-based authorization and rate limiting as separate cross-cutting controls. Upload handling is also isolated before controllers/services process media.
- `Backend/src/middlewares/auth.middleware.js`
- `Backend/src/middlewares/role.middleware.js`
- `Backend/src/middlewares/rateLimit.middleware.js`
- `Backend/src/middlewares/upload.middleware.js`

#### Persistence, external services, and async interaction
The system uses a SQL database, defined by `Backend/sql/schema.sql` and connected through `Backend/src/config/db.js`. Cloudinary is the media-storage integration, configured and wrapped in `Backend/src/config/cloudinary.js` and `Backend/src/services/cloudinary.service.js`. AI requests cross an explicit service boundary via `Backend/src/services/aiAssistant.service.js`. Notifications have both service and socket delivery paths: `Backend/src/services/notification.service.js` and `Backend/src/sockets/notification.socket.js`.

#### Frontend state and backend access
The frontend maintains authenticated user/session state in `frontend/src/context/AuthContext.jsx`. Browser API calls are centralized in `frontend/src/lib/axios.js`, creating the main client/server boundary. Shared navigation is `frontend/src/components/shared/Navbar.jsx`; home composition includes `frontend/src/components/home/Sidebar.jsx`.

Main entry points: [`Backend/src/middlewares/auth.middleware.js`](https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/middlewares/auth.middleware.js) (Request controls), [`Backend/sql/schema.sql`](https://github.com/prodip-shadow/alumnet/blob/main/Backend/sql/schema.sql) (SQL database), [`Backend/src/routes/post.route.js`](https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/routes/post.route.js) (Posts), [`Backend/src/app.js`](https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/app.js) (Application assembly)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Next.js frontend"]
  node_next_root["App Router root<br/>Next.js layout<br/>[layout.jsx]"]
  node_community_page["Community home<br/>Next.js route<br/>[page.jsx]"]
  node_auth_pages["Login and registration<br/>Next.js routes<br/>[page.jsx]"]
  node_auth_context["Session state<br/>React context<br/>[AuthContext.jsx]"]
  node_api_client["API client<br/>Axios boundary<br/>[axios.js]"]
  node_feed_ui["Feed composition<br/>React components<br/>[PostCard.jsx]"]
  node_navigation["Shared navigation<br/>React components<br/>[Navbar.jsx]"]
end

subgraph group_backend["Node.js API"]
  node_server["Server startup<br/>Node.js entry<br/>[server.js]"]
  node_app["Application assembly<br/>HTTP application<br/>[app.js]"]
  node_request_controls["Request controls<br/>Middleware<br/>[auth.middleware.js]"]
  node_account_domain["Accounts and alumni<br/>Routes/controllers/models<br/>[auth.route.js]"]
  node_catalog_domain["Institutional catalog<br/>Routes"]
  node_post_domain["Posts<br/>Route/controller/model<br/>[post.route.js]"]
  node_engagement_domain["Comments and reactions<br/>Routes/models<br/>[comment.route.js]"]
  node_connection_domain["Connections<br/>Route/controller/model"]
  node_notification_delivery["Notifications<br/>Service and socket"]
  node_ai_service["AI assistant<br/>Service boundary"]
end

subgraph group_data["Data and integrations"]
  node_sql_database[("SQL database<br/>Persistence<br/>[schema.sql]")]
  node_media_storage["Cloudinary<br/>Media storage"]
end

node_next_root -->|"renders"| node_community_page
node_next_root -->|"routes"| node_auth_pages
node_community_page -->|"composes"| node_feed_ui
node_community_page -->|"uses"| node_navigation
node_auth_pages -->|"establishes session"| node_auth_context
node_auth_context -->|"supplies credentials"| node_api_client
node_feed_ui -->|"reads and creates posts"| node_api_client
node_api_client -->|"HTTP requests"| node_app
node_server -->|"starts"| node_app
node_app -->|"applies"| node_request_controls
node_request_controls -->|"guards"| node_account_domain
node_request_controls -->|"guards"| node_post_domain
node_request_controls -->|"guards"| node_catalog_domain
node_request_controls -->|"guards"| node_connection_domain
node_post_domain -->|"supports discussion"| node_engagement_domain
node_post_domain -.->|"emits activity"| node_notification_delivery
node_connection_domain -.->|"emits activity"| node_notification_delivery
node_account_domain -->|"persists"| node_sql_database
node_catalog_domain -->|"persists"| node_sql_database
node_post_domain -->|"persists"| node_sql_database
node_engagement_domain -->|"persists"| node_sql_database
node_connection_domain -->|"persists"| node_sql_database
node_notification_delivery -->|"stores notifications"| node_sql_database
node_request_controls -->|"uploads media"| node_media_storage
node_app -->|"serves assistant requests"| node_ai_service

click node_next_root "https://github.com/prodip-shadow/alumnet/blob/main/frontend/src/app/layout.jsx"
click node_community_page "https://github.com/prodip-shadow/alumnet/blob/main/frontend/src/app/(common)/page.jsx"
click node_auth_pages "https://github.com/prodip-shadow/alumnet/blob/main/frontend/src/app/login/page.jsx"
click node_auth_context "https://github.com/prodip-shadow/alumnet/blob/main/frontend/src/context/AuthContext.jsx"
click node_api_client "https://github.com/prodip-shadow/alumnet/blob/main/frontend/src/lib/axios.js"
click node_feed_ui "https://github.com/prodip-shadow/alumnet/blob/main/frontend/src/components/home/PostCard.jsx"
click node_navigation "https://github.com/prodip-shadow/alumnet/blob/main/frontend/src/components/shared/Navbar.jsx"
click node_server "https://github.com/prodip-shadow/alumnet/blob/main/Backend/server.js"
click node_app "https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/app.js"
click node_request_controls "https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/middlewares/auth.middleware.js"
click node_account_domain "https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/routes/auth.route.js"
click node_catalog_domain "https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/routes/department.route.js"
click node_post_domain "https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/routes/post.route.js"
click node_engagement_domain "https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/routes/comment.route.js"
click node_connection_domain "https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/routes/connection.route.js"
click node_notification_delivery "https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/services/notification.service.js"
click node_ai_service "https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/services/aiAssistant.service.js"
click node_sql_database "https://github.com/prodip-shadow/alumnet/blob/main/Backend/sql/schema.sql"
click node_media_storage "https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/services/cloudinary.service.js"

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_next_root,node_community_page,node_auth_pages,node_auth_context,node_api_client,node_feed_ui,node_navigation toneBlue
class node_server,node_app,node_request_controls,node_account_domain,node_catalog_domain,node_post_domain,node_engagement_domain,node_connection_domain,node_notification_delivery,node_ai_service toneAmber
class node_sql_database,node_media_storage toneMint
```

## Components

### Next.js frontend

- [App Router root](https://github.com/prodip-shadow/alumnet/blob/main/frontend/src/app/layout.jsx): Next.js layout · `frontend/src/app/layout.jsx`
- [Community home](https://github.com/prodip-shadow/alumnet/blob/main/frontend/src/app/(common)/page.jsx): Next.js route · `frontend/src/app/(common)/page.jsx`
- [Login and registration](https://github.com/prodip-shadow/alumnet/blob/main/frontend/src/app/login/page.jsx): Next.js routes · `frontend/src/app/login/page.jsx`
- [Session state](https://github.com/prodip-shadow/alumnet/blob/main/frontend/src/context/AuthContext.jsx): React context · `frontend/src/context/AuthContext.jsx`
- [API client](https://github.com/prodip-shadow/alumnet/blob/main/frontend/src/lib/axios.js): Axios boundary · `frontend/src/lib/axios.js`
- [Feed composition](https://github.com/prodip-shadow/alumnet/blob/main/frontend/src/components/home/PostCard.jsx): React components · Creates and renders community posts. · `frontend/src/components/home/PostCard.jsx`
- [Shared navigation](https://github.com/prodip-shadow/alumnet/blob/main/frontend/src/components/shared/Navbar.jsx): React components · `frontend/src/components/shared/Navbar.jsx`

### Node.js API

- [Server startup](https://github.com/prodip-shadow/alumnet/blob/main/Backend/server.js): Node.js entry · `Backend/server.js`
- [Application assembly](https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/app.js): HTTP application · `Backend/src/app.js`
- [Request controls](https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/middlewares/auth.middleware.js): Middleware · Authentication, roles, rate limits, and uploads run before handlers. · `Backend/src/middlewares/auth.middleware.js`
- [Accounts and alumni](https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/routes/auth.route.js): Routes/controllers/models · Auth, profiles, onboarding, and alumni migration. · `Backend/src/routes/auth.route.js`
- [Institutional catalog](https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/routes/department.route.js): Routes · Departments, opportunities, and projects. · `Backend/src/routes/department.route.js`
- [Posts](https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/routes/post.route.js): Route/controller/model · Central community-content aggregate. · `Backend/src/routes/post.route.js`
- [Comments and reactions](https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/routes/comment.route.js): Routes/models · Threaded comments, replies, and likes. · `Backend/src/routes/comment.route.js`
- [Connections](https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/routes/connection.route.js): Route/controller/model · User relationship graph. · `Backend/src/routes/connection.route.js`
- [Notifications](https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/services/notification.service.js): Service and socket · Persists and delivers realtime notifications. · `Backend/src/services/notification.service.js`
- [AI assistant](https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/services/aiAssistant.service.js): Service boundary · `Backend/src/services/aiAssistant.service.js`

### Data and integrations

- [SQL database](https://github.com/prodip-shadow/alumnet/blob/main/Backend/sql/schema.sql): Persistence · Schema-backed application data store. · `Backend/sql/schema.sql`
- [Cloudinary](https://github.com/prodip-shadow/alumnet/blob/main/Backend/src/services/cloudinary.service.js): Media storage · Uploads are managed through the Cloudinary service. · `Backend/src/services/cloudinary.service.js`

## Connections

- App Router root → Community home: renders
- App Router root → Login and registration: routes
- Community home → Feed composition: composes
- Community home → Shared navigation: uses
- Login and registration → Session state: establishes session
- Session state → API client: supplies credentials
- Feed composition → API client: reads and creates posts
- API client → Application assembly: HTTP requests
- Server startup → Application assembly: starts
- Application assembly → Request controls: applies
- Request controls → Accounts and alumni: guards
- Request controls → Posts: guards
- Request controls → Institutional catalog: guards
- Request controls → Connections: guards
- Posts → Comments and reactions: supports discussion
- Posts → Notifications: emits activity
- Connections → Notifications: emits activity
- Accounts and alumni → SQL database: persists
- Institutional catalog → SQL database: persists
- Posts → SQL database: persists
- Comments and reactions → SQL database: persists
- Connections → SQL database: persists
- Notifications → SQL database: stores notifications
- Request controls → Cloudinary: uploads media
- Application assembly → AI assistant: serves assistant requests
