How prodip-shadow/alum-net works
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: [...nextauth]/route.js NextAuth endpoint · dashboard/layout.jsx Dashboard route shell · app/layout.jsx App Router root · backend-token/route.js Backend-token endpoint
Components 20
Next.js frontend
App Router UI, session handling, and backend-token bridge.
- App Router root
AlumNet/src/app/layout.jsx - Public landing
AlumNet/src/app/(common)/page.jsx - Login
AlumNet/src/app/login/page.jsx - Sign up
AlumNet/src/app/sign-up/page.jsx - NextAuth endpoint
AlumNet/src/app/api/auth/[...nextauth]/route.js - NextAuth configuration
AlumNet/src/lib/authOptions.js - Session provider
AlumNet/src/provider/NextAuthProvider.jsx - Dashboard route shell
AlumNet/src/app/(dashboard)/dashboard/layout.jsx - Dashboard composition
AlumNet/src/components/layout/DashboardLayout.jsx - Role dashboards · Audience-specific dashboard pages.
AlumNet/src/app/(dashboard)/dashboard/admin/page.jsx - Profile update
AlumNet/src/app/(dashboard)/dashboard/profile-update/page.jsx - Auth and profile actions
AlumNet/src/actions/server/auth.js - Backend-token endpoint · Translates the frontend session into an API JWT.
AlumNet/src/app/api/auth/backend-token/route.js - Backend JWT issuer
AlumNet/src/lib/issueBackendToken.js
ASP.NET API
Protected announcement service.
- API composition root
AlumNet.AspNetBackend/Program.cs - JWT verification
AlumNet.AspNetBackend/Middlewares/JwtVerificationMiddleware.cs - Announcement service
AlumNet.AspNetBackend/Services/AnnouncementService.cs - Announcement record
AlumNet.AspNetBackend/Models/Announcement.cs - MongoDB integration
AlumNet.AspNetBackend/Services/MongoDbService.cs
Other components
- MongoDB
Connections 21
- 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