How lakshaysk106/refrain-addiction works
Project type & purpose (from tree + naming)
This is a full-stack JavaScript web application with:
• React (Create React App) SPA frontend in src/ (+ public/ assets)
• Node.js/Express backend implied by app.js and routes/
• MongoDB persistence implied by mongo.js / mongo1.js
• A browser extension (Chrome-style) in routes/Extention/ with a manifest.json
• Features suggested by page/component names: Auth (Login/Register), Admin dashboard, Consultant flows, Chat, Video/Meet calls, Assessments/Tracking, “Blockweb” (likely tied to the extension), etc.
• Deployment hints: vercel.json (Vercel) and public/_redirects (SPA routing on static hosts)
React SPA (CRA)
• Code: src/App.jsx, src/pages/*, src/components/*
• Built assets served as static files (from build/ when deployed)
Static hosting/CDN (Vercel or other)
• Hint: vercel.json, public/_redirects
Node/Express API server
• Entry: app.js
• Routes: routes/routes.js, routes/Extention/main.js
MongoDB database
• Connection logic: mongo.js, mongo1.js
Browser Extension
• Manifest: routes/Extention/manifest.json
• Logic: routes/Extention/main.js
• Browser → Static Host: GET index.html/js/css
• SPA → API Server: HTTPS REST/JSON (Auth, profile, bookings, assessment, tracking, etc.)
• API Server → MongoDB: CRUD
• Extension → API Server: likely HTTPS (policies, block lists, user identity, reporting)
• Extension → Browser: “blocks/redirects sites” (local behavior; annotate as client-side enforcement)
Important: If Chat/Meet/Video are real-time, add:
• SPA ↔ API Server: “WebSocket/Socket.IO (signaling/chat)” if present/used
• SPA ↔ SPA: “WebRTC media path (peer-to-peer)” if video calling is WebRTC
• SPA ↔ STUN/TURN provider: if used (external infra)
Goal: show how each container is structured.
Frontend components (from src/)
• src/index.jsx → mounts app
• src/App.jsx → routing/layout root
• Pages (src/pages/*): route-level screens (AdminLogin, AdminDashboard, Chat, Meet, Assessment, Track, Blockweb, etc.)
• Reusable UI components (src/components/*): Navbar/Sidebar, cards, video call components, etc.
• Utils (src/utils/*): shared helpers
• Styling: Tailwind/PostCSS (tailwind.config.js, postcss.config.cjs) + CSS/SCSS in components/pages
Backend components (from root + routes/)
• app.js (Express app)
• mounts routers
• routes/routes.js (main API routes)
• routes/Extention/main.js (extension-facing API endpoints or extension script host)
• mongo.js / mongo1.js (DB connection + maybe models/helpers)
What relationships/interactions to capture (be extremely explicit)
• HTTPS (JSON REST) for standard API calls
• WebSocket for real-time chat/signaling (if used)
• WebRTC SRTP for media (if used)
• MongoDB wire protocol (or “MongoDB driver”)
Also label trust boundaries:
• Public Internet boundary
• Backend private network boundary (API ↔ DB)
• Client device boundary (browser + extension)
Client Side
• End User Browser
• React SPA (src/)
• Admin/Consultant Browser
• React SPA (same build, different routes/roles)
• Browser Extension
• Extension (routes/Extention/manifest.json)
Delivery
• Static Hosting/CDN (Vercel)
• serves SPA bundle + public/*
Server Side
• Node.js Express API Server
• app.js
• routes/routes.js (main)
• routes/Extention/main.js (extension endpoints)
Data
• MongoDB
• connection via mongo.js / mongo1.js
Optional / verify
• Realtime gateway (Socket.IO) for Chat/Signaling (if present)
• WebRTC STUN/TURN (if video calling is WebRTC)
• Notifications (email/SMS/push) if used
Open app.js and list
• mounted routes
• middleware (auth, CORS)
• server type (Express only? serverless?)
2. Open routes/routes.js and enumerate endpoints by feature bucket (auth, users, bookings, assessments, tracking, etc.)
Open mongo.js / mongo1.js to confirm
• DB name/collections usage pattern
• whether Mongoose or native driver
Check package.json for
• server start scripts (single process vs separate client/server)
• dependencies like express, mongoose, socket.io, webrtc, etc.