A comprehensive, production-ready Student Management System built with Next.js 15, TypeScript, and MongoDB. This system provides complete student enrollment, management, and administrative capabilities with role-based access control.
- Communication Hub updates
- Back buttons added to Guideline and Coding zones
- Coding Zone now mirrors Guideline Zone, with detail pages at
/mission-communication-hub/helpzone/coding/[postId] - Sidebar simplified: concise labels and category text for non-links
- Admin sidebar labels simplified: "Students", "Moderators", "Assignments" (removed "Management")
- Mission Overview counts now use Mission V2 aggregate fields (
totalStudents,totalMentors,totalGroups) with Redux fallbacks - Counts on dashboards now sourced from correct APIs
- Students:
/api/students(usespagination.totalwhen available) - Courses:
/api/courses(total) - Active Missions:
/api/v2/missions?status=active(usespagination.total) - Assignments:
/api/assignments(total, pending derived from unpublished/unsubmitted)
- Students:
- Live totals: Students, Courses, Active Missions, Pending Assignments
- Quick actions to Students, Missions, Courses, Assignments
- Recent activity feed
- Admin/role-aware navigation and simplified sidebar labels
- Mission context selector and Mission Overview
- V2-backed counts:
totalStudents,totalMentors,totalGroupswith client fallbacks - Students: assign, manage, and view capacity usage per mission
- Mentors: list, status, workload; assign students to mentors
- Mentorship Groups: create/list/analyze groups; student/mentor membership
- Analytics: mission/group-level trends and summaries
- Channels for Announcements, Guideline Session, Resources (mission-wide)
- Admin channels for messaging/resources (admins/mentors)
- Helpzone with Guideline and Coding zones
- Search and status filter, markdown content, comments/replies
- Detail pages:
/mission-communication-hub/helpzone/guideline/[postId]and/helpzone/coding/[postId] - Back buttons and simplified sidebar (category text for non-links)
- Complete Authentication System - JWT-based authentication with role-based access control
- Student Enrollment Workflow - Enroll β Invite β Activate β Manage
- Student Profile Management - Comprehensive student profiles with batch memberships
- Admin Dashboard - Full administrative control with student management
- Student Dashboard - Student self-service portal
- Password Management - Reset and forgot password functionality
- Email Integration - Automated email notifications and invitations
- Admin - Full system access and management
- Student - Profile viewing/editing and course access
- Manager - Limited administrative access
- Instructor - Course and assignment management
- Modern Tech Stack - Next.js 15, React 19, TypeScript, Tailwind CSS
- Database - MongoDB with Mongoose ODM
- Security - JWT tokens, HTTP-only cookies, password hashing
- API - 50+ RESTful endpoints with comprehensive CRUD operations
- UI/UX - Responsive design with modern components
- File Upload - Cloudinary integration for media files
Before running this project, ensure you have:
- Node.js (v18 or higher)
- npm or yarn package manager
- MongoDB database (local or cloud)
- Email service (for notifications)
-
Clone the repository
git clone <repository-url> cd sms-web
-
Install dependencies
npm install # or yarn install -
Environment Setup Create a
.env.localfile in the root directory:# Database MONGODB_URI=mongodb://localhost:27017/sms-database # JWT Secret (generate a secure 64-character string) JWT_SECRET_KEY=your-super-secure-jwt-secret-key-here-64-chars-long # Email Configuration (Gmail example) EMAIL_HOST=smtp.gmail.com EMAIL_PORT=587 EMAIL_USER=your-email@gmail.com EMAIL_PASS=your-app-password # Cloudinary (optional - for file uploads) CLOUDINARY_CLOUD_NAME=your-cloud-name CLOUDINARY_API_KEY=your-api-key CLOUDINARY_API_SECRET=your-api-secret # Application NEXTAUTH_URL=http://localhost:3000 NEXTAUTH_SECRET=your-nextauth-secret
-
Database Setup
- Ensure MongoDB is running
- The application will automatically create collections and indexes
-
Start the development server
npm run dev # or yarn dev -
Access the application Open http://localhost:3000 in your browser
sms-web/
βββ src/
β βββ app/ # Next.js App Router
β β βββ (auth)/ # Authentication pages
β β βββ api/ # API routes (50+ endpoints)
β β βββ dashboard/ # Dashboard pages
β β βββ globals.css # Global styles
β βββ components/ # Reusable React components
β β βββ shared/ # Common UI components
β β βββ student-management/ # Student-specific components
β β βββ ui/ # Base UI components
β βββ context/ # React context providers
β βββ lib/ # Utility libraries
β βββ models/ # MongoDB/Mongoose models
β βββ schemas/ # Zod validation schemas
β βββ services/ # Business logic services
β βββ types/ # TypeScript type definitions
β βββ utils/ # Helper utilities
βββ public/ # Static assets
βββ package.json # Dependencies and scripts
βββ README.md # This file
- Secure token-based authentication
- HTTP-only cookies for token storage
- Automatic token refresh
- Role-based authorization
- bcrypt hashing for passwords
- Temporary password generation
- Password expiry management
- Secure password reset flow
- Middleware-based route protection
- Role-based access control
- Input validation with Zod
- Error handling and logging
- User - Authentication and basic user info
- StudentProfile - Detailed student information
- StudentEnrollment - Enrollment records
- StudentBatchMembership - Batch associations
- Batch - Academic batches
- Course - Course definitions
- CourseOffering - Course instances
- Semester - Academic semesters
- Assignment - Course assignments
- Exam - Examination records
- Mission - Learning missions
- Invitation - Student invitations
- AuditLog - System audit trail
POST /api/auth/login- User loginPOST /api/auth/register- User registrationPOST /api/auth/forgot-password- Password reset requestGET /api/auth/me- Get current userPOST /api/auth/change-password- Change password
GET /api/student-profiles- List all studentsGET /api/student-profiles/[id]- Get student detailsPUT /api/student-profiles/[id]- Update studentGET /api/student-profiles/me- Get own profilePOST /api/students/enroll- Enroll new studentPOST /api/students/invite- Send invitation
GET /api/batches- Manage batchesGET /api/courses- Manage coursesGET /api/semesters- Manage semestersGET /api/users- User management
- FormInput - Reusable form inputs
- Modal - Modal dialogs
- Toast - Notification system
- LoadingSpinner - Loading indicators
- Pagination - Data pagination
- SearchAndFilter - Search functionality
- StudentTable - Student listing
- StudentFilters - Advanced filtering
- StudentStatistics - Analytics display
- StudentAvatar - Profile pictures
All configuration is handled through environment variables. See the installation section for required variables.
The system automatically:
- Creates database indexes
- Validates data schemas
- Handles connections efficiently
- Provides error recovery
Supports multiple email providers:
- Gmail SMTP
- SendGrid
- AWS SES
- Custom SMTP servers
- Connect your repository to Vercel
- Set environment variables in Vercel dashboard
- Deploy automatically on push
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]- Use strong JWT secrets
- Configure production MongoDB
- Set up email service
- Enable HTTPS
- Configure CORS properly
# Test authentication
curl -X POST http://localhost:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"admin@example.com","password":"password"}'
# Test student profiles
curl -X GET http://localhost:3000/api/student-profiles \
-H "Authorization: Bearer YOUR_TOKEN"- Admin Flow: Login β Dashboard β Student Management
- Student Flow: Login β Profile β Edit Information
- Enrollment Flow: Enroll β Invite β Activate
MongoDB Connection Error
- Verify MongoDB is running
- Check connection string in
.env.local - Ensure network access
JWT Token Issues
- Verify JWT_SECRET_KEY is set
- Check token expiration
- Clear browser cookies
Email Not Sending
- Verify email credentials
- Check SMTP settings
- Test with different email provider
Build Errors
- Clear
.nextdirectory - Reinstall dependencies
- Check TypeScript errors
- Code Splitting - Automatic route-based splitting
- Image Optimization - Next.js built-in optimization
- Database Indexing - Optimized queries
- Caching - API response caching
- Lazy Loading - Component lazy loading
- API response times
- Database query performance
- User session tracking
- Error rate monitoring
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in the repository
- Check the troubleshooting section
- Review the API documentation
- v1.0.0 - Initial release with core functionality
- Complete student management system
- Role-based access control
- Email integration
- Modern UI/UX
Built with β€οΈ using Next.js, TypeScript, and MongoDB