How shrouk-saleh/ravenace works
Purpose and deployable surfaces
RavenACE / EduCert Pro is an AI-assisted examination, certification, and organization-management platform. It has three executable applications: an Express/MongoDB API in backend/server.js, a React/Vite browser client rooted at frontend/src/main.jsx, and an Electron secure-exam client rooted at electron-engine/main/main.js. Container deployment is defined by Dockerfile.
API composition and persistence
The backend organizes HTTP endpoints by business domain: routes dispatch to controllers, which operate on MongoDB models and services. Core wiring begins in backend/server.js; database connectivity is centralized in backend/config/db.js. Persistent domain boundaries include identities and organizations (backend/models/User.js, backend/models/Organization.js), authored exams/questions (backend/models/Exam.js, backend/models/Question.js), and exam execution/results (backend/models/Attempt.js, backend/models/Certificate.js).
Identity, tenancy, and access boundary
Authentication and authorization are enforced before protected API actions through backend/middleware/authMiddleware.js and organization scoping through backend/middleware/orgMiddleware.js. Auth lifecycle endpoints are in backend/routes/authRoutes.js; organization administration is separated in backend/routes/organizationRoutes.js. This establishes role- and tenant-aware access across instructor, student, administrator, and organization workflows.
Exam authoring and attempt lifecycle
Exam/question APIs provide the authoring side (backend/routes/examRoutes.js, backend/routes/questionRoutes.js), while attempts use backend/routes/attemptRoutes.js and backend/controllers/attemptController.js. A typical flow is: instructor creates an exam and questions; student starts an Attempt; answers and integrity events are saved during the session; submission produces grading/results and potentially certificates. Results, rankings, and certificate verification are separate read/reporting domains in backend/routes/resultRoutes.js, backend/routes/leaderboardRoutes.js, and backend/routes/certificateRoutes.js.
AI grading, learning, and integrity analysis
AI-facing API endpoints are isolated in backend/routes/aiRoutes.js and backend/controllers/aiController.js. Services cover Gemini-backed generation/tutoring (backend/services/geminiService.js, backend/services/questionGenService.js, backend/services/tutorService.js), code and written-answer grading (backend/services/codeGraderService.js, backend/services/writtenGraderService.js), and plagiarism/cheating analysis (backend/services/plagiarismService.js, backend/services/cheatAnalysisService.js). Their outputs persist as analysis and integrity records, including backend/models/AiAnalysis.js, backend/models/PlagiarismReport.js, and backend/models/CheatLog.js.
Browser client and realtime interaction
The standard user interface is a React SPA with routing/application composition in frontend/src/App.jsx, authenticated session state in frontend/src/context/AuthContext.jsx, and API transport in frontend/src/api/axios.js. Socket.IO client connectivity is represented by frontend/src/api/socket.js; backend socket support is centralized at backend/utils/socket.js. Browser exam interaction is primarily represented by frontend/src/pages/ExamInterface.jsx, with anti-cheat behavior in frontend/src/hooks/useAntiCheat.js.
Secure Electron examination runtime
The Electron application is a distinct controlled-exam boundary, not merely a browser wrapper. electron-engine/core/ExamEngine.js coordinates exam execution; electron-engine/services/ExamService.js, electron-engine/services/AutoSaveService.js, and electron-engine/services/SubmissionService.js communicate state and submissions to the backend through electron-engine/communication/HttpClient.js. Main/preload/renderer isolation is implemented through electron-engine/main/main.js, electron-engine/preload/preload.js, and electron-engine/ipc/IpcHandlers.js.
Proctoring and external integrations
Electron security monitors detect focus loss, display/process/network changes, debugging, VMs, recording, and input anomalies under electron-engine/core/security/SecurityManager.js and related monitor modules. Security events feed the session/anti-cheat lifecycle via electron-engine/services/SessionGuardian.js. External commercial and enterprise boundaries include Stripe billing (backend/routes/stripeRoutes.js, backend/services/stripeService.js), integration credentials (backend/routes/integrationRoutes.js, backend/models/IntegrationCredential.js), and email delivery (backend/utils/emailService.js).
Main entry points: server.js Express API · db.js MongoDB · authMiddleware.js Access & tenant boundary · aiController.js AI grading & analysis
Components 21
Browser client
- React SPA
frontend/src/main.jsx - Session & API client · Authenticated state and HTTP transport.
frontend/src/context/AuthContext.jsx - Browser exam UI · Includes anti-cheat interaction behavior.
frontend/src/pages/ExamInterface.jsx - Socket client
frontend/src/api/socket.js
Backend API
- Express API · Routes requests into domain controllers and services.
backend/server.js - Access & tenant boundary · Authentication, roles, and organization scoping.
backend/middleware/authMiddleware.js - Identity & organizations · Auth lifecycle and organization administration.
backend/routes/authRoutes.js - Exam authoring · Exam and question authoring workflows.
backend/routes/examRoutes.js - Attempt lifecycle · Starts, records, submits, and grades exam attempts.
backend/controllers/attemptController.js - Results & certificates · Results, rankings, certificate issuance and verification.
backend/routes/resultRoutes.js - AI grading & analysis · Generation, tutoring, grading, plagiarism, and cheat analysis.
backend/controllers/aiController.js - Socket server
backend/utils/socket.js - MongoDB · Stores users, organizations, exams, attempts, certificates, and analysis records.
backend/config/db.js - Billing & integrations · Stripe, enterprise credentials, and email delivery.
backend/routes/stripeRoutes.js
Secure exam client
- Electron main & IPC · Main/preload isolation and IPC handlers.
electron-engine/main/main.js - Controlled exam engine · Coordinates secure exam execution.
electron-engine/core/ExamEngine.js - Exam sync services · Loads exams, autosaves, and submits through HTTP.
electron-engine/services/ExamService.js - Security monitoring · Detects environment and input integrity anomalies.
electron-engine/core/security/SecurityManager.js - Session guardian · Feeds security events into the session lifecycle.
electron-engine/services/SessionGuardian.js
Connections 27
- React SPA → Session & API client: uses
- React SPA → Browser exam UI: renders
- React SPA → Socket client: connects
- Session & API client → Express API: HTTPS API
- Browser exam UI → Express API: attempt actions
- Socket client → Socket server: Socket.IO
- Express API → Access & tenant boundary: protects requests
- Access & tenant boundary → Identity & organizations: authorizes
- Access & tenant boundary → Exam authoring: scopes
- Access & tenant boundary → Attempt lifecycle: scopes
- Express API → Results & certificates: routes
- Express API → AI grading & analysis: routes
- Identity & organizations → MongoDB: persists
- Exam authoring → MongoDB: persists exams/questions
- Attempt lifecycle → MongoDB: persists attempts
- Attempt lifecycle → AI grading & analysis: grades and analyzes
- AI grading & analysis → MongoDB: stores analysis
- AI grading & analysis → Gemini AI: generation/tutoring
- Results & certificates → MongoDB: reads results/certificates
- Express API → Billing & integrations: routes
- Billing & integrations → Stripe: billing
- Electron main & IPC → Controlled exam engine: hosts
- Controlled exam engine → Exam sync services: exam state
- Controlled exam engine → Security monitoring: monitors session
- Security monitoring → Session guardian: security events
- Session guardian → Controlled exam engine: enforces integrity
- Exam sync services → Express API: HTTPS sync/submission