Vidya Setu (ΰ€΅ΰ€Ώΰ€¦ΰ₯ΰ€―ΰ€Ύ ΰ€Έΰ€Ήΰ€Ύΰ€―ΰ€ / ਡਿਦਿਠਸਹਾΰ¨ΰ¨) is a comprehensive digital learning platform specifically designed for rural students in Punjab (e.g., Nabha). Developed as a solution for SIH2025 (Problem Statement ID: SIH25019), it is built with a mobile-first, offline-first approach. The platform ensures that high-quality educational content, digital literacy modules, real-time collaboration, and assessments are accessible even on low-end devices with intermittent or limited internet connectivity.
- Offline-First Workflow: Uses IndexedDB to store lessons, quizzes, and progress locally. User actions are queued while offline and automatically synchronized when connectivity returns.
- Real-Time Collaboration: Socket.IO powered live presence, real-time chat, live quizzes, and synchronized teacher-student dashboards equipped with data-driven instructional analytics.
- Automated Video Pipeline: Teachers can upload heavy raw videos which are automatically queued, compressed using FFmpeg (shrinking media by up to 80% to 480p, optimized for 2G/3G mobile networks), and uploaded to Cloudinary.
- Dual Authentication System: Secure login using standard email/password (JWT) paired with an OTP verification system using Nodemailer and optional Firebase Auth.
- Cross-Platform Delivery: Functions as a Progressive Web App (PWA) in browsers and can be compiled into a native Android APK using Capacitor.
- Interactive Assessments: Real-time live quizzes and offline assignments with automated grading and progress tracking.
Student_login.mp4
Student_lessons_play.mp4
Teacher_login_upload.mp4
- Framework: React 18.3.1 bootstrapped with Vite 7.x
- Styling: Tailwind CSS 3.x (Mobile-first responsive design)
- Offline Storage: IndexedDB (via
idb8.x) for offline caching of media, progress, and sync queues - PWA Capabilities:
vite-plugin-pwawith Workbox for advanced Service Worker strategies (Network First, Cache First, Stale While Revalidate) - Real-Time Communication:
socket.io-client4.x - Media Playback:
react-playerfor lazy-loaded video lessons - Data Visualization:
rechartsfor teacher analytics and student progress charts - Mobile Wrapper: Capacitor 8.x (
@capacitor/android,@capacitor/network) for native Android APK generation
- Runtime Environment: Node.js (v20+ / v23.x tested)
- Web Framework: Express 4.x
- Real-Time Server: Socket.IO 4.x
- Database: MongoDB Atlas with Mongoose 8.x ODM
- Authentication: JWT (
jsonwebtoken),bcryptjs, and Firebase Admin SDK (firebase-admin) - Email/OTP Delivery: Nodemailer 8.x
- File Uploads: Multer 2.x (for initial raw file handling)
- Video Processing:
fluent-ffmpegpaired withbetter-queuefor asynchronous, non-blocking media compression - Cloud Storage: Cloudinary 2.x API for hosting compressed videos and PDFs
Vidya Setu operates on a rigorously modeled 3-tier offline sync architecture:
- Tier 1 (Edge/Device): IndexedDB acts as the local source of truth. It stores downloaded lessons, user profiles, and queues actions (like quiz submissions or progress updates) when offline.
- Tier 2 (Background Sync): A Service Worker intercepts requests. When connectivity drops, requests are saved to a Sync Queue. A robust network check (pinging the backend + Capacitor Network plugin) detects reconnection to trigger a
flushQueue()operation. - Tier 3 (Cloud): MongoDB Atlas serves as the authoritative remote store. The backend is rigidly structured into distinct modular entities (
School,User,Lesson,Progress,Quiz,Message) to maintain data integrity and resolve conflicts gracefully (e.g., keeping the highest progress percentage).
To accommodate low-bandwidth areas, teacher-uploaded videos undergo an automated pipeline:
- File uploaded via
POST /api/upload(Multer saves raw file locally). better-queueadds the job to a processing queue.fluent-ffmpegscales the video to 480p (libx264, CRF 28, AAC 64k) and appliesfaststartfor web streaming.- The compressed file is pushed to Cloudinary.
- Local temp files are deleted, and a real-time Socket event (
video:compressed) notifies the teacher's dashboard.
A single Node.js Express server is augmented with a Socket.IO instance to handle rooms (classes). Features include:
- Presence:
join_classevents track active users and update online counts. - Chat: Real-time chat with typing indicators and teacher controls (mute all, delete, pin).
- Live Quizzes: Teachers push
quiz:startevents, and students respond withquiz:answer.
The Service Worker utilizes multiple Workbox strategies:
- Network First: For API routes (
/api/lessons,/api/users) to ensure fresh data, with cache fallback. - Cache First: For heavy media (MP4, PDF) using
RangeRequestsPlugin. - Stale While Revalidate: For static assets, fonts, and icons.
- Node.js: v20 or higher
- npm: v9 or higher
- MongoDB: Access to a MongoDB instance (e.g., Atlas)
- FFmpeg: Must be installed on the host machine for video processing.
- macOS:
brew install ffmpeg - Linux:
sudo apt-get install ffmpeg - Windows: Download from the official FFmpeg site.
- macOS:
git clone <repository-url>
cd digital-learning-platformcd backend
npm install
# Create environment variables file
cp .env.example .env # Or manually create .env
# Start the development server (runs on port 5001)
npm run dev# Open a new terminal
cd frontend
npm install
# Start the Vite development server (runs on port 5173)
npm run devNODE_ENV=development
PORT=5001
MONGO_URI=mongodb+srv://<user>:<password>@cluster.mongodb.net/VidyaSetu
JWT_SECRET=your_super_secret_jwt_key
# Cloudinary (Media Storage)
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
# Email (Nodemailer - Gmail App Password recommended)
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password
# Firebase Admin SDK (Optional - for enhanced auth)
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_CLIENT_EMAIL=your-service-account-email
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n..."No mandatory environment variables are required out of the box as it uses a dynamic configuration config.js that points to http://localhost:5001 during local dev, but you can override:
VITE_API_URL=http://localhost:5001/api
VITE_SOCKET_URL=http://localhost:5001Vidya Setu utilizes Capacitor to wrap the PWA into a native Android application.
- Android Studio (Arctic Fox or higher)
- Android SDK (API level 21+)
cd frontend
# Build the production React bundle
npm run build
# Sync web assets with Capacitor Android project
npx cap sync android
# Open project in Android Studio to build APK
npx cap open androidIn Android Studio: Wait for Gradle sync, then go to Build β Build Bundle(s) / APK(s) β Build APK(s).
digital-learning-platform/
βββ backend/
β βββ config/ # DB & Firebase configuration
β βββ controllers/ # Request handlers (User, Lesson, Quiz, Chat)
β βββ middleware/ # JWT Auth & Role-based access control
β βββ models/ # Mongoose schemas (User, Lesson, Progress, OTP, etc.)
β βββ routes/ # Express API routes
β βββ services/ # better-queue & ffmpeg video compressor service
β βββ server.js # Express & Socket.IO entry point
β βββ public/uploads/ # Temp storage for raw/compressed files
β
βββ frontend/
β βββ android/ # Capacitor Android native project
β βββ src/
β β βββ components/ # UI Components (AdminPanel, StudentPortal, TeacherDashboard)
β β βββ context/ # React Context (SyncContext for network state)
β β βββ offline/ # IndexedDB logic (syncQueue.js, videoCache.js)
β β βββ App.jsx # Root Router & Auth check
β β βββ config.js # Dynamic API URL resolution
β β βββ socket.js # Socket.IO client singleton
β β βββ sw.js # Custom Workbox Service Worker logic
β βββ capacitor.config.json # Capacitor configuration
β βββ vite.config.js # Vite & PWA configuration
β
βββ PROJECT_DOCUMENTATION.md # Detailed system design docs
- Dashboard: Access assigned lessons based on their standard/grade.
- Offline Learning: Download video lessons and PDFs for offline viewing.
- Assessments: Take quizzes; results are queued offline and synced when online.
- Gamification: Earn badges and points for completing lessons and quizzes.
- Content Creation: Upload videos/PDFs to create rich lessons.
- Live Classes: Start live sessions, manage real-time chat, and broadcast announcements.
- Live Quizzes: Push quizzes to connected students in real-time.
- Analytics: View student progress and quiz performance charts.
- Manage school registrations, users (teachers/students), and platform-wide configurations.
- MongoDB Connection Fails: Ensure your current IP is whitelisted in MongoDB Atlas Network Access settings. The server employs auto-retry logic every 10 seconds if it fails initially.
- Video Upload Stalls: Ensure
ffmpegis globally installed and accessible in your system's PATH. Check the backend console for[videoCompressor]logs. - Emails/OTPs Not Sending: If using Gmail for Nodemailer, ensure you have generated an App Password (standard account passwords will not work).
- Android Build Network Issues: The
capacitor.config.jsonallows cleartext traffic for local testing. If pointing to a production server, ensure you are usinghttps://.
Built with β€οΈ for rural education in India
π Vidya Setu - Bridging the digital divide in education