
Built for students, by students. Zero video leaves your device โ ever.
demo@mindguard.ai ๐ Demo Password demo1234level = floor(sqrt(xp / 100)) + 1) with visual progress bar Confetti Celebration Canvas-confetti burst on session completion ๐ Streak Multipliers 1.5ร at 3 days ยท 2ร at 7 days ยท 3ร at 30 days{ focused: true/false }, never pixels or images Webcam optional App works without camera (manual tracking mode) No biometrics Face landmarks are used locally for gaze math, never stored or transmittedcreateStore() + useSyncExternalStore Zero-dependency pub/sub state management Backend Node.js 18+, Express 4 REST API server Security Helmet, express-rate-limit HTTP hardening, brute-force protection Database MongoDB + Mongoose 8 Document database with schema validation Auth JWT (jsonwebtoken) + bcryptjs Stateless authentication, password hashing Extension Chrome MV3 (Service Worker) Distraction blocking during sessions Scheduling node-cron Streak resets, zombie session cleanup Effects canvas-confetti Session completion celebrations.env files in both backend/ and frontend/ directories:backend/.env frontend/.env chrome://extensions in Chromeextension/ folderhttp://localhost:5000/apiRate limited: 20 requests per 15-minute window on all auth routes.
POST /api/auth/registername string โ
2โ100 characters, trimmed email string โ
Must contain @, lowercased, unique password string โ
6โ128 characters Example Request & Response201):POST /api/auth/loginemail string โ
password string โ
Example Request & Response200):Token expires in 30 days. Payload:{ userId }.
GET /api/auth/profile ๐All session endpoints require authentication ๐
POST /api/sessions/startplannedDuration number No 3600 60โ28800 seconds notes string No โ Max 1000 characters Example Response POST /api/sessions/focus/:idfocused boolean โ
true = focused, false = distractedPOST /api/sessions/phone/:iddetected boolean โ
true = phone visible, false = phone gonePOST /api/sessions/end/:idfloor(durationMinutes) ร 10 ร streakMultiplierPOST /api/sessions/pause/:idPATCH /api/sessions/notes/:idnotes string โ
Max 1000 charactersGET /api/sessions/active ๐null.GET /api/sessions/history ๐limit number 50 Max results per page offset number 0 Skip N recordsGET /api/sessions/:id ๐All todo endpoints require authentication ๐
GET /api/todos List all todos (sorted by creation date, newest first) POST /api/todos Create a new todo PATCH /api/todos/:id/toggle Toggle completion status PATCH /api/todos/:id Update todo text/priority DELETE /api/todos/:id Delete a todoPOST /api/todos โ Create Todotext string โ
โ 1โ500 characters, trimmed sessionId ObjectId No โ Links todo to a specific session priority string No "medium" "low" | "medium" | "high"All blocked site endpoints require authentication ๐
GET /api/blocked-sites List all blocked domains POST /api/blocked-sites Add a domain to blocklist DELETE /api/blocked-sites/:id Remove a domain from blocklistPOST /api/blocked-sites โ Add Domainurl string โ
3โ255 chars. Auto-sanitized: strips http(s)://, www., path segments. Lowercased. Duplicate check per user. Examplereddit.comAll cognitive endpoints require authentication ๐
GET /api/cognitive/cognitive-profileAlias:GET /api/analytics/cognitive-profile
GET /api/cognitive/session/:idReturns422if session is too short (< 60s) or has fewer than 2 focus events.
GET /api/leaderboard ๐period string "all" "all" | "week" | "month" limit number 20 Max 50 Example Response "all" โ by XP descending; "week" / "month" โ by total minutes descending.GET /api/healthname String โ Display name (2โ100 chars) email String โ Unique, lowercased, trimmed password String โ bcrypt hashed xp Number 0 Total experience points level Number 1 Current level currentStreak Number 0 Consecutive study days longestStreak Number 0 All-time best streak lastStudyDate Date โ Last session end date createdAt Date now Account creationuserId ObjectId โ User โ Session owner startTime Date now Session start endTime Date โ Session end duration Number 0 Actual duration (seconds) focusScore Number 100 Focus percentage (0โ100) xpEarned Number 0 XP awarded notes String โ User notes (max 1000 chars) plannedDuration Number 3600 Target duration (seconds) focusEvents Array [] [{ focused: bool, timestamp: Date }] phoneEvents Array [] [{ detected: bool, timestamp: Date }] todos ObjectId[] โ Todo [] Linked tasks isActive Boolean true Session in progress?userId, { userId, isActive }userId ObjectId โ User โ Task owner sessionId ObjectId โ Session โ Linked session (optional) text String โ Task description (1โ500 chars) completed Boolean false Completion status priority String "medium" "low" / "medium" / "high" createdAt Date now Creation timestampuserId ObjectId โ User โ Site owner domain String โ Blocked domain (3โ255 chars) createdAt Date now When blocked{ userId, domain } (unique compound)VisionSystem.jsx โ 897 lines) is the most complex component, running two parallel detection loops entirely in-browser.import().getUserMedia captures webcam at native resolutioncalculateGazeDirection):yolov8n.onnx, ~6 MB), loaded as a module-level singleton โ survives component re-mounts.<canvas> at 640ร640[1, 3, 640, 640] โ output [1, 84, 8400]onPhoneDetected callback firescognitiveEngine.js + cognitiveHelpers.js) performs pure server-side computation on boolean focus/phone event data to generate rich analytics.WarmUpPattern Early focus โช Late focus (โฅ 20% gap) FatiguePattern Late focus โช Early focus (โฅ 20% gap) FragmentedAttention Distraction frequency > 3/min StableFocus Volatility < 10 AND focus โฅ 70% SlowRecovery Average recovery > 30 seconds Normal Fallback when no other pattern matchesfocusEvents) โ aggregate statsblocked.html Session Awareness Polls /api/sessions/active every 15 seconds Blocklist Sync Fetches /api/blocked-sites every 5 minutes Domain Matching Strips www., checks exact match + subdomain Active-Only Blocking Sites are only blocked during active study sessionschrome.webNavigation.onBeforeNavigate (main frame only) Tab URL update chrome.tabs.onUpdated (on "complete" status) Tab switch chrome.tabs.onActivated Session start Scans ALL open tabs immediatelytoggleExtension Popup โ Background Enable/disable blocking setToken Popup โ Background Set/clear auth token syncSites Popup โ Background Manual sync trigger getStatus Popup โ Background Get full status snapshot sessionUpdate Popup โ Background Notify of session start/stop checkSession Popup โ Background Force session status checklocalStorage under key mindguard_achievements:isActive: true and startTime > 6 hours ago. Auto-ends them with calculated duration, marks isActive: false, appends "[Auto-closed]" to notes. Streak Reset Daily at midnight UTC Iterates all users. If lastStudyDate is neither yesterday nor today, resets currentStreak to 0.localhost:3000/3001 (dev), FRONTEND_URL (prod), chrome-extension://* Rate Limiting 20 requests / 15 min on /api/auth/* routes JWT 30-day expiry, HS256 signing, userId payload only Password Hashing bcryptjs with auto-generated salt Input Validation Length limits, type checks, email format validation on all routes No Pixel Data Backend never receives, processes, or stores any image/video databackend/.env)MONGODB_URI โ
โ MongoDB connection string JWT_SECRET โ
โ Secret for signing JWT tokens PORT No 5000 Server port NODE_ENV No development development | production FRONTEND_URL Production only โ Frontend URL for CORS in productionfrontend/.env)REACT_APP_API_URL No http://localhost:5000/api Backend API base URLgit checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)cd backend && npm run dev (uses nodemon)cd frontend && npm start (Create React App)Posted Aug 6, 2026
Developed an AI-powered study focus tracker running entirely in the browser.
0
0