An open-source, full-stack academic resource management and assignment workflow ecosystem built with Next.js 16 (App Router), TypeScript, Tailwind CSS v4, MongoDB, Google Drive Cloud Storage, Web Push (VAPID), and Trusted Web Activity (TWA) support.
- Executive Summary
- Product Vision & Motivation
- Problem Statement
- The Acadex Solution
- System Architecture
- Technology Stack & Dependency Audit
- Comprehensive Feature Inventory
- Database Architecture & Data Models
- Authentication, Sessions & Password Security
- Security Controls & Hardening
- Web Push Notifications & Service Worker Architecture
- Cloud Storage & Google Drive Hierarchy
- API Reference & Route Documentation
- User Flows & Use Cases
- Project Structure
- End-to-End Data Flows
- UI/UX Design Philosophy & Customization
- Performance Optimizations
- Error Handling & Fault Tolerance
- Local Development & Setup Guide
- Deployment & Infrastructure
- Testing & Quality Assurance
- Current Limitations & Known Technical Debt
- Future Scope & Planned Enhancements
- Development Story & Engineering Milestones
- Viva & Technical Examination Preparation (Q&A Bank)
Acadex is a centralized, secure, multi-tenant academic resource management platform engineered to resolve the fragmentation and inefficiency of student learning workflows. Built specifically for universities, colleges, and academic departments, Acadex consolidates course syllabi, lecture notes, lab manuals, assignments, and submission deadlines into a single, cohesive digital workspace.
By leveraging modern web capabilities—including Next.js 16 App Router, MongoDB Mongoose, Google Drive API (5 TB hierarchical storage), VAPID-based Web Push Notifications, HTTP-only JWT sessions, and PWA/TWA Android integration—Acadex provides instantaneous, cross-device access to learning materials. It empowers students with personalized assignment completion tracking, real-time deadline push alerts, and community resource submissions, while providing faculty and administrators with granular moderation queues, student roster management, and institutional audit logging.
+-------------------------------------------------------------------------+
| ACADEX |
| Centralized Academic Hub • Assignment Tracking • Real-time Web Push |
| Google Drive Hierarchical Cloud • Granular Role-Based Access Control |
+-------------------------------------------------------------------------+
Acadex is not merely a file repository; it is an academic workflow engine. It bridges the gap between passive resource sharing (downloading PDFs) and active academic execution (tracking assignments, submitting practicals, receiving deadline push alerts, and moderating peer-contributed notes).
In typical university environments, academic content is scattered across disparate channels:
- Unofficial WhatsApp/Telegram groups where links and PDF files expire, get buried, or get lost.
- Personal Google Drive folders with broken permissions and disorganized folders.
- Physical notice boards or verbal announcements in lecture halls.
- Complex, heavy, and outdated Learning Management Systems (LMS) that students avoid due to cumbersome interfaces.
Acadex replaces this chaotic workflow with a clean, high-performance, mobile-first web and Android application tailored precisely to the academic structure of university departments (Streams → Semesters → Sections → Subjects).
- Resource Fragmentation: Students waste valuable study time locating lecture notes, past exam papers, and lab manuals scattered across multiple WhatsApp chats and drive links.
- Missed Deadlines: Assignment deadlines and lab submission dates are frequently missed due to a lack of automated, personalized reminders.
- Progress Ambiguity: Students lack a clear, personal dashboard to visualize which assignments or practicals they have finished and which remain pending.
- Device Inconvenience: Many institutional portals are desktop-only and broken on mobile browsers.
- Repetitive Resource Distribution: Teachers repeatedly re-share the same PDFs and syllabus documents every semester.
- Roster & Section Chaos: Managing student accounts, handling section changes, and verifying student enrollment without a dedicated system causes administrative bottlenecks.
- Moderation Overhead: Unverified or outdated study materials circulate among students without quality checks or moderation controls.
- Announcement Noise: Important academic notices get lost in informal chat groups.
- Lack of Institutional Memory: High-quality student-created notes and practical solutions are lost when senior batches graduate.
- Infrastructure Cost: Hosting gigabytes of student documents directly on web servers is expensive and unscalable.
- Accountability & Security: No audit trail exists for who uploaded what, who approved requests, or when notices were published.
Acadex systematically resolves each of these challenges through purpose-built technical features:
| Academic Problem | Legacy Approach | Acadex Technical Solution |
|---|---|---|
| Scattered Materials | WhatsApp chats, Discord, loose Drive links | Hierarchical Course Library: Stream → Semester (1–8) → Subject → Resource Type (Notes/Assignments/Practicals). |
| Missed Assignment Deadlines | Handwritten diaries, verbal announcements | Automated Cron Reminders + Web Push: Background GitHub Actions cron executes every 15 minutes triggering VAPID push alerts to user devices. |
| Lack of Progress Tracking | Mental checkmarks, spreadsheets | Personalized Completion Engine: Completion and PracticalCompletion models allow 1-click toggling with real-time progress calculations. |
| Unmoderated File Sharing | Uncontrolled group uploads | Multi-Tier Moderation Queue: UserUpload pipeline requiring Section/Stream Admin verification before public library indexing. |
| Storage Limitations & Cost | Local server disks, paid file buckets | Google Drive Cloud Integration: Direct chunked streaming to Google Drive with automated subfolder resolution. |
| Access Control & Security | Public links, plain passwords | Role-Based Access Control (RBAC): HTTP-only JWTs, bcrypt password hashing, and Section/Stream isolation via Edge middleware. |
| Device Incompatibility | Desktop-only portals | Progressive Web App (PWA) & TWA: Offline-capable service worker, standalone Android app (com.au_acadex.twa), and adaptive mobile nav. |
Acadex follows a modern Decoupled Serverless / Edge Architecture deployed on Vercel with MongoDB Atlas for persistent metadata, Google Drive for binary blob storage, and the VAPID Web Push protocol for real-time notification delivery.
+-------------------------------------------------------------------------------+
| CLIENT LAYER |
| Desktop Browser / Mobile Browser (PWA) / Android Application (TWA APK) |
| [Service Worker (sw.js) • Local Storage • Install Banner • Theme Engine] |
+---------------------------------------+---------------------------------------+
| HTTPS / Secure Cookies
v
+-------------------------------------------------------------------------------+
| EDGE ROUTING & SECURITY LAYER |
| Next.js Edge Middleware (src/proxy.ts) |
| ├── JWT Verification (jose) & Cookie Extraction (acadex-token) |
| ├── Role-Based Access Enforcement (/admin vs /user/dashboard) |
| ├── Password-Change Enforcement Gate |
| └── Header Injection: x-user-id, x-user-role, x-user-section, x-user-stream |
+---------------------------------------+---------------------------------------+
| Internal Request Dispatch
v
+-------------------------------------------------------------------------------+
| APPLICATION BACKEND (Next.js) |
| |
| Frontend (React 19 / Server & Client Components / Tailwind v4) |
| ├── Student Dashboard (/user/dashboard/*) |
| ├── Admin Management Portal (/admin/*) |
| └── Public Pages (Landing, Login, Apply, About, Privacy, Contact) |
| |
| API Route Handlers (src/app/api/*) |
| ├── /api/auth/* ──> Authentication, bcrypt, OTP generation |
| ├── /api/notes/* ──> Note indexing, filtering, search |
| ├── /api/assignments/* ──> Assignment publishing, deadline tracking |
| ├── /api/completions/* ──> User assignment completion state |
| ├── /api/practicals/* ──> Lab manual & experiment management |
| ├── /api/upload/* ──> Chunked streaming to Google Drive |
| ├── /api/push/* ──> VAPID Web Push subscription broker |
| ├── /api/admin/* ──> Access approval, user roster, activity logs |
| └── /api/jobs/* ──> Deadline cron alerts & temp file cleanup |
+-------------------+-------------------+-------------------+-------------------+
| | |
v v v
+-----------------------+ +-----------------------+ +-----------------------+
| DATABASE LAYER | | STORAGE LAYER | | COMMUNICATION LAYER |
| MongoDB Atlas | | Google Drive API | | Resend / Web Push |
| (Mongoose Connection | | (Hierarchical Folders | | (Transactional Emails |
| Cache for Serverless)| | Stream/Sem/Subject) | | & VAPID Push Relays) |
+-----------------------+ +-----------------------+ +-----------------------+
The table below documents every core technology and npm package used in Acadex, its execution environment, and why it was selected.
| Technology / Package | Category | Execution Scope | Purpose & Architectural Rationale |
|---|---|---|---|
| Next.js 16.1.6 | Web Framework | Hybrid (Server & Client) | React framework utilizing App Router, Server Components, Turbopack builds, and Edge API route handlers. |
| React 19.2.3 / React DOM | UI Library | Client & Server | Core rendering engine for component trees, hooks, and suspense boundaries. |
| TypeScript 5 | Language | Build Time | Ensures end-to-end type safety across API responses, Mongoose schemas, and UI props. |
| Tailwind CSS v4 | Styling | Client / Build | Utility-first CSS framework delivering ultra-fast styles with native CSS variable color theming. |
| MongoDB / Mongoose 9.2.2 | Database ODM | Server-Side Only | Schema definition, validation, indexing, and connection caching (global.mongooseCache) for serverless environments. |
| jsonwebtoken (9.0.3) | Authentication | Server API Routes | Signs and verifies 7-day TTL JWT tokens in Node.js serverless route handlers. |
| jose | Authentication | Edge Middleware | Lightweight, Web-Standards-compliant JWT verifier used in src/proxy.ts Edge runtime where Node crypto is unavailable. |
| bcryptjs (3.0.3) | Password Hashing | Server-Side Only | One-way password hashing with automatic salt generation; ensures zero plaintext credentials in DB. |
| googleapis (174.0.1) | Cloud Storage | Server-Side Only | Connects to Google Drive API via OAuth2 Refresh Token / Service Account for 5 TB hierarchical file storage. |
| web-push (3.6.7) | Push Notifications | Server-Side Only | Implements VAPID protocol to sign and deliver push notification payloads to browser push endpoints. |
| resend (6.18.1) | Transactional Email | Server-Side Only | Dispatches HTML emails for OTP verification, access request approvals, and contact inquiries. |
| zod (4.3.6) | Input Validation | Hybrid | Strict schema validation for login requests, profile updates, and file metadata before DB persistence. |
| lucide-react (0.575.0) | Iconography | Client-Side | Scalable, clean SVG iconography used across the student dashboard and admin panels. |
| motion (12.34.3) | UI Animations | Client-Side | Smooth layout transitions, modal animations, and card hover effects. |
| next-themes (0.4.6) | Theme Management | Client-Side | Manages light/dark/system theme states with zero layout shift and local storage persistence. |
| sonner (2.0.7) | Toast Notifications | Client-Side | High-performance, accessible toast alert notification system for user feedback. |
| pdfjs-dist (3.11.174) | PDF Processing | Server / Client | Renders PDF previews and extracts metadata inside the /user/dashboard/viewer route. |
| uuid (13.0.0) | Utilities | Server-Side Only | Generates unique upload session IDs and tracking tokens. |
- Custom Academic Dashboard: Displays current semester subjects, recent notes, active assignments, lab practicals, and upcoming submission deadlines in one view.
- Assignment Completion Tracker: Students can mark assignments as completed with 1 click; status is saved to
Completioncollection and updates progress bars. - Practical Lab Tracker: Tracks written experiments and lab manual progress via
PracticalCompletionrecords. - Resource Library Browser: Filter study notes, PPTs, question banks, and reference books by Subject, Semester, and Section.
- In-App PDF Viewer: Embedded PDF reader (
/user/dashboard/viewer) allowing students to study without leaving the platform. - Student Upload Submission: Students can upload notes or assignments (
/user/dashboard/uploads); submissions enter an admin review queue. - Personal Profile & Preferences:
- 9 Color Accent Themes (AMOLED, Rose, Ocean, Emerald, Violet, Sunset, Pastel, Contrast, Default).
- Dark / Light / System Mode toggle.
- Mobile Navigation Bar position customization (Bottom, Top, Left).
- Dashboard Layout view options (Grid, List, Detail).
- Profile Picture cropping and uploading (with Google Drive backing).
- Notification Opt-In Preferences: Granular per-user toggles for New Notes, New Assignments, Practicals, Deadline Reminders, and Admin Announcements.
- Admin Overview Dashboard: Institutional metrics showing total active students, total notes, pending access requests, and unapproved uploads.
- Access Request Approval Portal: Review student registration applications with 1-click Approve (creates user account & sends auto-login email) or Deny (sends reason email).
- Academic Content Publishing: Direct publishing tools for Notes, Assignments, Practicals, and Subjects with file attachment streaming to Google Drive.
- Student Roster Management: View, search, filter, edit, ban, suspend, or reset passwords for students across Sections and Streams.
- Upload Moderation Panel: Review peer-uploaded study notes with preview, approve to publish globally, or deny with feedback notes.
- System Broadcast Dispatcher: Send instant web push notifications and in-app alerts to specific Sections, Streams, or all students.
- Security Activity Audit Log: Real-time log table of administrative operations, logins, password changes, and resource deletions.
- College ID Primary Login: Clean authentication using Roll Number / College ID + Password.
- Password Reset with Email OTP: Self-service password recovery using 6-digit cryptographic OTPs dispatched via Resend.
- Mandatory First-Time Password Change: Force flag (
must_change_password) that routes temporary-credential users to/change-passwordbefore granting dashboard access. - Access Application Portal (
/apply): Prospective students submit enrollment details without needing an existing account.
Acadex uses MongoDB Atlas managed through Mongoose 9 schemas with sparse indexes, compound indexes, and relational references.
+-------------------+ +-------------------+
| Stream | 1 N | Section |
| (e.g., BCA, CSE) +--------->+ (e.g., Sec A, B) |
+---------+---------+ +---------+---------+
| 1 | 1
| |
| N | N
v v
+---------+---------+ +---------+---------+
| Subject | | User |
| (Code, Semester) | | (Student / Admin) |
+---+-----+-----+---+ +---+-----+-----+---+
| | | | | |
1 | 1 | 1 | 1 | 1 | 1 |
v v v v v v
+---+--+ +--+--+ +--+----+ +-----+--+ +--+--+ +-----+----+
| Note | |Asgn | |Prac- | |Comple- | |Push | | Activity |
| | |ment | |tical | |tion | |Sub | | Log |
+------+ +-----+ +-------+ +--------+ +-----+ +----------+
User(src/models/User.ts): Stores user identity (name,college_id,email,password_hash), role (student,admin,isSuperAdmin), academic placement (stream,section,semester), UI preferences (theme,accentColor,mobileNavPosition,dashboardView), notification flags (notificationPreferences), and account status (active,banned,suspended).AccessRequest(src/models/AccessRequest.ts): Stores student enrollment applications (name,college_id,email,stream,section,semester,reason,status,admin_note).Stream(src/models/Stream.ts): Academic branches (e.g., BCA, B.Tech CSE).Section(src/models/Section.ts): Class subdivisions linked to a Stream and Semester.Subject(src/models/Subject.ts): Course subjects linked to Stream and Semester.Note(src/models/Note.ts): Academic notes with Google Drive URL, subject, stream, semester, section, and uploader ID.Assignment(src/models/Assignment.ts): Assignment briefs with submission deadline date, file URL, subject, and section.Completion(src/models/Completion.ts): Tracks individual student completion of assignments (user↔assignmentunique compound index).Practical(src/models/Practical.ts): Lab experiment guides, code files, and manuals.PracticalCompletion(src/models/PracticalCompletion.ts): Tracks practical experiment completion per student.LibraryResource(src/models/LibraryResource.ts): Reference textbooks, syllabi, and question papers.UserUpload(src/models/UserUpload.ts): Peer-submitted study resources pending admin moderation.UserRequest(src/models/UserRequest.ts): Student requests for missing notes, section changes, or syllabus updates.AdminRequest(src/models/AdminRequest.ts): Inter-admin workflow requests.Notification(src/models/Notification.ts): In-app notification records with target user arrays andreadByuser ID tracking.PushSubscription(src/models/PushSubscription.ts): Browser Web Push endpoints, P256DH keys, and Auth secrets per user.ActivityLog(src/models/ActivityLog.ts): Audit trail of admin actions, logins, and moderation decisions.ContactMessage(src/models/ContactMessage.ts): Visitor messages from/contactwith admin reply tracking.OTP(src/models/OTP.ts): 6-digit verification codes with TTL expiration indexes.DeadlineReminderLog(src/models/DeadlineReminderLog.ts): Deduplication log preventing duplicate cron push alerts for the same deadline.
Acadex adheres to strict cryptographic standards:
- Raw Passwords are NEVER Stored: When a user registers or resets their password, the plaintext password is processed by
bcryptjswith auto-generated salts. - One-Way Mathematical Transformation: The stored
password_hashcannot be decrypted or converted back into plaintext by developers, database administrators, or attackers. - Verification: During login,
bcrypt.compare(inputPassword, user.password_hash)evaluates the hash without revealing the secret.
- Stateless JWT Tokens: On successful login, the server generates a signed JSON Web Token using
jsonwebtokenwithJWT_SECRET. - Payload Structure:
{ "userId": "66b1...", "collegeId": "BCA2401", "role": "student", "name": "Alex Smith", "section": "66b2...", "semester": 4, "exp": 1724000000 } - Storage in
acadex-tokenCookie:httpOnly: true→ Inaccessible to client-side JavaScript (prevents Cross-Site Scripting / XSS token theft).secure: true(in production) → Transmitted exclusively over encrypted HTTPS.sameSite: "lax"→ Protects against Cross-Site Request Forgery (CSRF).maxAge: 604800(7 Days) → Automatic session expiration.
Before any request reaches a Next.js page or API route, the Edge Middleware validates the session:
- Reads
acadex-tokencookie. - Verifies signature using
jose(jwtVerify). - If token is invalid or missing on protected routes (
/user/dashboard/*,/admin/*), immediately redirects to/login(or returns 401 for/api/*). - If role is not
adminon/admin/*, blocks access with 403 Forbidden. - Injects verified user context into request headers (
x-user-id,x-user-role,x-user-section) for zero-overhead downstream consumption.
Acadex implements defense-in-depth across the entire application stack:
+-------------------------------------------------------------------------+
| ACADEX SECURITY MATRIX |
+----------------------+--------------------+-----------------------------+
| Threat Category | Attack Vector | Acadex Defense Mechanism |
+----------------------+--------------------+-----------------------------+
| Session Hijacking | XSS Cookie Theft | HTTP-Only, SameSite Cookies |
| Credential Leakage | DB Dump Exposure | bcrypt One-Way Salted Hash |
| Privilege Escalation | Tampered Role API | Edge Middleware RBAC Checks |
| Injection Attacks | Malicious Form Data| Zod Schema + Mongoose Types |
| Clickjacking | Iframe Embedding | X-Frame-Options: SAMEORIGIN |
| MIME Sniffing | Executable Uploads | X-Content-Type-Options |
| MITM Eavesdropping | HTTP Downgrades | Strict-Transport-Security |
| Spam & Vandalism | Unapproved Uploads | Admin Moderation Queue |
| Unauthorized Crons | Public Job Calls | CRON_SECRET Bearer Token |
+----------------------+--------------------+-----------------------------+
Strict-Transport-Security: max-age=63072000; includeSubDomains; preloadX-Content-Type-Options: nosniffX-Frame-Options: SAMEORIGINReferrer-Policy: strict-origin-when-cross-originPermissions-Policy: camera=(), microphone=(), geolocation=(), interest-cohort=()
Acadex features an integrated Web Push & Service Worker System compliant with the W3C Push API and VAPID standards.
1. Student Browser 2. Acadex Server 3. Push Service (FCM/Apple)
| | |
|── GET /api/push/public-key ─>| |
|<─ Returns VAPID Public Key ──| |
| | |
|── pushManager.subscribe() ──>| |
|── POST /api/push/subscribe ─>| (Saves endpoint & keys in DB) |
| | |
| [EVENT OCCURS] |
| (e.g., Assignment Posted) |
| | |
| |── webpush.sendNotification() ───>|
| | (Signed with VAPID Private Key)|
| |
|<────────────────── OS Push Event Dispatched ────────────────────|
v
4. Service Worker (public/sw.js)
|── Displays Native OS Notification: self.registration.showNotification()
|── Broadcasts to Active Tabs: client.postMessage({ type: "NEW_NOTIFICATION" })
v
5. Dashboard Layout (src/components/dashboard-layout.tsx)
└── Dynamically increments unread badge & refreshes notifications without page reload!
VAPID_PUBLIC_KEY: Exposed to the browser viaGET /api/push/public-keyfor client-side subscription negotiation.VAPID_PRIVATE_KEY: Strictly server-side. Used byweb-pushto sign push payload tokens. Never exposed to clients.VAPID_EMAIL: Contact identifier required by push relays (e.g.,mailto:admin@au-acadex.com).
Acadex routes all binary files (PDFs, PPTs, DOCX, Images) to a 5 TB Google Drive Cloud Repository via src/lib/gdrive.ts.
When a file is uploaded, Acadex dynamically traverses and creates the required folder structure in Google Drive:
[Google Drive Root Folder]
└── [Stream: BCA]
└── [Semester 4]
└── [Subject: Database Management Systems]
├── Notes/
├── Assignments/
└── Practicals/
- Chunked Streaming (
/api/upload/chunk): Supports large file transfers by breaking uploads into manageable chunks to prevent serverless timeout limits. - Duplicate Detection (
/api/upload/check-duplicate): Checks existing file hashes/names before uploading to conserve storage space.
POST /api/auth/login— Authenticate via College ID + Password; setsacadex-tokencookie.POST /api/auth/logout— Clearsacadex-tokencookie.GET /api/auth/me— Fetches current authenticated user session data.POST /api/auth/forgot-password— Initiates password reset by sending 6-digit OTP to email.POST /api/auth/verify-otp— Verifies OTP and updates user password.POST /api/auth/change-password— Authenticated password update endpoint.
GET /api/notes— Fetch study notes (filtered by subject, semester, section).POST /api/notes— Create new study note (Admin / Approved upload).GET /api/assignments— Fetch assignments with deadline information.POST /api/assignments— Create new assignment (Admin only).GET /api/practicals— Fetch lab practicals and experiment manuals.GET /api/library— Access textbooks, syllabi, and reference materials.
GET /api/completions— Returns list of completed assignment IDs for authenticated user.POST /api/completions— Toggle assignment completion state ({ assignmentId }).GET /api/practical-completions— Returns list of completed practical experiment IDs.POST /api/practical-completions— Toggle practical completion state ({ practicalId }).
GET /api/push/public-key— Returns public VAPID key.POST /api/push/subscribe— Stores push subscription endpoint and cryptographic keys.GET /api/notifications— Returns in-app notifications and unread count.POST /api/notifications/[id]/read— Marks notification as read.
GET /api/jobs/deadline-reminders— Evaluates upcoming assignment deadlines and sends push notifications to enrolled students. Protected byBearer <CRON_SECRET>orx-cron-secret.
- Student navigates to
/loginand enters College ID + Password. - Edge middleware validates credentials and routes to
/user/dashboard. - Student clicks Assignments in the navigation bar.
- Dashboard loads assignments filtered to the student's Stream and Semester.
- Student reviews assignment instructions, downloads attached PDF note from Google Drive.
- Student completes the work and clicks the Mark Complete checkmark.
POST /api/completionsrecords the completion in MongoDB; UI progress bar increments immediately.
- Student navigates to
/user/dashboard/uploadsand selects Upload New Note. - Selects Subject, Semester, Title, and attaches PDF.
- System uploads file to Google Drive and creates
UserUploadrecord with statuspending. - Section Admin receives real-time Web Push notification: "New study material submitted for review".
- Admin opens
/admin/user-uploads, reviews the PDF preview, and clicks Approve. - The note is indexed into the public
Notelibrary; a Web Push alert is automatically broadcast to all students in that Section.
Acadex/
├── .github/
│ └── workflows/
│ └── deadline-reminders.yml # GitHub Actions 15-minute cron job
├── public/
│ ├── .well-known/
│ │ └── assetlinks.json # Android TWA digital asset link verification
│ ├── images/ # Optimized PWA icons (192x192, 512x512)
│ ├── manifest.json # PWA manifest (standalone mode, theme color)
│ ├── robots.txt # Search crawler directives
│ └── sw.js # Service Worker (Push events & client sync)
├── src/
│ ├── app/
│ │ ├── (public)/ # Landing (/), About (/about), Contact (/contact), Apply (/apply)
│ │ ├── about/privacy/ # Audited Plain-English Privacy Policy (/about/privacy)
│ │ ├── admin/ # Admin portal (Users, Requests, Streams, Uploads)
│ │ ├── api/ # 21 Serverless API Route domains
│ │ ├── login/ # Student & Admin authentication portal
│ │ ├── user/dashboard/ # Student workspace (Notes, Assignments, Practicals)
│ │ ├── layout.tsx # Root layout (Theme provider, Install banner)
│ │ └── not-found.tsx # 404 page
│ ├── components/
│ │ ├── ui/ # Radix UI primitives & styled components
│ │ ├── bottom-nav.tsx # Adaptive mobile bottom navigation bar
│ │ ├── dashboard-layout.tsx # Authenticated layout with live notification badge listener
│ │ ├── install-banner.tsx # PWA smart installation prompt banner
│ │ ├── navbar.tsx # Desktop header & user menu
│ │ ├── sidebar.tsx # Desktop collapsible sidebar navigation
│ │ └── theme-toggle.tsx # 9-theme palette switcher
│ ├── context/
│ │ └── user-context.tsx # Global client-side user state provider
│ ├── lib/
│ │ ├── auth.ts # Node.js JWT signing & cookie helpers
│ │ ├── client-auth.ts # Client-side user cache & profile fetcher
│ │ ├── db.ts # Mongoose connection manager with cache
│ │ ├── gdrive.ts # Google Drive API 5TB hierarchical storage
│ │ ├── mail.ts # Resend email templates & dispatcher
│ │ ├── push/ # Web Push VAPID configuration & send helpers
│ │ └── validations.ts # Zod schemas for request validation
│ ├── models/ # 20 Mongoose Data Models
│ └── proxy.ts # Edge Middleware (JWT verification & RBAC)
├── next.config.ts # Turbopack, headers, and image configuration
├── package.json # Dependency manifests & npm scripts
├── tsconfig.json # TypeScript compiler configuration
└── vercel.json # Vercel deployment configuration
User (Browser) ──> [POST /api/auth/login]
│
├──> Zod Input Validation
├──> MongoDB: Find User by college_id
├──> bcrypt.compare(password, password_hash)
│ │ (Invalid ──> Return 401)
│ v (Valid)
├──> ActivityLog.create("LOGIN")
├──> jwt.sign(payload, JWT_SECRET, { expiresIn: "7d" })
└──> Response: Set-Cookie: acadex-token (HttpOnly, Secure)
- Function-Driven Design: Clean, distraction-free interface prioritizing quick access to academic materials with zero unnecessary fluff.
- Mobile-First Responsive Layout: Full parity between mobile and desktop with a native-feeling bottom navigation bar on mobile and a spacious sidebar on desktop.
- 9 Theme Customization Palettes: AMOLED Pure Dark, Rose, Ocean, Emerald, Violet, Sunset, Pastel, High-Contrast, and Default Slate.
- Zero Layout Shifts: CSS variables and Next Themes guarantee instant theme rendering without flashing white screens.
- Server Components & Streaming: Heavy pages use React Server Components for minimal client-side JavaScript payloads.
- Mongoose Serverless Connection Caching: Global connection pooling (
global.mongooseCache) prevents database connection exhaustion during traffic spikes. - Turbopack Build Optimization: Sub-second local HMR and ~19-second full production builds across 82 routes.
- Next.js Image Optimization: Automatic conversion of images to modern
.webpand.avifformats. - Database Indexes: Compound and sparse indexes on high-frequency queries (
college_id,status,stream + semester + role).
- Push Failure Isolation: Web Push failures are wrapped in non-blocking try/catch blocks; a temporary browser push failure will never interrupt or fail primary database operations.
- Graceful API Error Responses: Structured JSON error responses (
{ error: "Meaningful error message" }) with appropriate HTTP status codes (400, 401, 403, 404, 500). - Client Toast Feedback: Sonner toast alerts provide immediate, non-intrusive feedback for network failures, validation errors, and successes.
- Node.js:
v20.xor higher - npm:
v10.xor higher - MongoDB: A running MongoDB instance or free MongoDB Atlas URI.
git clone https://github.com/Techy-Play/Acadex.git
cd Acadex
npm installCreate a .env.local file in the root directory:
# Database
MONGODB_URI=mongodb+srv://<username>:<password>@cluster.mongodb.net/acadex?retryWrites=true&w=majority
# Authentication
JWT_SECRET=your_super_secret_random_jwt_key_min_32_characters
# Application URL
NEXT_PUBLIC_APP_URL=http://localhost:3000
# Resend Email Delivery
RESEND_API_KEY=re_your_resend_api_key
RESEND_FROM_EMAIL=Acadex <noreply@send.au-acadex.com>
# Web Push (VAPID) — Generate via: npx web-push generate-vapid-keys
VAPID_PUBLIC_KEY=your_generated_public_vapid_key
VAPID_PRIVATE_KEY=your_generated_private_vapid_key
VAPID_EMAIL=mailto:admin@au-acadex.com
# Background Job Secret
CRON_SECRET=your_strong_random_cron_secret
# Google Drive Cloud Storage (Option A: Service Account)
GOOGLE_SERVICE_ACCOUNT_JSON={"type":"service_account",...}
GOOGLE_DRIVE_ROOT_FOLDER_ID=your_google_drive_folder_id
# Google Drive Cloud Storage (Option B: OAuth2 Refresh Token)
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_REFRESH_TOKEN=your_google_refresh_tokennpm run seednpm run devOpen http://localhost:3000 in your browser.
Acadex is pre-configured for Vercel zero-configuration deployments:
- Vercel Build Command:
next build(Next.js with Turbopack) - Environment Variables: Mirror
.env.localkeys into the Vercel Project Settings. - Scheduled Cron Reminders: Configured via GitHub Actions workflow (
.github/workflows/deadline-reminders.yml) callingGET /api/jobs/deadline-remindersevery 15 minutes withCRON_SECRET. - Android TWA Integration: Verified via
public/.well-known/assetlinks.jsonmapping to packagecom.au_acadex.twa.
- TypeScript Type Checking:
npx tsc --noEmitverifies strict type correctness across the entire codebase. - Production Build Validation:
npm run buildcompiles and verifies all 82 dynamic and static routes. - Linting: ESLint (
npm run lint) ensures code cleanliness and Next.js best practices.
- In-Memory Upload Buffer: File uploads pass through the serverless function memory buffer before streaming to Google Drive. Very large files (>50MB) require chunked upload handling.
- No Real-Time WebSocket Channel: Real-time updates rely on Web Push events and polling rather than persistent WebSocket connections.
- Google Drive Dependency: High-volume file serving depends on Google Drive API rate limits.
- Institutional Attendance Tracking: Real-time subject-wise attendance tracking and shortage alerts.
- Direct S3 / Cloudflare R2 Storage Adapter: Optional multi-cloud file storage backend.
- Offline PDF Caching: IndexedDB storage of downloaded lecture notes inside the Service Worker.
- Automated Syllabus Analytics: AI-powered completion forecasts and revision schedules based on semester exam dates.
Acadex was conceived and engineered by student developers seeking to solve real academic disorganization in college departments. Key technical milestones achieved during development include:
- Transitioning from basic relational models to Mongoose serverless-cached architecture.
- Upgrading from standard client-side tokens to Edge-verified HTTP-Only JWT cookies (
jose). - Implementing Google Drive hierarchical API automation to replace expensive local storage buckets.
- Architecting a zero-overhead Web Push notification engine that synchronizes unread badges across active browser tabs via Service Worker messaging.
This section provides technically rigorous answers to questions examiners, professors, or evaluators may ask during project presentations.
Q: Why did you choose Next.js 16 instead of a standard React SPA + Express.js setup?
- Answer: Next.js 16 provides a unified, full-stack architecture with React Server Components, built-in Edge Middleware, and optimized API Route handlers in a single repository. This eliminates CORS configuration overhead, reduces bundle sizes by rendering static content on the server, and allows zero-configuration deployment on Vercel edge networks.
Q: How does Mongoose manage database connections in a serverless environment?
- Answer: In serverless functions, each invocation can spawn a new instance. If not managed, this creates thousands of open database connections. Acadex uses a global connection cache (
global.mongooseCacheinsrc/lib/db.ts) that reuses existing connections across hot reloads and serverless function executions.
Q: Why do you store JWTs in an HTTP-Only cookie rather than localStorage?
- Answer: Storing tokens in
localStoragemakes them vulnerable to theft via Cross-Site Scripting (XSS). An attacker injecting malicious JavaScript could readlocalStorage.getItem('token'). By usinghttpOnly: true,secure: true, andsameSite: "lax", the browser forbids JavaScript from accessing the cookie, preventing token exfiltration.
Q: Explain how passwords are protected in Acadex.
- Answer: Passwords are never saved in plaintext. During registration or password resets, the raw password is processed using
bcryptjswith a computational cost factor and auto-generated salt. When logging in,bcrypt.compare()compares the cryptographic hash without decrypting it.
Q: What is VAPID and why is it necessary for Web Push?
- Answer: VAPID (Voluntary Application Server Identification) allows web push providers (like Google FCM or Apple APNs) to verify that push notifications originate from the authentic Acadex application server. The server signs the push request using its
VAPID_PRIVATE_KEY, while the push service verifies it using the public key.
Q: What happens if a user's browser or device is offline when a notification is triggered?
- Answer: The push service queues the message for a Time-To-Live (TTL) duration. When the device reconnects to the network, the push service delivers the payload to the browser's Service Worker (
public/sw.js). Furthermore, Acadex persists in-app notifications in MongoDB so students can always view their unread history upon logging in.
Q: Why did you choose Google Drive API for file storage instead of local disk storage?
- Answer: Serverless deployment platforms like Vercel have ephemeral file systems; files written to local disk are destroyed when the serverless container terminates. Google Drive provides durable, high-capacity cloud storage. Acadex automates folder structuring (
Stream -> Semester -> Subject -> Type) via the Google Drive REST API.
Acadex is a modern, full-stack academic resource and workflow management platform engineered to eliminate academic fragmentation in colleges and universities. Built with Next.js 16, TypeScript, Tailwind CSS v4, MongoDB, Google Drive Cloud Storage, and VAPID Web Push, Acadex provides a centralized, secure, and intuitive hub for course syllabi, lecture notes, lab practicals, and assignment deadlines.
With personalized student completion tracking, automated deadline alerts, peer-upload moderation workflows, and PWA/Android TWA integration, Acadex transforms chaotic academic communication into an efficient, collaborative learning experience.
Engineered with precision for the academic community.