A modern, comprehensive Learning Management System built with Flask (backend) and React 18 + TypeScript (frontend), featuring role-based access control, assignment management, attendance tracking, and an AI-powered chatbot assistant with LangGraph.
- Modern UI/UX: Gradient-based design with smooth animations and responsive layouts
- Unified Dashboard: All users (Admin, Teacher, Student) land on a centralized dashboard after login
- Static Navigation: Fixed sidebar and navbar with scrollable content area for better UX
- AI-Powered Assistant: Built-in chatbot widget accessible from any page
- Real-time Notifications: Toast notifications and notification center
- Expandable Features: Interactive feature cards with detailed descriptions on homepage
- Modern Homepage:
- Gradient hero section with animated backgrounds
- Expandable feature cards with detailed capability lists
- Problem-solution narrative layout
- Role-based feature showcase
- Security highlights section
- Unified Dashboard: Single dashboard for all user roles with role-specific quick actions
- Static Layout: Fixed sidebar and navbar, scrollable content area only
- Responsive Design: Mobile-first approach with collapsible sidebar
- Enhanced Visuals: Gradient cards, hover animations, shadow effects
- Toast Notifications: Real-time user feedback
- Notification Center: Bell icon with dropdown for announcements and events
- Role-Based Access Control: Three distinct user roles (Admin, Teacher, Student) with different permissions
- User Management: Create, update, and manage students, teachers, and admins
- Course Management: Create and manage courses, subjects, and sections
- Assignment System: Create assignments, submit work, and grade submissions
- Attendance Tracking: Mark and track student attendance
- Results Management: Record and manage student results
- Announcements: Post announcements to specific sections
- Events: Create and manage school events
- Enrollment: Enroll students in courses
- AI Chatbot: Intelligent assistant powered by LangGraph and Groq API
- Manage all users (students, teachers, admins)
- Create and manage sections
- Create and manage courses
- Create and manage subjects
- Manage enrollments
- View all system data
- Create and manage assignments
- View and grade student submissions
- Mark attendance
- Record results
- Create announcements
- View assigned courses and subjects
- View assigned courses and subjects
- View and submit assignments
- View attendance records
- View results
- View announcements
- Access AI chatbot
- Flask: Lightweight Python web framework
- SQLAlchemy: ORM for database operations with relationship mapping
- PyMySQL: MySQL database connector
- Flask-JWT-Extended: JWT-based authentication and authorization
- Flask-Bcrypt: Secure password hashing
- Marshmallow: Data validation, serialization, and deserialization
- Flask-CORS: Cross-origin resource sharing configuration
- LangGraph: State-based AI agent orchestration framework
- LangChain: LLM integration and prompt management
- LangChain-Groq: Groq API integration for fast LLM inference
- python-dotenv: Environment variable management
- React 18: Latest React with hooks and concurrent features
- TypeScript: Full type safety and better developer experience
- Vite: Lightning-fast build tool and HMR dev server
- React Router DOM v6: Modern client-side routing
- Axios: Promise-based HTTP client with interceptors
- Tailwind CSS 3: Utility-first CSS with custom design system
- Lucide React: Modern icon library (350+ icons)
- React Hot Toast: Beautiful toast notifications
- React Markdown: Markdown rendering for chatbot responses
- Remark GFM: GitHub Flavored Markdown support
- MySQL: Relational database
LMS Agentic/
βββ backend/
β βββ app.py # Flask application entry point
β βββ requirements.txt # Python dependencies
β βββ .env.example # Environment variables template
β βββ src/
β βββ __init__.py # Flask app factory with CORS config
β βββ db.py # Database configuration
β βββ extention.py # Flask extensions (JWT, Bcrypt)
β βββ models/ # SQLAlchemy models (14 models)
β β βββ admin.py
β β βββ student.py
β β βββ teacher.py
β β βββ course.py
β β βββ assignment.py
β β βββ ... (9 more)
β βββ routes/ # API route handlers (15 blueprints)
β β βββ auth.py
β β βββ admin.py
β β βββ student.py
β β βββ chatbot.py
β β βββ ... (11 more)
β βββ schemas/ # Marshmallow schemas for validation
β βββ services/ # Business logic layer
β βββ agent/ # AI chatbot implementation
β βββ main.py # LangGraph agent workflow
β βββ tools.py # 26 AI tools for database operations
β βββ tools_list.py # Tool registry
β βββ prompts.py # System and role-specific prompts
β
βββ frontend/
βββ package.json # Node.js dependencies
βββ vite.config.ts # Vite configuration
βββ tailwind.config.js # Tailwind CSS with custom colors
βββ tsconfig.json # TypeScript configuration
βββ src/
βββ main.tsx # React entry point
βββ App.tsx # Main app with routing (20+ routes)
βββ index.css # Global styles with custom animations
βββ components/ # Reusable components
β βββ Layout.tsx # Main layout with sidebar & navbar
β βββ ProtectedRoute.tsx
β βββ ChatbotWidget.tsx
β βββ ...
βββ contexts/ # React contexts
β βββ AuthContext.tsx
βββ pages/ # Page components
β βββ Homepage.tsx # Landing page with features
β βββ Login.tsx # Authentication page
β βββ Dashboard.tsx # Unified dashboard
β βββ admin/ # Admin pages (7 pages)
β βββ teacher/ # Teacher pages (5 pages)
β βββ student/ # Student pages (4 pages)
βββ services/ # API service layer
β βββ api.ts # Axios instance with interceptors
βββ types/ # TypeScript type definitions
β βββ index.ts
βββ utils/ # Utility functions
βββ jwt.ts
βββ errorHandler.ts
Before you begin, ensure you have the following installed:
- Python 3.13
- Node.js 16+ and npm or yarn
- MySQL 5.7+ or MariaDB 10.3+
- Git
git clone https://github.com/GenAIwithMS/LMS
cd "LMS Agentic"cd backend
pip install -r requirements.txt- Create a MySQL database:
CREATE DATABASE llm_LMS;- Create a
.envfile in thebackend/directory:
# Database Configuration
DATABASE_URI=mysql+pymysql://username:password@localhost/llm_LMS
# JWT Configuration
JWT_SECRET_KEY=your-secret-key-here
# Flask Configuration
FLASK_DEBUG=True
PORT=5000
# Groq API (Optional - for chatbot)
GROQ_API_KEY=your-groq-api-key-hereNote: Replace username and password with your MySQL credentials.
The database tables will be created automatically when you first run the application.
python app.pyThe backend will run on http://localhost:5000
cd frontend
npm installnpm run devThe frontend will run on http://localhost:5173 (or another port if 5173 is busy)
The API is organized by resource. All endpoints are prefixed with /api/.
POST /api/login- User loginPOST /api/logout- User logout (if implemented)
POST /api/add/admin- Create adminGET /api/get/admin- Get admin(s)PUT /api/update/admin- Update adminDELETE /api/delete/admin- Delete admin
POST /api/add/student- Create studentGET /api/get/student- Get student(s)PUT /api/update/student- Update studentDELETE /api/delete/student- Delete student
POST /api/add/teacher- Create teacherGET /api/get/teacher- Get teacher(s)PUT /api/update/teacher- Update teacherDELETE /api/delete/teacher- Delete teacher
POST /api/add/course- Create courseGET /api/get/courses- Get course(s)PUT /api/update/course- Update courseDELETE /api/delete/course- Delete course
POST /api/create/assignments- Create assignmentGET /api/get/assignments- Get assignment(s)PUT /api/update/assignments/- Update assignmentDELETE /api/delete/assignments/- Delete assignment
POST /api/submit/assignment- Submit assignment (Student only)GET /api/get/submissions/by/student- Get student submissionsGET /api/get/submissions/by/assignment- Get assignment submissionsPUT /api/update/submission- Update submission (Teacher only)DELETE /api/delete/submission- Delete submission
- Sections, Subjects, Enrollments, Attendance, Results, Announcements, Events
- See
backend/API_DOCUMENTATION.mdfor complete API documentation
Note: Most endpoints require JWT authentication. Include the token in the Authorization header:
Authorization: Bearer <your-jwt-token>
The application uses JWT (JSON Web Tokens) for authentication:
- Login with Email and password
- Receive a JWT token
- Include the token in subsequent requests via the
Authorizationheader - Tokens are stored in
localStorageon the frontend
- Modern Design System:
- Gradient backgrounds and cards
- Custom animations (fade-in-up, shimmer, pulse)
- Glassmorphism effects
- Smooth hover transitions
- Responsive Layout: Works seamlessly on desktop, tablet, and mobile
- Fixed Navigation: Sidebar and navbar stay static while content scrolls
- Unified Dashboard: Single landing page for all user roles after login
- Interactive Homepage: Expandable feature cards with detailed information
- Toast Notifications: Instant user feedback for all actions
- Notification Center: Real-time announcements and events dropdown
- Protected Routes: Role-based route protection with automatic redirects
- Error Handling: Comprehensive error handling with user-friendly messages
- Type Safety: Full TypeScript coverage for better developer experience
- Loading States: Skeleton loaders and spinners for better UX
- Form Validation: Client-side validation before API calls
The system includes an intelligent AI-powered chatbot accessible from any page via a floating button:
- Role-Aware Context: Chatbot adapts responses based on user role
- 26 Database Tools: Complete CRUD operations via natural language
- LangGraph Workflow: State-based agent with tool calling
- Markdown Rendering: Rich formatting for chatbot responses
- Persistent Widget: Accessible from any page without navigation
- Conversation History: Maintains context within session
- User management (create, update, delete students/teachers)
- Course and subject creation
- Section and enrollment management
- Event creation and management
- System-wide data queries
- Assignment creation and management
- Submission grading and feedback
- Attendance marking and tracking
- Result recording
- Announcement posting
- Assignment submission
- Grade and attendance viewing
- Course information queries
- Announcement viewing
- Schedule information
- LangGraph: Orchestrates agent workflow with state management
- Groq API: Fast LLM inference (llama-3.3-70b-versatile model)
- Tool Binding: 26 Python functions exposed as tools
- Error Handling: Graceful fallbacks and error messages
Note: Requires GROQ_API_KEY in environment variables. Application runs without it, but chatbot will be unavailable.
-
Start the Backend (Terminal 1):
cd backend python app.pyBackend runs on
http://localhost:5000 -
Start the Frontend (Terminal 2):
cd frontend npm run devFrontend runs on
http://localhost:5173 -
Access the Application:
- Open
http://localhost:5173in your browser - Login redirects all users to
/dashboard - Navigate using the fixed sidebar
- Open
-
Create Admin User (via API or database):
# Use API endpoint or insert directly into database # Default credentials should be created in database
-
Login Flow:
- Visit homepage β Click "Get Started" or "Login"
- Enter credentials
- Automatically redirected to unified dashboard
- Access role-specific features from sidebar
The Flask app can be deployed using:
- Gunicorn
- uWSGI
- Docker
- Any WSGI-compatible server
Build the frontend for production:
cd frontend
npm run buildThe built files will be in the dist/ directory.
cd backend
flask run --debugcd frontend
npm run dev# Database Configuration
DATABASE_URI=mysql+pymysql://username:password@localhost/llm_LMS
# JWT Configuration
JWT_SECRET_KEY=your-secret-key-here-change-this-in-production
# Flask Configuration
FLASK_DEBUG=True
PORT=5000
# Groq API (Required for AI Chatbot)
GROQ_API_KEY=your-groq-api-key-hereFrontend uses Vite's default configuration. API base URL is set in src/services/api.ts:
const API_BASE_URL = 'http://localhost:5000/api';-
Database Connection Error:
- Verify MySQL is running
- Check database credentials in
.env - Ensure the database exists
-
Import Errors:
- Ensure all dependencies are installed:
pip install -r requirements.txt - Check Python version (3.13 recommended, 3.8+ minimum)
- Install
python-dotenvseparately if needed:pip install python-dotenv
- Ensure all dependencies are installed:
-
Port Already in Use:
- Change the port in
.envorapp.py - Kill the process using the port
- Change the port in
-
Cannot Connect to Backend:
- Verify backend is running on
http://localhost:5000 - Check CORS configuration in
backend/src/__init__.py - Verify API base URL in
frontend/src/services/api.ts - Ensure no proxy/firewall blocking localhost connections
- Verify backend is running on
-
Build Errors:
- Clear
node_modulesand reinstall:rm -rf node_modules package-lock.json && npm install - Check Node.js version (16+ required, 18+ recommended)
- Clear Vite cache:
rm -rf node_modules/.vite
- Clear
-
Login Issues:
- Check browser console for errors
- Verify JWT token is being stored in localStorage
- Clear localStorage and try again:
localStorage.clear() - Check Network tab for API response status
-
Styling Issues:
- Ensure Tailwind CSS is properly configured
- Check
index.cssis imported inmain.tsx - Rebuild with
npm run buildand restart dev server
- Backend API Documentation:
backend/API_DOCUMENTATION.md - Frontend API Documentation:
frontend/API_DOCUMENTATION.md - AI Agent Prompts:
backend/src/agent/prompts.py - Database Models:
backend/src/models/
- β Modern gradient-based design system
- β Unified dashboard for all user roles
- β Fixed sidebar and navbar with scrollable content
- β Expandable feature cards on homepage
- β Enhanced notification system
- β Improved responsive design
- β Custom animations and transitions
- β AI chatbot widget with 26 database tools
- β Role-based dashboard quick actions
- β Real-time notification center
- β Toast notification system
- β Markdown rendering for chatbot
- β System status indicators (removed from dashboard)
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Your Name - Initial work
- Flask community
- React community
- Tailwind CSS
- LangChain and LangGraph teams
Note: This is a development version. For production deployment, ensure proper security measures, environment variable management, and database backups.