How maybeanushka/nexus works
1. This is a Next.js App Router application for a student clearance workflow. The repository is organized around a public entry/auth flow, an authenticated dashboard area, and a set of backend utilities for MongoDB, file storage, email nudges, and admin seeding.
2. The main product boundary is the app/ tree. Public routes cover landing, login, registration, and certificate verification. Authenticated work lives under app/(dashboard), which is a route group for the logged-in experience and separates student-facing and admin-facing screens.
3. The student workflow is centered on application submission and status consumption. Key screens include submit-application, profile, fees, library, receipt/[id], certificate, and student-dashboard. Together these represent the path from registration and document upload to payment, dues handling, and final clearance outputs.
4. The admin workflow is split into distinct operational areas. admin-portal supports staged review, including per-record review pages and zip downloads. admin/library appears to handle library-specific administration, while the broader dashboard likely gives admins tools to inspect student records and mark clearance progress.
5. Authentication and session handling are centralized in lib/auth.ts, with logout exposed through app/api/logout/route.ts. The architecture implies role-based access across the dashboard, with public registration intentionally limited to student accounts only and admin accounts created separately.
6. Data access is backed by MongoDB, configured through MONGODB_URI and accessed through lib/db.ts plus lib/models.ts. The presence of lib/schema.sql suggests some schema documentation or migration history, but the runtime datastore is MongoDB, not a relational database.
7. File/document handling is a major subsystem. Uploads are stored either in S3 via lib/s3.ts or, if AWS settings are absent, fall back to local files under public/uploads. The stored artifacts are grouped by document type such as id_cards, lab_records, library_receipts, and profiles, which maps directly to clearance evidence and receipts.
8. The application has a public verification surface at app/verify/[id]. That route likely exposes a read-only lookup for certificates or clearance status, making verification a distinct public boundary separate from the authenticated dashboard.
9. A lightweight backend automation path exists for reminders. app/api/cron/nudge/route.ts and scripts/email_nudge.js indicate a scheduled or manually triggered nudge worker, using the email credentials described in the README. This is part of the operational layer rather than the core user workflow.
10. Admin provisioning is intentionally out-of-band. scripts/seed_admin.js creates privileged accounts from the command line, with role constraints like lab_admin, hod_admin, and principal_admin, and branch assignment only for HOD admins. That keeps admin bootstrap separate from public registration.
11. The UI is built from server-rendered route pages plus client components for interactive actions. Shared shell components like Sidebar and TopNav frame the dashboard, while leaf components such as SubmitForm, ProfileForm, ReviewForm, PaymentButton, DownloadDocsButton, ReceiptQR, and CopyLinkButton handle form submission, downloads, QR display, and user actions.
12. In diagram terms, the important flows are: public registration → MongoDB user record; authenticated dashboard → document upload/storage + record updates; admin review → status changes and downloadable bundles; receipt/certificate views → generated artifacts and verification links; and cron/email nudges → outbound reminders based on database state. The key external dependencies are MongoDB, optional AWS S3, and email delivery credentials.
Main entry points: db.ts MongoDB · actions.ts Actions · s3.ts Storage · page.tsx Landing
Components 26
Public entry
Landing, auth, and verification routes for unauthenticated users.
Dashboard app
Authenticated student and admin experience under the App Router dashboard.
- Dashboard shell · Authenticated layout wrapping dashboard routes.
app/(dashboard)/layout.tsx - Student hub · Overview and action center for student clearance progress.
app/(dashboard)/student-dashboard/page.tsx - Submit app · Application intake and document upload entry.
app/(dashboard)/submit-application/page.tsx - Profile · Student profile editing and persistence.
app/(dashboard)/profile/page.tsx - Fees · Payment and dues-related student screen.
app/(dashboard)/fees/page.tsx - Library · Library dues and clearance status view.
app/(dashboard)/library/page.tsx - Receipt · Receipt detail page with QR-based sharing.
app/(dashboard)/receipt/[id]/page.tsx - Certificate · Certificate display and share-link generation.
app/(dashboard)/certificate/page.tsx - Admin portal · Central admin queue and record management.
app/(dashboard)/admin-portal/page.tsx - Review case · Per-record review, status update, and zip export.
app/(dashboard)/admin-portal/review/[id]/page.tsx - Lib admin · Library-specific administrative screen.
app/(dashboard)/admin/library/page.tsx
Backend core
Shared server-side logic for auth, database, storage, and models.
- Auth · Authentication and session helpers.
lib/auth.ts - MongoDB · Database connection and persistence entrypoint.
lib/db.ts - Models · Mongo-backed model definitions.
lib/models.ts - Storage · S3 integration with local upload fallback.
lib/s3.ts - Actions · Shared mutation and workflow helpers.
lib/actions.ts - Logout API · Sign-out endpoint used by authenticated UI.
app/api/logout/route.ts
Operations
Automation and bootstrap scripts for reminders and admin provisioning.
- Nudge API · Scheduled reminder endpoint for outstanding actions.
app/api/cron/nudge/route.ts - Email nudge · Manual or scheduled reminder sender.
scripts/email_nudge.js - Seed admin · Creates privileged admin accounts out of band.
scripts/seed_admin.js
Connections 30
- Landing → Login: auth entry · Public users move from landing to sign-in.
- Landing → Register: new student · Landing page can route to registration.
- Landing → Verify: verify · Public verification surface is reachable from the site.
- Register → MongoDB: create user · Registration writes student records to MongoDB.
- Login → Auth: session · Login uses shared authentication/session logic.
- Dashboard shell → Sidebar: shell · Authenticated routes are wrapped with shared navigation.
- Dashboard shell → Top nav: shell · Authenticated routes use the top navigation shell.
- Auth → MongoDB: users · Auth reads and writes user/session state through the database.
- Auth → Logout API: sign out · Logout endpoint delegates session invalidation to auth logic.
- Submit app → Actions: submit · Application submission is handled by shared server actions.
- Submit app → Storage: uploads · Documents are stored through the file storage layer.
- Profile → Actions: save · Profile edits persist through shared mutation helpers.
- Fees → MongoDB: status · Fee status is read from persisted student records.
- Library → MongoDB: dues · Library dues screen consumes database state.
- Student hub → Actions: workflow · Student hub launches clearance-related actions.
- Receipt → MongoDB: receipt · Receipt views are populated from stored records.
- Receipt → Storage: docs · Receipt pages can reference stored artifacts.
- Receipt → Actions: qr/share · Receipt utilities rely on shared action helpers.
- Certificate → MongoDB: clearance · Certificate output is derived from persisted clearance state.
- Certificate → Actions: share link · Certificate page uses shared helpers for link generation.
- Admin portal → MongoDB: review queue · Admin portal reads records for staged review.
- Admin portal → Review case: open case · Admin portal routes into per-record review pages.
- Review case → Actions: approve · Review pages execute status updates through shared actions.
- Review case → Storage: bundle · Review pages can assemble downloadable document bundles.
- Lib admin → MongoDB: library admin · Library admin screen manages library-related records.
- Nudge API → MongoDB: due lookup · Cron endpoint selects records needing reminders.
- Nudge API → Email nudge: trigger · Cron endpoint drives outbound reminder sending.
- Email nudge → MongoDB: recipients · Reminder script queries database state for recipients.
- Seed admin → MongoDB: provision · Admin bootstrap writes privileged accounts into MongoDB.
- Storage → MongoDB: metadata · Uploads are associated with persisted records.