# prodip-shadow/alum-net architecture

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

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

## Overview

#### Purpose and topology
AlumNet is a two-runtime alumni-network application: a Next.js frontend/BFF and a separate ASP.NET backend. The frontend provides public, authentication, and role-oriented dashboard routes; the backend currently exposes an announcement domain backed by MongoDB and protected by JWT middleware.

#### Next.js application entry and route structure
The primary frontend runtime starts from the App Router root at `AlumNet/src/app/layout.jsx`, with public landing content in `AlumNet/src/app/(common)/page.jsx`. Authentication screens are `AlumNet/src/app/login/page.jsx` and `AlumNet/src/app/sign-up/page.jsx`. Dashboard routing is grouped under `AlumNet/src/app/(dashboard)/dashboard/layout.jsx`, separating authenticated application views from common pages.

#### Identity and session boundary
NextAuth is mounted at `AlumNet/src/app/api/auth/[...nextauth]/route.js` and configured through `AlumNet/src/lib/authOptions.js`. Client-side session context is supplied by `AlumNet/src/provider/NextAuthProvider.jsx`. This is the frontend identity authority; server actions in `AlumNet/src/actions/server/auth.js` and `AlumNet/src/actions/server/profile.js` implement auth/profile mutations at the server boundary.

#### Backend-token bridge
The frontend has a dedicated endpoint at `AlumNet/src/app/api/auth/backend-token/route.js` plus token issuance logic in `AlumNet/src/lib/issueBackendToken.js`. This is the key trust boundary between NextAuth sessions and the ASP.NET API: frontend identity/session state is translated into a backend-consumable JWT rather than exposing frontend credentials directly to backend routes.

#### Dashboard and role-facing UI
Dashboard composition is centralized in `AlumNet/src/components/layout/DashboardLayout.jsx` and its route-level wrapper. Distinct role or audience pages exist for administrators, alumni, and students: `AlumNet/src/app/(dashboard)/dashboard/admin/page.jsx`, `AlumNet/src/app/(dashboard)/dashboard/alumni/page.jsx`, and `AlumNet/src/app/(dashboard)/dashboard/student/page.jsx`. Profile editing is a separate dashboard workflow at `AlumNet/src/app/(dashboard)/dashboard/profile-update/page.jsx`.

#### ASP.NET announcement service
The backend executable composition root is `AlumNet.AspNetBackend/Program.cs`. Announcement records are represented by `AlumNet.AspNetBackend/Models/Announcement.cs`; business/data access orchestration is in `AlumNet.AspNetBackend/Services/AnnouncementService.cs`. This backend is a bounded API service rather than part of the Next.js process.

#### Backend security and persistence
`AlumNet.AspNetBackend/Middlewares/JwtVerificationMiddleware.cs` guards requests using JWT verification, receiving tokens produced through the frontend bridge. MongoDB integration is encapsulated by `AlumNet.AspNetBackend/Services/MongoDbService.cs`, forming the persistence boundary used by announcement functionality. The system therefore depends materially on Next.js/Node.js, ASP.NET/.NET, NextAuth, JWT signing/verification, and MongoDB.

#### Primary request flow
Users enter public/auth routes, authenticate through NextAuth, and receive session-backed frontend access. Dashboard views and server actions operate under that session. When calling protected ASP.NET functionality, the frontend obtains a backend token through its bridge endpoint, then invokes the .NET API. The .NET JWT middleware validates the token before announcement services access MongoDB.

Main entry points: [`AlumNet/src/app/api/auth/[...nextauth]/route.js`](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/api/auth/%5B...nextauth%5D/route.js) (NextAuth endpoint), [`AlumNet/src/app/(dashboard)/dashboard/layout.jsx`](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/(dashboard)/dashboard/layout.jsx) (Dashboard route shell), [`AlumNet/src/app/layout.jsx`](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/layout.jsx) (App Router root), [`AlumNet/src/app/api/auth/backend-token/route.js`](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/api/auth/backend-token/route.js) (Backend-token endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Next.js frontend"]
  node_app_root["App Router root<br/>Next.js entry<br/>[layout.jsx]"]
  node_public_home["Public landing<br/>public route<br/>[page.jsx]"]
  node_login["Login<br/>auth route<br/>[page.jsx]"]
  node_signup["Sign up<br/>auth route<br/>[page.jsx]"]
  node_nextauth_route{{"NextAuth endpoint<br/>identity API<br/>[route.js]"}}
  node_auth_options["NextAuth configuration<br/>[authOptions.js]"]
  node_session_provider["Session provider<br/>client context"]
  node_dashboard_route["Dashboard route shell<br/>authenticated route<br/>[layout.jsx]"]
  node_dashboard_layout["Dashboard composition<br/>UI layout"]
  node_role_pages["Role dashboards<br/>admin, alumni, student routes<br/>[page.jsx]"]
  node_profile_page["Profile update<br/>dashboard route<br/>[page.jsx]"]
  node_server_actions["Auth and profile actions<br/>server actions<br/>[auth.js]"]
  node_backend_token_route{{"Backend-token endpoint<br/>JWT bridge API<br/>[route.js]"}}
  node_token_issuer["Backend JWT issuer<br/>token signing"]
end

subgraph group_backend["ASP.NET API"]
  node_api_root["API composition root<br/>ASP.NET entry<br/>[Program.cs]"]
  node_jwt_middleware{{"JWT verification<br/>request middleware"}}
  node_announcement_service["Announcement service<br/>domain service"]
  node_announcement_model["Announcement record<br/>domain model<br/>[Announcement.cs]"]
  node_mongo_service[("MongoDB integration<br/>persistence service<br/>[MongoDbService.cs]")]
end

node_mongodb[("MongoDB<br/>database")]

node_app_root -->|"renders"| node_public_home
node_app_root -->|"provides session context"| node_session_provider
node_app_root -->|"hosts"| node_dashboard_route
node_login -->|"authenticates through"| node_nextauth_route
node_signup -->|"registers/authenticates through"| node_nextauth_route
node_nextauth_route -->|"uses"| node_auth_options
node_session_provider -.->|"reads session"| node_nextauth_route
node_dashboard_route -->|"composes"| node_dashboard_layout
node_dashboard_route -->|"serves"| node_role_pages
node_dashboard_route -->|"serves"| node_profile_page
node_profile_page -->|"updates via"| node_server_actions
node_server_actions -.->|"operates under session"| node_nextauth_route
node_dashboard_layout -->|"requests API token"| node_backend_token_route
node_backend_token_route -->|"issues through"| node_token_issuer
node_backend_token_route -.->|"derives from session"| node_nextauth_route
node_token_issuer -->|"JWT authorizes API calls"| node_api_root
node_api_root -->|"protects requests with"| node_jwt_middleware
node_jwt_middleware -->|"permits protected requests to"| node_announcement_service
node_announcement_service -->|"manages"| node_announcement_model
node_announcement_service -->|"persists through"| node_mongo_service
node_mongo_service -->|"connects to"| node_mongodb

click node_app_root "https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/layout.jsx"
click node_public_home "https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/(common)/page.jsx"
click node_login "https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/login/page.jsx"
click node_signup "https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/sign-up/page.jsx"
click node_nextauth_route "https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/api/auth/%5B...nextauth%5D/route.js"
click node_auth_options "https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/lib/authOptions.js"
click node_session_provider "https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/provider/NextAuthProvider.jsx"
click node_dashboard_route "https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/(dashboard)/dashboard/layout.jsx"
click node_dashboard_layout "https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/components/layout/DashboardLayout.jsx"
click node_role_pages "https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/(dashboard)/dashboard/admin/page.jsx"
click node_profile_page "https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/(dashboard)/dashboard/profile-update/page.jsx"
click node_server_actions "https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/actions/server/auth.js"
click node_backend_token_route "https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/api/auth/backend-token/route.js"
click node_token_issuer "https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/lib/issueBackendToken.js"
click node_api_root "https://github.com/prodip-shadow/alum-net/blob/main/AlumNet.AspNetBackend/Program.cs"
click node_jwt_middleware "https://github.com/prodip-shadow/alum-net/blob/main/AlumNet.AspNetBackend/Middlewares/JwtVerificationMiddleware.cs"
click node_announcement_service "https://github.com/prodip-shadow/alum-net/blob/main/AlumNet.AspNetBackend/Services/AnnouncementService.cs"
click node_announcement_model "https://github.com/prodip-shadow/alum-net/blob/main/AlumNet.AspNetBackend/Models/Announcement.cs"
click node_mongo_service "https://github.com/prodip-shadow/alum-net/blob/main/AlumNet.AspNetBackend/Services/MongoDbService.cs"

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_root,node_public_home,node_login,node_signup,node_nextauth_route,node_auth_options,node_session_provider,node_dashboard_route,node_dashboard_layout,node_role_pages,node_profile_page,node_server_actions,node_backend_token_route,node_token_issuer toneBlue
class node_api_root,node_jwt_middleware,node_announcement_service,node_announcement_model,node_mongo_service toneAmber
class node_mongodb toneNeutral
```

## Components

### Next.js frontend

App Router UI, session handling, and backend-token bridge.

- [App Router root](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/layout.jsx): Next.js entry · `AlumNet/src/app/layout.jsx`
- [Public landing](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/(common)/page.jsx): public route · `AlumNet/src/app/(common)/page.jsx`
- [Login](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/login/page.jsx): auth route · `AlumNet/src/app/login/page.jsx`
- [Sign up](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/sign-up/page.jsx): auth route · `AlumNet/src/app/sign-up/page.jsx`
- [NextAuth endpoint](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/api/auth/%5B...nextauth%5D/route.js): identity API · `AlumNet/src/app/api/auth/[...nextauth]/route.js`
- [NextAuth configuration](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/lib/authOptions.js): auth config · `AlumNet/src/lib/authOptions.js`
- [Session provider](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/provider/NextAuthProvider.jsx): client context · `AlumNet/src/provider/NextAuthProvider.jsx`
- [Dashboard route shell](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/(dashboard)/dashboard/layout.jsx): authenticated route · `AlumNet/src/app/(dashboard)/dashboard/layout.jsx`
- [Dashboard composition](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/components/layout/DashboardLayout.jsx): UI layout · `AlumNet/src/components/layout/DashboardLayout.jsx`
- [Role dashboards](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/(dashboard)/dashboard/admin/page.jsx): admin, alumni, student routes · Audience-specific dashboard pages. · `AlumNet/src/app/(dashboard)/dashboard/admin/page.jsx`
- [Profile update](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/(dashboard)/dashboard/profile-update/page.jsx): dashboard route · `AlumNet/src/app/(dashboard)/dashboard/profile-update/page.jsx`
- [Auth and profile actions](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/actions/server/auth.js): server actions · `AlumNet/src/actions/server/auth.js`
- [Backend-token endpoint](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/app/api/auth/backend-token/route.js): JWT bridge API · Translates the frontend session into an API JWT. · `AlumNet/src/app/api/auth/backend-token/route.js`
- [Backend JWT issuer](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet/src/lib/issueBackendToken.js): token signing · `AlumNet/src/lib/issueBackendToken.js`

### ASP.NET API

Protected announcement service.

- [API composition root](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet.AspNetBackend/Program.cs): ASP.NET entry · `AlumNet.AspNetBackend/Program.cs`
- [JWT verification](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet.AspNetBackend/Middlewares/JwtVerificationMiddleware.cs): request middleware · `AlumNet.AspNetBackend/Middlewares/JwtVerificationMiddleware.cs`
- [Announcement service](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet.AspNetBackend/Services/AnnouncementService.cs): domain service · `AlumNet.AspNetBackend/Services/AnnouncementService.cs`
- [Announcement record](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet.AspNetBackend/Models/Announcement.cs): domain model · `AlumNet.AspNetBackend/Models/Announcement.cs`
- [MongoDB integration](https://github.com/prodip-shadow/alum-net/blob/main/AlumNet.AspNetBackend/Services/MongoDbService.cs): persistence service · `AlumNet.AspNetBackend/Services/MongoDbService.cs`

### Other components

- **MongoDB**: database

## Connections

- App Router root → Public landing: renders
- App Router root → Session provider: provides session context
- App Router root → Dashboard route shell: hosts
- Login → NextAuth endpoint: authenticates through
- Sign up → NextAuth endpoint: registers/authenticates through
- NextAuth endpoint → NextAuth configuration: uses
- Session provider → NextAuth endpoint: reads session
- Dashboard route shell → Dashboard composition: composes
- Dashboard route shell → Role dashboards: serves
- Dashboard route shell → Profile update: serves
- Profile update → Auth and profile actions: updates via
- Auth and profile actions → NextAuth endpoint: operates under session
- Dashboard composition → Backend-token endpoint: requests API token
- Backend-token endpoint → Backend JWT issuer: issues through
- Backend-token endpoint → NextAuth endpoint: derives from session
- Backend JWT issuer → API composition root: JWT authorizes API calls
- API composition root → JWT verification: protects requests with
- JWT verification → Announcement service: permits protected requests to
- Announcement service → Announcement record: manages
- Announcement service → MongoDB integration: persists through
- MongoDB integration → MongoDB: connects to
