Alpha.LMS is a next-generation Learning Management System built with cutting-edge technologies, featuring AI-powered lesson planning, automated grading, and comprehensive role-based dashboards.
β
Multi-Role Support: Student, Instructor, Parent, and Admin dashboards
β
AI-Powered Tools: Automated lesson planning and grading
β
MongoDB Integration: Robust database with Mongoose ODM
β
Cloudinary Integration: Seamless file uploads and media management
β
Zod Validation: Type-safe schema validation
β
JWT Authentication: Secure token-based authentication
β
Modern UI: Beautiful, responsive design with Tailwind CSS
β
Premium Footer: Professional site footer with newsletter signup
- Framework: Next.js 16.1.6 (App Router)
- UI Library: React 19.2.0
- Styling: Tailwind CSS 4.0
- Components: Radix UI, shadcn/ui
- Animations: Framer Motion
- Forms: React Hook Form + Zod validation
- Runtime: Node.js 24
- Database: MongoDB with Mongoose
- Authentication: JWT (jsonwebtoken)
- Password Hashing: bcryptjs
- File Storage: Cloudinary
- API: Next.js API Routes
- Language: TypeScript 5
- Package Manager: npm
- Linting: ESLint
- Build Tool: Next.js with Turbopack
- Node.js 18+ and npm
- MongoDB (local or Atlas cloud)
- Cloudinary account (optional, for file uploads)
cd /home/ramsan/Downloads/nextjs-template-master
npm installCopy the example environment file:
cp .env.example .env.localEdit .env.local with your configuration:
# MongoDB
MONGODB_URI=mongodb://localhost:27017/alpha-lms
# For MongoDB Atlas: mongodb+srv://<username>:<password>@cluster.mongodb.net/alpha-lms
# JWT Secret (change this!)
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
# Cloudinary (optional)
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME=your-cloud-name
CLOUDINARY_API_KEY=your-api-key
CLOUDINARY_API_SECRET=your-api-secret
# App
NEXT_PUBLIC_APP_URL=http://localhost:3000Option A: Local MongoDB
# Install MongoDB
sudo apt install mongodb-org
# Start MongoDB service
sudo systemctl start mongod
# Enable on boot
sudo systemctl enable mongodOption B: MongoDB Atlas (Cloud)
- Create account at https://www.mongodb.com/cloud/atlas
- Create a free cluster
- Get connection string
- Update
MONGODB_URIin.env.local
npm run devVisit: http://localhost:3000
./test-e2e.shThis script tests:
- β MongoDB connection
- β Environment configuration
- β Build process
- β API endpoints (health, register, login)
- β Frontend pages
- β Authentication flow
curl -X POST http://localhost:3000/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"name": "Test Student",
"email": "student@test.com",
"password": "password123",
"role": "STUDENT"
}'curl -X POST http://localhost:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "student@test.com",
"password": "password123"
}'curl -X POST http://localhost:3000/api/upload \
-F "file=@/path/to/image.jpg" \
-F "folder=alpha-lms/test"- Stats: Courses enrolled, hours learned, progress, certificates
- Active Courses: Continue learning with progress tracking
- Assignments: Upcoming deadlines and priorities
- AI Recommendations: Personalized learning suggestions
- Stats: Revenue, students, courses, ratings
- Course Management: Create, edit, publish courses
- Recent Activity: Student enrollments, completions, reviews
- Pending Reviews: Assignment submissions to grade
- Tools: Lesson planner (
/teach/planning), Auto-grader (/teach/grading)
- Stats: Total users, courses, revenue, active users
- System Health: API performance, database, storage
- User Management: Recent users, approvals
- Course Approvals: Review and approve new courses
- Analytics: User growth trends, top courses
- Student Progress: Track child's learning
- Reports: Performance analytics
- Subscription: Manage payment and plans
- User submits registration form
- Backend validates with Zod schema
- Password hashed with bcrypt
- User saved to MongoDB
- JWT token generated
- Token set as HTTP-only cookie
- User redirected to role-specific dashboard
- User submits credentials
- Backend finds user in MongoDB
- Password verified with bcrypt
- JWT token generated
- Token set as HTTP-only cookie
- User data returned (excluding password)
- Frontend stores user in localStorage
- Redirect to dashboard based on role
- Middleware checks for valid JWT token
- Token verified and decoded
- User data fetched from MongoDB
- Access granted/denied based on role
alpha-lms/
βββ src/
β βββ app/
β β βββ (auth)/ # Auth pages (login, register)
β β βββ (main)/ # Main app pages
β β β βββ dashboard/ # Student dashboard
β β β βββ admin/ # Admin dashboard
β β β βββ parent/ # Parent dashboard
β β βββ (instructor)/ # Instructor pages
β β β βββ teach/
β β β βββ dashboard/ # Instructor dashboard
β β β βββ planning/ # Lesson planner
β β β βββ grading/ # Auto-grader
β β βββ api/
β β β βββ auth/ # Authentication endpoints
β β β βββ courses/ # Course CRUD
β β β βββ upload/ # File upload
β β β βββ ai/ # AI features
β β βββ page.tsx # Landing page
β βββ components/
β β βββ ui/ # Reusable UI components
β β βββ auth/ # Auth components
β β βββ lesson-planner.tsx # Lesson planning
β β βββ automated-grader.tsx # Auto-grading
β β βββ file-upload.tsx # File upload
β β βββ site-footer.tsx # Footer
β βββ lib/
β β βββ db/
β β β βββ mongodb.ts # DB connection
β β β βββ models/ # Mongoose models
β β βββ auth/
β β β βββ jwt.ts # JWT utilities
β β βββ cloudinary.ts # Cloudinary config
β βββ schemas/
β β βββ index.ts # Zod schemas
β βββ types/
β βββ user.ts # TypeScript types
βββ .env.local # Environment variables
βββ .env.example # Example env file
βββ test-e2e.sh # E2E test script
βββ package.json
βββ README.md
npm run build
npm start- Install Vercel CLI
npm i -g vercel- Deploy
vercel- Set Environment Variables
- Go to Vercel Dashboard β Project β Settings β Environment Variables
- Add all variables from
.env.local
- Deploy Production
vercel --prodNetlify, Railway, Render: Similar process
- Connect GitHub repository
- Set build command:
npm run build - Set start command:
npm start - Add environment variables
{
name: string
email: string (unique)
password: string (hashed)
role: "STUDENT" | "INSTRUCTOR" | "PARENT" | "ADMIN"
avatar?: string
bio?: string
phone?: string
isEmailVerified: boolean
createdAt: Date
updatedAt: Date
}{
title: string
description: string
thumbnail?: string
instructor: ObjectId (ref: User)
price: number
level: "BEGINNER" | "INTERMEDIATE" | "ADVANCED"
category: string
tags: string[]
status: "DRAFT" | "PUBLISHED" | "ARCHIVED"
duration?: number
enrollmentCount: number
rating: number
reviewCount: number
createdAt: Date
updatedAt: Date
}{
user: ObjectId (ref: User)
course: ObjectId (ref: Course)
progress: number (0-100)
completedLessons: ObjectId[]
enrolledAt: Date
completedAt?: Date
lastAccessedAt: Date
}- Multi-role authentication (Student, Instructor, Parent, Admin)
- Role-based dashboards with unique features
- MongoDB integration with Mongoose
- JWT authentication with HTTP-only cookies
- Zod schema validation
- Cloudinary file upload integration
- Premium site footer with newsletter
- Automated Lesson Planning
- Automated Grading System
- AI Recommendations (mocked)
- Course creation and management
- Revenue tracking
- Student analytics
- Lesson planner
- Assignment grader
- Course enrollment tracking
- Progress monitoring
- Assignment submissions
- Personalized recommendations
- User management
- Course approval system
- System health monitoring
- Platform analytics
# Check if MongoDB is running
sudo systemctl status mongod
# Start MongoDB
sudo systemctl start mongod
# Check logs
sudo tail -f /var/log/mongodb/mongod.log# Clear cache and rebuild
rm -rf .next node_modules
npm install
npm run build# Kill process on port 3000
lsof -ti:3000 | xargs kill -9
# Or use different port
PORT=3001 npm run devPOST /api/auth/register- Register new userPOST /api/auth/login- Login userGET /api/auth/me- Get current userPOST /api/auth/logout- Logout user
GET /api/courses- Get all coursesPOST /api/courses- Create course (instructor only)GET /api/courses/[id]- Get course by IDPUT /api/courses/[id]- Update courseDELETE /api/courses/[id]- Delete course
POST /api/ai/lesson-plan- Generate lesson planPOST /api/ai/grade- Grade assignment
POST /api/upload- Upload file to Cloudinary
- Real AI Integration: Connect OpenAI/Gemini API for lesson planning and grading
- Payment Integration: Add Stripe for course purchases
- Real-time Features: WebSocket for live chat and notifications
- Video Streaming: Integrate video player for course content
- Analytics Dashboard: Advanced charts with Recharts
- Email Notifications: SendGrid/Resend integration
- Testing: Add Jest unit tests and Playwright E2E tests
- Performance: Implement caching with Redis
- Search: Add Algolia or Elasticsearch
- Mobile App: React Native companion app
- MongoDB Docs: https://www.mongodb.com/docs/
- Next.js Docs: https://nextjs.org/docs
- Cloudinary Docs: https://cloudinary.com/documentation
- Zod Docs: https://zod.dev/
This project is built for educational purposes.
Alpha.LMS is now fully configured with:
- β MongoDB database integration
- β JWT authentication system
- β Cloudinary file uploads
- β Zod validation schemas
- β Three comprehensive dashboards
- β AI-powered features
- β Professional UI/UX
- β Production-ready build
Access your application at: http://localhost:3000
Default Test Users (create via registration):
- Student:
student@test.com/password123 - Instructor:
instructor@test.com/password123 - Admin:
admin@test.com/password123
Built with β€οΈ using Next.js, MongoDB, and modern web technologies