Masud Physics
Full-Stack Hybrid EdTech LMS with AI-Assisted STEM Assessments, Redis Anti-Piracy & Automated Tuition Billing
A production-grade, Bengali-first Hybrid EdTech LMS & PWA unifying online video courses, offline physical coaching batches, KaTeX/MathLive STEM exams, dual payment gateways (bKash & ShurjoPay), and automated recurring monthly tuition billing.
Project Scope
| Role | Full-Stack Software Engineer (Architecture, Backend, Frontend & DevOps) |
|---|---|
| Status | Production-Deployed SaaS / Hybrid LMS |
| Target Users | Online, Offline & Hybrid Physics Students, Teachers & Coaching Administrators |
| Platforms | Next.js Web App, PWA, Teacher Grading Workspace & Admin Portal |
The Problem & Opportunity
Fragmented Hybrid Coaching Operations
Managing online courses, offline physical batches, and hybrid students across separate spreadsheets and tools caused enrollment mismatches and revenue leakage.
Account Sharing & Content Piracy
Students frequently shared credentials across multiple devices, reducing paid course conversions.
Complex STEM Assessments & Manual Billing
Physics exams required LaTeX formula authoring, auto-graded MCQs, handwritten CQ PDF grading, and offline mark merging—alongside recurring monthly tuition tracking.
Challenge, Solution & Architecture
The Challenge
Unifying online/offline/hybrid coaching workflows, tamper-resistant STEM exams with LaTeX equations, strict single-device anti-piracy, and recurring monthly billing on a cost-effective self-hosted VPS.
The Solution
Built a decoupled Next.js 16 + Express 5 + PostgreSQL (Prisma, 27+ models) platform with Redis single-device session eviction, Gemini AI bulk question parsing, KaTeX/MathLive rendering, bKash & ShurjoPay billing sync, and zero-downtime GitHub Actions PM2 deployments.
System Architecture Flow
Next.js 16 (React 19, PWA, HLS.js, KaTeX/MathLive) <-> Express 5 + TypeScript (18 API Modules) <-> PostgreSQL (Prisma 7, 27+ Models) + Redis + AWS S3 (Sharp WebP) + Gemini AI.
Frontend Architecture
- Next.js 16 App Router, React 19, TypeScript, Tailwind CSS v4, Shadcn/Radix UI & PWA support
- MathLive interactive equation authoring + KaTeX rendering for Physics exams and printable PDFs
- Adaptive HLS.js video playback with persistent per-student WatchProgress tracking
- Dedicated teacher PDF grading workspace, printable exam papers, and batch transcript generator
Backend & Database Architecture
- Node.js & Express 5 TypeScript REST API across 18 modules with Zod validation and node-cron
- PostgreSQL with Prisma ORM 7 (27+ relational models) and Redis (ioredis) session/device control
- Google Gemini AI bulk question parser, AWS S3 SDK + Sharp on-the-fly WebP compression
- bKash & ShurjoPay dual payment gateways + GitHub Actions SSH CI/CD with PM2 zero-downtime reload
Key Engineering & Design Highlights
1. End-to-End Hybrid STEM Exam Engine & AI Question Parser
- •Built a centralized Question Bank supporting MCQ, CQ, and Short questions with MathLive formula input and KaTeX rendering.
- •Integrated Google Gemini AI bulk parsing so teachers can paste raw text and generate structured Question Bank entries automatically.
- •Enforced server-side startTime/endTime in PostgreSQL with idempotent auto-save and auto-submit to prevent timer manipulation, plus instant MCQ grading and teacher PDF script evaluation.
2. Redis Single-Device Anti-Piracy & Media Pipeline
- •Engineered DeviceLimitService backed by Redis Sets to enforce a strict 1-device-per-student policy, evicting prior sessions on new login without PostgreSQL overhead.
- •Secured auth with httpOnly/Secure/SameSite JWT cookies and built an automated Sharp WebP compression pipeline to S3 storage.
3. Dual Payment Gateways & Automated Monthly Tuition Sync
- •Integrated bKash and ShurjoPay with callback verification, transaction auditing, and a Failed Transactions recovery dashboard.
- •Built a transactional monthly billing sync engine that backfills 1st-of-month invoices for offline/hybrid batches, ignores abandoned attempts, and auto-suspends overdue accounts until paid.
4. Zero-Downtime Self-Hosted VPS CI/CD
- •Solved VPS out-of-memory Next.js builds via tuned GitHub Actions SSH pipelines (NODE_OPTIONS memory cap, safe Prisma schema sync, and zero-downtime pm2 reload).
Key Results & Impact
| Metric | Before | After | Improvement |
|---|---|---|---|
| Backend & Data Scale | Fragmented spreadsheets | 27+ Models • 18 APIs | Unified Hybrid Platform |
| Account Sharing Prevention | Unlimited logins | 1 Active Device | Redis-Enforced Anti-Piracy |
| Billing & Exam Grading | Manual tracking & checks | Automated Sync & MCQ | Major Admin Time Saved |
| Deployment Reliability | Manual VPS OOM crashes | GitHub Actions + PM2 | Zero-Downtime Releases |
Engineering Differentiators
True Hybrid SaaS Architecture
Unifies Online, Offline, and Hybrid coaching batches, recurring monthly billing, and offline+online exam marks in one system.
AI + STEM Engineering Depth
Combines Gemini AI bulk question parsing with MathLive/KaTeX Physics typography and tamper-resistant exam timers.
Production DevOps Mastery
Runs full-stack Next.js 16 + Express 5 + PostgreSQL + Redis reliably on self-hosted Linux VPS with automated CI/CD.