How zikenn26/examdashboard works
Project Type and Purpose
• This is a full-stack web application (“My Exam Dashboard”) that provides:
– User authentication and profiles
– Exam and category CRUD
– Real-time countdown timers and bookmarks
– News integration with AI summarization
– An AI chatbot and study-plan generator
• It uses a React + Vite + Tailwind front end, and an Express + Node back end with external AI and news APIs.
File Structure
• Top-level:
– package.json, index.html, src/ → Front-end code
– server/ → Back-end code (routes, middleware, services)
– config files: .env, tsconfig.json, ESLint, Tailwind, Vite
• server/ substructure:
– server/server.js → Express app entry point
– server/routes/ → Controllers for auth, exams, categories, news, AI
– server/middleware/auth.js → JWT validation
– server/services/ → API-wrapper modules (openai.js, gemini.js, newsApi.js)
– server/data.js → Mock or persistence layer
• src/ substructure:
– src/pages/ → Route-level pages (Dashboard, News, AdminPanel, etc.)
– src/components/ → Presentational components by feature
– src/context/, src/hooks/ → State management and API hooks
– src/utils/ → Shared utilities
README for Additional Insights
• JWT-based login/signup
• REST endpoints under /api/**
• External dependencies:
– OpenAI (GPT-3.5) → /api/ai/chat, exam-summary, recommendations
– Gemini AI → /api/ai/exam-insights, study-plan
– NewsAPI → /api/news, /api/ai/news-analysis
• Fallback to mock data if env vars missing
Main Components
a. Front-End (Browser)
– UI Layer (pages, components)
– State & Context (AuthContext, ThemeContext)
– API Client (useApi hook)
b. Back-End (Node/Express)
– HTTP Server (Express)
– Middleware (Auth/JWT, CORS, body-parser)
– Controllers (route handlers for auth, exams, categories, news, AI)
– Service Layer (wrappers for external AI & News APIs)
– Data Layer (mock data or database abstraction in data.js)
c. External Services
– OpenAI API
– Google Gemini API
– NewsAPI
d. Persistence Layer
– (Optional) Database (e.g., MongoDB/PostgreSQL) or mock data store
Relationships & Data Flows
• Front-End ↔ Back-End over HTTPS/REST
– Auth requests: login, register → backend → JWT issued
– Exam, category, news data fetch/update
– AI API requests forwarded by back end
• Back-End → External Services (OpenAI, Gemini, NewsAPI)
– Service modules handle HTTP calls, return JSON
• Back-End → Data Layer
– CRUD operations on exams, users, categories
• Real-time countdowns, bookmarks, and notifications are purely front-end features driven by fetched data
Architectural Patterns & Design Principles
• Layered Architecture (Presentation, API/Controller, Service, Data)
• Separation of Concerns:
– React components vs. context/hooks vs. pure UI
– Express routes vs. middleware vs. services
• MVC-style backend, though data layer is simple
• Client-Server RESTful design
• Use of external APIs as integration points (adapter pattern in services/)