Skip to content

nhandang02/elearning-classroom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

81 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ“ E-Learning Classroom - Flutter Frontend

A comprehensive e-learning platform built with Flutter for web, featuring real-time messaging, course management, assignments, quizzes, and analytics.

🎯 Features

  • πŸ” Secure Authentication - JWT-based auth with token refresh
  • 🌐 Real-time Updates - WebSocket integration for live updates
  • 🎨 Dark/Light Mode - Theme switching support
  • πŸ”” Notifications - Real-time notifications for important events
  • πŸ“ File Management - Upload and manage course materials
  • πŸ€– AI Chatbot - AI-powered assistance for students and instructors

For Students

  • πŸ“š Course Enrollment - Browse and enroll in courses
  • πŸ“ Assignments - Submit assignments with file uploads
  • 🎯 Quizzes - Take quizzes with instant feedback
  • πŸ’¬ Real-time Chat - Message instructors in real-time
  • πŸ“Š Progress Tracking - View grades and performance
  • πŸ“± Responsive Design - Works on desktop and mobile browsers

For Instructors

  • πŸ‘¨β€πŸ« Course Management - Create and manage courses
  • πŸ“‹ Assignment Creation - Create assignments with deadlines
  • πŸŽ“ Quiz Builder - Build quizzes with multiple question types
  • πŸ“Š Analytics Dashboard - Track student performance
  • πŸ’¬ Student Communication - Chat with students
  • πŸ“ˆ Grade Management - Grade submissions and provide feedback

Core Features (36/36)

Authentication & User Management

  • βœ… User registration (student/instructor)
  • βœ… Login with JWT authentication
  • βœ… Profile management with avatar upload
  • βœ… Role-based access control (RBAC)

Course Management

  • βœ… Create, edit, delete courses
  • βœ… Course enrollment system
  • βœ… Upload/download course materials
  • βœ… Course announcements
  • βœ… Course groups

Assignment System

  • βœ… Create assignments with deadlines
  • βœ… Submit assignments with file upload
  • βœ… Grading system
  • βœ… View submission history
  • βœ… Late submission tracking

Quiz System

  • βœ… Create quizzes with multiple question types
  • βœ… Multiple choice, true/false, short answer
  • βœ… Take quizzes with timer
  • βœ… Auto-grading
  • βœ… Quiz statistics and analytics
  • βœ… Question bank management

Real-time Features

  • βœ… WebSocket-based chat system
  • βœ… Real-time notifications
  • βœ… Online/offline status
  • βœ… Typing indicators
  • βœ… Message read receipts

Analytics & Reports

  • βœ… Student performance dashboard
  • βœ… Course enrollment statistics
  • βœ… Quiz performance charts
  • βœ… Grade distribution analysis
  • βœ… Activity tracking

File Management

  • βœ… Upload files (PDF, images, documents)
  • βœ… Download files
  • βœ… File preview
  • βœ… File size validation

UI/UX

  • βœ… Responsive design (mobile, tablet, desktop)
  • βœ… Dark/Light theme toggle
  • βœ… Smooth animations
  • βœ… Loading states
  • βœ… Error handling

Bonus Features (6+)

  1. AI Question Generator

    • Generate quiz questions from text content
    • Support for multiple question types
    • CSV export functionality
  2. Real-time Chat with WebSocket

    • Instant messaging
    • Online status indicators
    • Typing indicators
    • Message history
  3. Advanced Analytics

    • Interactive charts (FL Chart)
    • Student activity tracking
    • Quiz difficulty analysis
    • Performance trends
  4. Progressive Web App (PWA)

    • Installable on desktop and mobile
    • Offline capability
    • App-like experience
  5. Dark Mode

    • System-wide theme switching
    • Persistent theme preference
    • Smooth transitions
  6. Fully Responsive Design

    • Optimized for all screen sizes
    • Adaptive layouts
    • Touch-friendly interface

πŸ› οΈ Tech Stack

Frontend

  • Framework: Flutter 3.35.1
  • Language: Dart 3.9.0
  • State Management: Provider pattern
  • Routing: go_router
  • HTTP Client: http package
  • WebSocket: socket_io_client
  • Charts: fl_chart
  • Storage: flutter_secure_storage

Backend

  • Framework: NestJS
  • Database: PostgreSQL
  • Authentication: JWT
  • Real-time: Socket.IO
  • File Storage: Local filesystem

Deployment

  • Frontend: Firebase Hosting
  • Backend: elearningspace.online
  • CI/CD: GitHub Actions

πŸš€ Getting Started

Prerequisites

Before you begin, ensure you have the following installed:

Installation

  1. Clone the repository

    git clone https://github.com/thanhnhanzxc/elearning_classroom_firebase.git
    cd elearning_classroom_firebase
  2. Install dependencies

    flutter pub get
  3. Configure API endpoint

    Open lib/core/constants/api_client.dart and update the backend URL:

    static const String baseUrl = "https://your-backend-url.com";
  4. Run the application

    For web (Chrome):

    flutter run -d chrome

    For web with custom port:

    flutter run -d chrome --web-port 63742

πŸ—οΈ Project Structure

lib/
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ config/          # App configuration
β”‚   β”œβ”€β”€ constants/       # Constants and API client
β”‚   β”œβ”€β”€ routes/          # Navigation and routing
β”‚   β”œβ”€β”€ services/        # Core services (WebSocket, etc.)
β”‚   β”œβ”€β”€ storage/         # Local storage (tokens, etc.)
β”‚   β”œβ”€β”€ utils/           # Utility functions
β”‚   └── widgets/         # Reusable widgets
β”œβ”€β”€ features/
β”‚   β”œβ”€β”€ auth/            # Authentication (login, signup)
β”‚   β”œβ”€β”€ assignments/     # Assignment management
β”‚   β”œβ”€β”€ chat/            # Real-time messaging
β”‚   β”œβ”€β”€ courses/         # Course management
β”‚   β”œβ”€β”€ dashboard/       # Dashboard screens
β”‚   β”œβ”€β”€ layout/          # App layouts
β”‚   β”œβ”€β”€ materials/       # Course materials
β”‚   β”œβ”€β”€ messages/        # Message models and services
β”‚   β”œβ”€β”€ notifications/   # Notification system
β”‚   β”œβ”€β”€ profile/         # User profile
β”‚   β”œβ”€β”€ quizzes/         # Quiz system
β”‚   β”œβ”€β”€ semesters/       # Semester management
β”‚   β”œβ”€β”€ submissions/     # Assignment submissions
β”‚   └── users/           # User management
└── main.dart            # App entry point

πŸ”§ Configuration

Environment Setup

  1. Backend API Configuration

    Update lib/core/constants/api_client.dart:

    // Development
    static const String baseUrl = "http://localhost:3000";
    
    // Production
    static const String baseUrl = "https://elearningspace.online";
  2. File Storage Configuration

    Update the file storage URL in api_client.dart:

    static const String fileStorageBaseUrl = "https://your-cdn-url.com";

Firebase Configuration (for deployment)

  1. Install Firebase CLI

    npm install -g firebase-tools
  2. Login to Firebase

    firebase login
  3. Initialize Firebase

    firebase init hosting
    • Select your Firebase project
    • Set public directory to: build/web
    • Configure as single-page app: Yes
    • Don't overwrite index.html: No
  4. Deploy to Firebase

    flutter build web --release
    firebase deploy --only hosting

Bonus Point (AI for Elearning System using OpenAI API key)

πŸ”₯ Deploy Firebase Cloud Functions

If the project has been cleaned before submission (the node_modules folder inside functions/ has been removed), the instructor must reinstall dependencies and redeploy Cloud Functions:

cd functions
npm install
firebase deploy --only functions

These Cloud Functions provide AI-powered features such as interactive AI chat and automatic quiz question generation.

When you use automatic quiz question generation(OOP Question Creation Content). This is content for AI : " Object-Oriented Programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The four main principles of OOP are: Encapsulation, Inheritance, Polymorphism, and Abstraction. "

πŸ› οΈ Development

Running in Development Mode

# Run on Chrome
flutter run -d chrome

# Run with hot reload
flutter run -d chrome --hot

# Run on specific port
flutter run -d chrome --web-port 8080

Building for Production

# Build web release
flutter build web --release

# Build with optimizations
flutter build web --release --web-renderer html

# Build with canvas renderer (better performance)
flutter build web --release --web-renderer canvaskit

Code Quality

# Analyze code
flutter analyze

# Format code
flutter format .

# Run tests
flutter test

πŸ“¦ Dependencies

Main Dependencies

  • flutter_secure_storage - Secure token storage
  • go_router - Navigation and routing
  • http - HTTP client for API calls
  • socket_io_client - WebSocket real-time communication
  • file_picker - File upload functionality
  • fl_chart - Charts and analytics
  • intl - Internationalization and date formatting

Dev Dependencies

  • flutter_lints - Linting rules
  • flutter_test - Testing framework

See pubspec.yaml for complete list of dependencies.

πŸ” Authentication

The app uses JWT-based authentication with automatic token refresh:

  1. Login - User enters credentials
  2. Token Storage - Access and refresh tokens stored securely
  3. Auto Refresh - Tokens automatically refreshed before expiration
  4. Logout - Tokens cleared and user redirected to login

Token Management

  • Access tokens stored in flutter_secure_storage
  • Automatic refresh 5 minutes before expiration
  • WebSocket reconnection on token refresh

🌐 API Integration

REST API

All API calls go through ApiClient class:

// GET request
final response = await ApiClient.get('/courses');

// POST request
final response = await ApiClient.post('/assignments', body: data);

// File upload
final response = await ApiClient.postMultipart(
  '/files/upload',
  fields: {'type': 'material'},
  platformFiles: files,
);

WebSocket

Real-time features use Socket.IO:

// Connect
await WebSocketService().connect();

// Send message
await WebSocketService().sendMessage(
  receiverId: userId,
  content: message,
);

// Listen for messages
WebSocketService().messageStream.listen((message) {
  // Handle incoming message
});

🎨 Theming

The app supports light and dark themes:

// Toggle theme
MyApp.of(context)?.toggleTheme();

// Current theme
final isDark = Theme.of(context).brightness == Brightness.dark;

πŸ“± Responsive Design

The app adapts to different screen sizes:

  • Desktop (>900px) - Sidebar navigation
  • Tablet (600-900px) - Drawer navigation
  • Mobile (<600px) - Bottom navigation

🚒 Deployment

Firebase Hosting

  1. Build the app

    flutter build web --release
  2. Deploy to Firebase

    firebase deploy --only hosting
  3. Access your app

    https://your-project-id.web.app
    

Custom Domain

  1. Add custom domain in Firebase Console
  2. Update DNS records
  3. Wait for SSL certificate provisioning

πŸ› Troubleshooting

Common Issues

Issue: "Failed to load network image"

  • Check CORS configuration on backend
  • Verify file storage URL is correct

Issue: "WebSocket connection failed"

  • Ensure backend WebSocket server is running
  • Check if JWT token is valid
  • Verify CORS settings allow WebSocket connections

Issue: "Token expired"

  • Token refresh should happen automatically
  • If not, logout and login again

Issue: "Build fails on web"

  • Clear build cache: flutter clean
  • Get dependencies: flutter pub get
  • Rebuild: flutter build web --release

πŸ‘₯ Contributors

  • Nguyen Thanh Nhan - 522H0051 - Initial work and development
  • Dang Thanh Nhan - 522H0006 - Initial work and development

πŸ”— Links


Built with ❀️ using Flutter

Last Updated: December 5, 2025
Version: 1.0.0
Status: Production Ready βœ…

About

A comprehensive Flutter-based e-learning platform for managing courses, assignments, quizzes, and student-instructor interactions with real-time communication features.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors