How phamminhtan1122/hcmuaf-schedule-exporter works
Main Components
a. Frontend (User Interface):
• Located in the "public" directory, which includes the index.html, script.js, and styles.css.
• Responsible for rendering the different screens based on the user flow described in the README (login screen, schedule/exam choice, semester selection, ICS file download, and Google Calendar integration guide).
b. Backend (API Server):
• Located in the "api" directory. The file server.js is the main entry point, and the "routes" directory contains specific endpoints:
• auth.js: handles user authentication.
• exam.js: processes exam schedule requests.
• schedule.js: processes timetable (TKB) requests.
• ics.js: responsible for generating or processing the ICS file.
c. Deployment/Configuration:
• File like vercel.json indicates that the app is configured for deployment on Vercel.
• package.json and .babelrc indicate the use of JavaScript tools and possible transpilation steps.
Relationships and Interactions
• The User Interface (frontend) sends HTTP requests (likely via Ajax/fetch from script.js) to the backend API endpoints.
• The authentication endpoint (/api/routes/auth) validates user credentials entered on the login screen.
• Once authenticated, users choose between "TKB" or "Lịch thi", triggering requests to either the schedule endpoint (schedule.js) or exam endpoint (exam.js).
• After processing the selected schedule type, the backend uses the ics.js module to convert the retrieved data into an ICS file.
• The generated ICS file is then provided to the frontend, which lets the user download it or trigger an “Add to Google Calendar” process.
• The overall flow is controlled by the frontend which steps the user through login, selection, fetching data, and finishing the conversion.
Architectural Patterns and Technologies
• Separation of concerns: There is a clear division between front-end (presentation layer) and backend (business logic and data processing).
• RESTful design: Each API endpoint (authentication, schedule, exam, ICS generation) is likely exposed as a RESTful route.
• Single Page Application (SPA) style: Although the project structure is simple, the public/script.js likely orchestrates the user flow without full page reloads.
• Deployment configuration indicates use of modern cloud deployment (e.g., Vercel).
Essential Details
• That every step in the process (as outlined in the README) is represented either as a component or as an interaction path.
Happy diagramming!