How vm-phung1134/thesis-course-registration-system works
Project type and purpose
• This is a full-stack, multi-page web application built on Next.js (React) with a Node.js/Express API and Firebase for authentication.
• It serves as a “Thesis Course Registration (TCR) System” for students, lecturers, and admins to register research topics, submit progress reports, schedule defenses (using genetic algorithms), assign instructors, and evaluate theses.
Core architecture & layers
a. Presentation Layer (Next.js Frontend)
• Next.js runtime (server-side rendering + client CSR).
• Pages folder (URL→Page components).
• Component library (Atomic Design):
− Atoms → Molecules → Organisms → Templates.
• Global styles (Tailwind config, globals.css).
b. State Management Layer
• React Contexts (AuthContext, currentUserContext, languageContext, subscribeState, socketContext, searchContext).
• Redux store (store.ts) with reducers handling REST API slices (auth, classroom, comment, etc.).
• React Query (if used) for caching server state.
c. Service / API Layer
• HTTP clients & hooks (useMutationAPI, usePagination, useTableSearch, useToastify, custom hooks).
• Utils (classroomService.ts, calculatorPoint.ts, date converters).
• Firebase SDK (firebase-config.ts) for Auth.
d. Data & External Services Layer
• Express.js API Server (external repo) exposing REST endpoints under e.g. /api/auth, /api/classroom, etc.
• Database (e.g., PostgreSQL or MongoDB) behind Express.
• Firebase Auth service.
• (Optional) WebSocket server if real-time features are used.
• Genetic-Algorithm scheduling microservice (batch/back-end job).
Component interactions & data flow
• User (browser) → Next.js page → UI Components
• UI Components dispatch actions either via React Context or Redux → Middleware/hooks → API client (Axios/fetch)
• API client → Express.js REST API → Database → returns JSON
• Results → Redux store / React Query cache → re-render UI
• Auth flow: UI calls Firebase Auth SDK → Firebase → token → stored in Context/Redux → included in API headers
• WebSocket (if any): socketContext connects to socket server for live updates
• Background Scheduler: Express triggers genetic-algorithm job or calls microservice to compute schedules
Architectural patterns & principles
• Atomic Design for UI decomposition.
• Layered architecture: Presentation → Application (hooks/services) → Domain (contexts/redux) → Infrastructure (API, Auth, DB).
• Single source of truth via Redux and Context.
• Separation of concerns: each directory (components, hooks, utils, contexts, redux) fulfills a distinct role.
Detailed components
• Presentation: pages/, components/{Atoms, Molecules, Organisms, Templates}
• State: contexts/, redux/store.ts + reducers/*
• Hooks/services: hooks/, utils/, data/
• External: Firebase (Auth), REST API Server (Node.js/Express), Database, Scheduler service