How xheenkhalil/zyntra_ works
Purpose and deployable entry points
Zyntra Exams is a full-stack platform for organization-managed exams, guest quizzes, automated grading, candidate workflows, and AI-assisted proctoring. The browser application starts at frontend/src/main.tsx and composes routing/UI in frontend/src/App.tsx. The API process starts at backend/src/index.ts; TypeScript source is compiled into the committed runtime output under backend/dist/index.js.
Frontend application shell and access control
React/Vite provides distinct student, course-admin, central-admin, and super-admin experiences. Role-specific layouts frame pages, while authentication state and protected navigation are centralized in:
• frontend/src/context/AuthProvider.tsx
• frontend/src/components/ProtectedRoute.tsx
• frontend/src/layouts/StudentLayout.tsx
• frontend/src/layouts/CentralAdminLayout.tsx
• frontend/src/layouts/SuperAdminLayout.tsx
Frontend services form the API boundary for authentication, exam lifecycle, administration, analytics, guest quizzes, and proctoring.
Exam authoring, delivery, and grading
Course/admin workflows build question banks and exams; students run assigned exams and receive submission/results views. Core UI stages are represented by:
• frontend/src/pages/ExamBankPage.tsx
• frontend/src/pages/ExamBuilderPage.tsx
• frontend/src/pages/ExamRunnerPage.tsx
• frontend/src/pages/ResultsPage.tsx
Requests flow through frontend/src/services/examService.ts to the backend exam and question domains:
• backend/src/routes/examRoutes.ts
• backend/src/controllers/examController.ts
• backend/src/controllers/questionController.ts
The backend owns persistence-backed exam status, submissions, automatic evaluation, and grade-scale behavior.
Identity and multi-role administration
JWT authentication, Argon2 password handling, and role/permission enforcement gate all protected API domains. The boundary is implemented through:
• backend/src/routes/authRoutes.ts
• backend/src/controllers/authController.ts
• backend/src/middleware/authMiddleware.ts
Administrative domains are separated by central/course/super-admin route-controller pairs, allowing organization, user, course, dashboard, system, and guest-quiz operations without exposing them directly to candidate flows:
• backend/src/routes/centralAdminRoutes.ts
• backend/src/routes/courseAdminRoutes.ts
• backend/src/routes/superAdminRoutes.ts
Proctoring and AI analysis pipeline
Candidate proctoring includes face-enrollment, webcam-monitoring, and behavioral/browser-violation capture. The frontend captures and presents these flows via:
• frontend/src/components/ProctoringEnrollment.tsx
• frontend/src/pages/EnrollmentTestPage.tsx
• frontend/src/pages/ProctoringDashboard.tsx
It calls proctoring endpoints handled by backend/src/routes/proctoringRoutes.ts and backend/src/controllers/proctoringController.ts. AI-related API work is isolated in backend/src/controllers/aiController.ts and backend/src/services/zyntraAiService.ts, integrating Google Generative AI/Gemini for integrity analysis.
API composition, persistence, and asynchronous work
Express routes dispatch to controllers; middleware provides authentication and centralized error handling:
• backend/src/index.ts
• backend/src/middleware/errorMiddleware.ts
• backend/src/utils/AppError.ts
PostgreSQL is the authoritative database behind backend/src/services/db.ts. Redis supports caching and BullMQ-backed email/background work through:
• backend/src/services/cacheService.ts
• backend/src/queues/emailQueue.ts
• backend/src/services/emailService.ts
Analytics endpoints/controllers aggregate operational and assessment data for dashboard consumers, including frontend/src/pages/SuperAdminAnalytics.tsx and backend/src/controllers/analyticsController.ts.
Runtime and delivery boundaries
The frontend is a React 19 Vite/PWA application, configured for Vercel deployment in frontend/vercel.json. The backend is Node.js/Express TypeScript, requiring PostgreSQL, Redis, JWT secrets, and a Gemini API key. CI is split by application boundary in .github/workflows/frontend.yml and .github/workflows/backend.yml.
Main entry points: index.ts Express API process · App.tsx App routing shell · db.ts PostgreSQL · frontend.yml Split application CI
Components 22
React/Vite Frontend
- Browser entry
frontend/src/main.tsx - App routing shell
frontend/src/App.tsx - Auth and protected navigation · Role-specific layouts and protected routes gate the application.
frontend/src/context/AuthProvider.tsx - Exam authoring and delivery · Question banks, exam building, candidate runs, and results.
frontend/src/pages/ExamRunnerPage.tsx - Proctoring UI · Enrollment, webcam monitoring, and dashboard workflows.
frontend/src/components/ProctoringEnrollment.tsx - Super-admin analytics
frontend/src/pages/SuperAdminAnalytics.tsx - Exam API client
frontend/src/services/examService.ts
Node/Express Backend
- Express API process · Composes routes, middleware, and error handling.
backend/src/index.ts - Identity and authorization · JWT, Argon2, and role/permission enforcement.
backend/src/routes/authRoutes.ts - Auth middleware
backend/src/middleware/authMiddleware.ts - Exam and question routes
backend/src/routes/examRoutes.ts - Exam lifecycle and grading · Owns status, submissions, automatic evaluation, and grade scales.
backend/src/controllers/examController.ts - Administration domains · Separate central, course, and super-admin operations.
backend/src/routes/centralAdminRoutes.ts - Proctoring API
backend/src/routes/proctoringRoutes.ts - AI integrity analysis · Gemini-backed integrity analysis.
backend/src/services/zyntraAiService.ts - Analytics aggregation
backend/src/controllers/analyticsController.ts
Data & Async Services
- PostgreSQL · Persistence for application and assessment state.
backend/src/services/db.ts - Redis cache and queue backend
backend/src/services/cacheService.ts - Email background work
backend/src/queues/emailQueue.ts
Delivery
- Compiled backend runtime
backend/dist/index.js - Vercel frontend deployment
frontend/vercel.json - Split application CI · Independent frontend and backend workflows.
.github/workflows/frontend.yml
Connections 28
- Browser entry → App routing shell: mounts
- App routing shell → Auth and protected navigation: uses
- App routing shell → Exam authoring and delivery: routes to
- App routing shell → Proctoring UI: routes to
- App routing shell → Super-admin analytics: routes to
- Auth and protected navigation → Identity and authorization: authenticates via API
- Exam authoring and delivery → Exam API client: uses
- Exam API client → Express API process: API requests
- Proctoring UI → Express API process: proctoring requests
- Super-admin analytics → Express API process: dashboard requests
- Express API process → Auth middleware: protects routes with
- Auth middleware → Identity and authorization: authorizes
- Express API process → Exam and question routes: dispatches
- Express API process → Administration domains: dispatches
- Express API process → Proctoring API: dispatches
- Express API process → Analytics aggregation: dispatches
- Exam and question routes → Exam lifecycle and grading: invokes
- Exam lifecycle and grading → PostgreSQL: persists exams and grades
- Administration domains → PostgreSQL: manages organization data
- Proctoring API → AI integrity analysis: submits integrity signals
- AI integrity analysis → PostgreSQL: stores analysis
- Analytics aggregation → PostgreSQL: aggregates
- Express API process → Redis cache and queue backend: uses cache
- Redis cache and queue backend → Email background work: backs
- Compiled backend runtime → Express API process: compiled from
- Vercel frontend deployment → Browser entry: deploys
- Split application CI → Vercel frontend deployment: builds frontend
- Split application CI → Compiled backend runtime: builds backend