Classroom AI, Platform Services & Public Site
Everything that sits beside the main modules: the classroom hardware and engagement-scoring pipeline, recorded live-class sessions, the child pickup register, hall tickets and teacher diaries in technical detail, privacy and consent routes, the support, tutorial and app-update services, and the public website. Chapter 15 covers Live Broadcast and Video Meet.
Modules & Services
Classroom Devices (Edge Hardware)
- ClassroomDevice model: name, classroom, floor, building, studentCapacity (default 30), cameras[] (role student_facing or room_facing, deviceIndex, label), microphones[], studentDeviceMap[] (student → cameraIndex, micIndex), status (active, inactive, maintenance), lastHeartbeat, agentVersion, ipAddress, registeredBy
- Registering a device returns an 8-character deviceCode and a UUID deviceToken once: the token is stored only as a bcrypt hash (cost 12) and cannot be shown again
- Edge devices call the API with the Authorization token plus an X-Device-Code header, with no user JWT. POST /api/classroom-devices/:id/heartbeat updates lastHeartbeat, agentVersion and ipAddress
- Devices can also connect to the separate Socket.IO namespace /device and send device-register { deviceCode, deviceToken }. A valid pair joins the room classroom:<classroom> and the device is marked connected; a wrong code or token gets device-auth-error. This namespace does not use the per-event rate limiter of the normal user sockets
- Admin and facilities_admin register, edit, activate, deactivate and delete devices; teachers can read device status
- Device management and signal ingest are exempt from the subscription check so admin operations and ingest keep working
- Web: /dashboard/admin/classroom-ai · Mobile: (admin)/devices.tsx
AI Signals & Engagement Scoring
- AISessionSignal (one per student per interval, default 5 s): camera { gazeDirection, eyeOpenness, expression, deskActivity, handRaised, confidence }, audio { isSpeaking }, isAttentive. A TTL index deletes signals after 90 days
- POST /api/ai-signals accepts one signal; POST /api/ai-signals/batch is the preferred path (max 200 per batch, sent about every 30 seconds, ordered:false so one bad record does not fail the batch; partial failures return 207)
- Batch ingest auto-marks attendance for the unique students seen in the batch without blocking the response
- services/engagementScoringService turns a session's signals into one StudentEngagementScore per (session, student): attention = isAttentive 60 + eye openness (open 20, half-open 10) + gaze (center 20, board 18 ...); engagement = expression (happy 60, neutral 45 ...) + desk activity (writing 20, phone 0 ...) + confidence × 20
- Participation is built from speaking, hand-raise and positive-expression rates. overallScore = attention × 0.5 + engagement × 0.3 + participation × 0.2
- performanceTier: excellent ≥ 75, good ≥ 55, average ≥ 35, otherwise at_risk. isAtRisk is also set when overall is below ENGAGEMENT_AT_RISK_THRESHOLD (default 35) or attention is below ATTENTION_AT_RISK_THRESHOLD (default 25)
- Also stored: a per-minute attention timeline, confusion spikes (two or more consecutive low-attention minutes) and participation events
- Scores endpoints are subscription-gated; student scores follow the student/parent/school-staff access guard
- Admin can purge a session's signals with DELETE /api/ai-signals/session/:sessionId
Hardware Consent (Camera & Microphone)
- HardwareConsent per student: consentType (camera, microphone, both), status (pending, granted, denied, revoked), consentedAt, revokedAt, revocationReason, consentMethod (online_form, paper, app), a hashed consent token
- The parent answers through a tokenised link (GET/POST /api/hardware-consent/:id/respond; web page /consent/respond)
- Admin lists pending consents, reads a student's consent and revokes it
- services/hardwareConsentCron runs daily at 9am and revokes granted consents that have passed expiresAt
Live Class Sessions, Recording & Summaries
- Session model: course, lessonPlan, week/day number, teacher, section, date, start/end time, status (scheduled, in_progress, completed, cancelled), attendance[] (present, absent, late, excused), materials[], recording, audioRecording and summary
- Teacher, admin and super_admin create, start and end sessions and mark session attendance
- Recording runs through Firefly.AI: a bot joins the meeting URL when FIREFLY_API_KEY is configured. Without it the session is recorded locally with a warning and no bot joins
- Recording status: not_started, recording, processing, completed, failed. The transcript is fetched into transcriptText and the Firefly webhook (POST /api/sessions/firefly/webhook, public, HMAC-verified, declared in app.js) completes it. GET /api/sessions/firefly/callback handles the OAuth return
- Summary: homework, additional notes and a Firefly notes link, generated manually or with AI (aiLimiter applies), edited by the teacher, then published to students
- Audio-only recording can be started, uploaded and deleted per session
- Web: students open published summaries from Session Summaries · Mobile: (teacher)/sessions.tsx, (student)/sessions.tsx, (admin)/live-sessions.tsx
Child Register (Pickup Log)
- ChildRegisterEntry records who collected a child: student, personName, relation (father, mother, guardian, relative, driver, family_friend, other), phone, reason (default Early pickup), notes, pickupAt, recordedBy and a required photo of the person
- POST /api/child-register is a multipart upload: the photo goes to object storage under child-register/ and the student must belong to the active school
- GET /api/child-register lists entries with search, date range, student, class and section filters, newest first, paginated (max 100)
- Admin only. Web: /dashboard/admin/child-register · Mobile: (admin)/child-register.tsx
Hall Tickets (Technical Detail)
- HallTicket per student and exam: hallTicketNumber, rollNo, examCenter, class, section, academicYear, examTitle, term, papers[] (subjectName, paperCode, examDate, startTime, endTime, room, maxMarks), instructions[], verificationCode, issuedBy, isPublished
- POST /api/hall-tickets/generate builds tickets for a whole class or section in bulk (a handful of database calls using bulkWrite). GET /generate-status reports progress
- Each PDF carries a QR code and verification code. PDFs are cached (services/pdfCache) and pre-built after generation and publish (services/pdfPrebuild)
- PDF downloads are rate-limited; builds past the server's limit wait in a short queue and answer 503 with Retry-After when it is full
- Admin publishes or unpublishes a ticket and can delete one or many. Teachers can list tickets
- Web: /dashboard/admin/hall-tickets · Mobile: (admin)/hall-tickets.tsx
Teacher Diaries
- TeacherDiary: one entry per teacher per date (unique on school, teacher, date) with classes, content (what was taught) and homework
- Teacher saves with POST /api/teacher-diaries/save, reads today's log with /my-log and earlier ones with /my-saved-logs
- Admin reads every teacher's entries from /admin-feed and leaves a note with PUT /:id/admin-note (stores adminNote, adminNoteBy, adminNoteAt)
- Web: /dashboard/teacher/diary, /dashboard/admin/teacher-diaries · Mobile: (teacher)/diary.tsx, (admin)/teacher-diaries.tsx
Privacy, Data Rights & Parental Consent
- Any signed-in user can export their data (GET /api/gdpr/export-data), correct it (PUT /update-data), restrict processing and request account deletion (DELETE /delete-account)
- Deletion requests are listed, approved or cancelled by an admin (or the parent for a child) and handled with data-retention scheduling (services/dataRetentionService)
- Parental consent for minors: admin sends consent requests to one student or in bulk; parents answer in-app (/parent/respond/:studentId) or from an emailed token link (GET /api/parental-consent/consent-form/:token, POST /submit-consent/:token)
- Admin views per-student and bulk consent status, a compliance status summary and retention status. Setting retention for a user and manual cleanup (super_admin only) are available
- Mobile: My Data Rights (every role), (admin)/gdpr-compliance.tsx, (admin)/deletion-requests.tsx, (super-admin)/deletion-requests.tsx
Admin Overview Dashboard
- GET /api/admin-overview (admin) returns one payload for the home dashboard: counts (students, teachers, staff, parents, courses, quizzes), counts by role, attendance per day (present, late, absent, leave) for students and teachers, and fee totals (total due, paid, outstanding)
- Everything is scoped to the caller's school taken from the session, never from the request
- Students are shown as present or absent only: late and half day count as present, every kind of leave counts as absent
Video Guides & Tutorials
- TutorialVideo: category, featureGroup, title, language, description, youtubeId (validated as 11 characters), youtubeUrl, duration, order, isActive. Videos are hosted on YouTube
- GET /api/tutorials returns active videos to any signed-in user with optional category and search filters, and seeds defaults the first time it is called
- platform_admin curates them: list all, create, update, delete, rename a category or feature group, seed defaults, and clear demo or all videos
- Web: /dashboard/tutorials (viewer), /dashboard/admin/tutorials/manage (curation) · Mobile: Video Guides & Tutorials in every role's menu (components/TutorialsScreen)
Support Requests & Report an Issue
- POST /api/support is public and rate-limited (contactFormLimiter). It validates name, email and message, escapes all input and emails the NexusOne team
- Recipients come from SUPPORT_EMAILS (comma-separated). If unset, the default team addresses are used, not the sender address
- Mobile apps carry a Report an Issue entry (opens a Google Form) and a floating report button (components/ReportIssueFloatingButton)
Push Tokens & App Update Check
- POST /api/mobile/token registers a device push token (MobileDeviceToken: user, token (unique), platform android or ios, deviceId, experienceId, isActive, lastUsedAt). Registering on the same deviceId deactivates that user's older tokens. DELETE /api/mobile/token removes it
- GET /api/app-version is public and cached for 5 minutes. It returns android and ios { latestVersionCode, latestVersion, storeUrl } and an optional message
- Configure with MOBILE_ANDROID_LATEST_VERSION_CODE, MOBILE_ANDROID_LATEST_VERSION, MOBILE_ANDROID_STORE_URL, MOBILE_IOS_LATEST_BUILD, MOBILE_IOS_LATEST_VERSION, MOBILE_IOS_STORE_URL and MOBILE_UPDATE_MESSAGE. The Android store URL defaults to https://play.google.com/store/apps/details?id=com.nexusone.lms
- When no Android version is configured, the server reads the live version from the Play Store listing (cached 3 hours) and the app compares version names. An explicit version code takes priority
- The app checks on launch and when it returns to the foreground after 6 hours. An older install sees a skippable Update popup; closing it silences that release for 24 hours. Update opens market://details?id=com.nexusone.lms and falls back to the https link
Public Website & Blog
- Navbar (components/common/SiteNavbar, shared by every public page): Product ▾ (Feature Tour, Mobile App), Docs, Pricing, Login, Contact Us and a Book Demo button. The logo is the way home. The Blog link was removed
- Book Demo opens the booking page set once in src/lib/demo.js (DEMO_URL). The contact page has a ?demo=1 variant with the same button and emails that open with a demo subject
- /feature-tour lists every module (31, in Core and More groups, data in src/data/featureTour.js) with a page per module at /feature-tour/<slug>, an FAQ (src/data/faqs.js, also published as FAQPage structured data) and a demo card
- /mobile-app shows the Google Play button and a QR code (public/play-store-qr.jpg) with what each role can do. /pricing shows Lite, Standard and Elite with monthly and yearly prices
- Other public pages: /docs, /documentation, /contact, /courses, /demo-videos, /admission-inquiry/[schoolId] (a school's own enquiry form), /register-school, /register-platform-admin, /subscription/* (upgrade, success, cancel, trial-success), /verify/[code] (credential verification), /documents/shared/[token] (shared document package), /portfolio/share/[token] (shared Growth Passport) and /legal/* (privacy policy, terms, cookies, compliance)
- Blog: BlogPost content served by /api/blog (public list, tags and /:slug); platform_admin sees all posts and publishes, unpublishes or deletes them. The pages at /blog and the sitemap entries remain even though the navbar no longer links to it
- app/sitemap.js lists the home, pricing, documentation, blog, feature tour, mobile app and every feature-tour page
API Reference — Chapter 26
Classroom Devices
/api/classroom-devicesList devices (admin, teacher, facilities_admin)
/api/classroom-devicesRegister a device; returns deviceCode and deviceToken once (admin, facilities_admin)
/api/classroom-devices/:idGet one device
/api/classroom-devices/:idUpdate a device
/api/classroom-devices/:idDelete a device
/api/classroom-devices/:id/statusHeartbeat age and status
/api/classroom-devices/:id/activateActivate a device
/api/classroom-devices/:id/deactivateDeactivate a device
/api/classroom-devices/:id/heartbeatDevice heartbeat; device-token auth, no user login
AI Signals & Engagement Scores
/api/ai-signalsIngest a single signal from an edge device
/api/ai-signals/batchIngest up to 200 signals; auto-marks attendance for the students in the batch
/api/ai-signals/session/:sessionIdSignals for a session (admin, teacher)
/api/ai-signals/student/:studentId/session/:sessionIdOne student's signals for a session
/api/ai-signals/session/:sessionIdPurge a session's signals (admin)
/api/engagement-scores/school-overviewSchool-wide engagement summary (admin, super_admin)
/api/engagement-scores/at-riskStudents flagged at risk (admin, teacher, super_admin)
/api/engagement-scores/session/:sessionIdAll scores for a session
/api/engagement-scores/session/:sessionId/student/:studentIdOne student's score for a session
/api/engagement-scores/live/:sessionIdLive scores while a session is running
/api/engagement-scores/compute/:sessionIdCompute or refresh scores for a session
/api/engagement-scores/student/:studentIdA student's scores over time (student, parent, staff)
Hardware Consent
/api/hardware-consent/pendingPending consents (admin)
/api/hardware-consent/student/:studentIdA student's consent record
/api/hardware-consent/:id/respondOpen the tokenised consent link
/api/hardware-consent/:id/respondParent grants or denies consent
/api/hardware-consent/:id/revokeRevoke a consent (admin)
Live Class Sessions
/api/sessionsCreate a session (teacher, admin, super_admin)
/api/sessionsList sessions
/api/sessions/activeThe session running now
/api/sessions/:idGet a session
/api/sessions/:idUpdate a session
/api/sessions/:idDelete a session
/api/sessions/:id/startStart the session
/api/sessions/:id/endEnd the session
/api/sessions/:id/attendanceMark session attendance
/api/sessions/:id/recording/startStart a Firefly.AI recording (or record locally if not configured)
/api/sessions/:id/recording/stopStop the recording
/api/sessions/:id/recording/fetch-transcriptFetch the transcript
/api/sessions/:id/recording/completeMark the recording complete
/api/sessions/:id/summary/generateGenerate a summary
/api/sessions/:id/summary/ai-generateGenerate a summary with AI (rate-limited)
/api/sessions/:id/summary/publishPublish the summary to students
/api/sessions/:id/audio-recording/startStart an audio-only recording
/api/sessions/firefly/callbackFirefly.AI OAuth return
/api/sessions/firefly/webhookFirefly.AI webhook; public, HMAC-verified, declared in app.js
Child Register
/api/child-registerList pickup entries with search, date, student, class and section filters (admin)
/api/child-registerRecord a pickup with the collector's photo (multipart, admin)
Hall Tickets
/api/hall-tickets/generateGenerate tickets for a class or section (admin, super_admin)
/api/hall-tickets/generate-statusGeneration progress
/api/hall-ticketsList tickets (admin, super_admin, teacher)
/api/hall-tickets/class-subjects/:classIdSubjects of a class for the paper schedule
/api/hall-tickets/:idOne ticket
/api/hall-tickets/:id/publishPublish or unpublish a ticket
/api/hall-tickets/:id/pdfDownload the ticket as a PDF with QR code (rate-limited, cached)
/api/hall-tickets/:idDelete a ticket
/api/hall-tickets/batchDelete many tickets
Teacher Diaries
/api/teacher-diaries/my-logThe teacher's log for today
/api/teacher-diaries/my-saved-logsThe teacher's earlier entries
/api/teacher-diaries/saveSave a day's entry (one per teacher per date)
/api/teacher-diaries/admin-feedAdmin: every teacher's entries
/api/teacher-diaries/:id/admin-noteAdmin leaves a note on an entry
Privacy & Consent
/api/gdpr/export-dataExport the signed-in user's data
/api/gdpr/update-dataCorrect personal data
/api/gdpr/restrict-processingRestrict processing of one's data
/api/gdpr/delete-accountRequest deletion of one's own account
/api/gdpr/deletion-requestsList deletion requests (admin, parent)
/api/gdpr/deletion-requests/:userId/approveApprove a deletion request
/api/gdpr/deletion-requests/:userId/cancelCancel a deletion request
/api/gdpr/parent/consent-statusParent: consent status for their children
/api/gdpr/parent/respond/:studentIdParent answers a consent request
/api/gdpr/parental-consent/bulk-sendSend consent requests to many students (admin)
/api/gdpr/parental-consent/:studentIdSend a consent request for one student
/api/gdpr/bulk-consent-statusConsent status across students (admin)
/api/gdpr/compliance-statusCompliance summary (admin)
/api/gdpr/retention-statusRetention schedule status (admin)
/api/gdpr/set-retention/:userIdSet retention for a user (admin)
/api/gdpr/manual-cleanup/:userIdManual cleanup (super_admin only)
/api/parental-consent/consent-form/:tokenPublic: open a parent's emailed consent form
/api/parental-consent/submit-consent/:tokenPublic: submit the consent form
AI Insights (Elite)
/api/ai-insight/studentAI insight report for a student (student, parent, admin)
/api/ai-insight/parentAI summary for a parent (parent, admin)
/api/ai-insight/teacherAI insight for a teacher (teacher, admin)
/api/ai-insight/adminAI insight for school management (admin)
/api/ai-insight/roadmapLearning roadmap (student)
/api/ai-insight/lessonAI-generated lesson (student)
/api/ai-insight/essay-graderEssay auto-grading (student)
Learning Outcomes & Programming Lab
/api/learning-outcomesList learning outcomes
/api/learning-outcomesCreate (admin, super_admin, teacher)
/api/learning-outcomes/:idUpdate (admin, super_admin, teacher)
/api/learning-outcomes/:idDelete (admin, super_admin)
/api/judge0/languagesLanguages available in the programming lab
/api/judge0/statusCode-execution service status (admin)
Admin Overview, Tutorials, Support & Mobile
/api/admin-overviewHome dashboard payload for the admin
/api/tutorialsActive tutorial videos (filter by category or search)
/api/tutorials/allEvery tutorial including inactive (platform_admin)
/api/tutorialsAdd a tutorial (platform_admin)
/api/tutorials/:idUpdate a tutorial (platform_admin)
/api/tutorials/:idDelete a tutorial (platform_admin)
/api/tutorials/categories/renameRename a category (platform_admin)
/api/tutorials/features/renameRename a feature group (platform_admin)
/api/supportPublic: send a support request email (rate-limited)
/api/mobile/tokenRegister this device's push token
/api/mobile/tokenRemove this device's push token
/api/app-versionPublic: latest app version and store link for the update popup
Blog
/api/blogPublic list of published posts
/api/blog/tagsPublic list of tags
/api/blog/:slugPublic: one post
/api/blog/admin/allAll posts including drafts (platform_admin)
/api/blog/:id/publishPublish a post (platform_admin)
/api/blog/:id/unpublishUnpublish a post (platform_admin)
/api/blog/:idDelete a post (platform_admin)
Frontend Pages
| Path | Role | Description | Tier |
|---|---|---|---|
| /dashboard/admin/classroom-ai | Admin | Classroom devices, consent and engagement scores | Basic |
| /dashboard/admin/child-register | Admin | Record and search child pickups with photo | Basic |
| /dashboard/admin/hall-tickets | Admin | Generate, publish and download hall tickets | Basic |
| /dashboard/admin/teacher-diaries | Admin | Read teacher diaries and leave notes | Basic |
| /dashboard/teacher/diary | Teacher | Write the daily diary | Basic |
| /dashboard/tutorials | Signed-in users | Video guides and tutorials | Basic |
| /dashboard/admin/tutorials/manage | Platform admin | Curate tutorial videos | Basic |
| /consent/respond | Parent (link) | Answer a camera and microphone consent request | Basic |
| /feature-tour | Public | Module overview, FAQ and demo card | Basic |
| /feature-tour/[slug] | Public | One page per module | Basic |
| /mobile-app | Public | Google Play button, QR code and role overview | Basic |
| /pricing | Public | Lite, Standard and Elite plans | Basic |
| /contact | Public | Contact emails; ?demo=1 shows the demo booking button | Basic |
| /verify/[code] | Public | Credential verification | Basic |
| /documents/shared/[token] | Public (link) | Shared document package | Basic |
| /portfolio/share/[token] | Public (link) | Shared Growth Passport | Basic |
| /admission-inquiry/[schoolId] | Public | A school's admission enquiry form | Basic |
Mobile Screens
(admin)/devices.tsx(admin)/live-sessions.tsx(teacher|student)/sessions.tsx(admin)/child-register.tsx(admin)/hall-tickets.tsx(admin)/teacher-diaries.tsx(teacher)/diary.tsx(admin)/gdpr-compliance.tsx(admin|super-admin)/deletion-requests.tsx(role)/data-rights.tsx(role)/tutorials.tsx(role)/report-issue.tsxcomponents/AppUpdatePrompt.tsx