How 349gill/course-mate works
Project Type and Overall Purpose
• Project Type: This is a full-stack web application built with Next.js. It uses both client-side rendering (React components) and server-side API routes.
Analyzing the File Structure
• Top-Level Files and Configurations: Files such as next.config.mjs, tailwind.config.js, postcss.config.mjs, package.json, and jsconfig.json indicate a Next.js project with customized configurations for linting, styling (Tailwind CSS), and module resolution.
• Public Directory: Contains static assets like JSON files under public/programs (general.json, honors.json, spec.json) which represent degree program configurations in terms of requirements.
• Lib Directory: Contains business logic helper functions (fetchCourses.js and fetchRequirements.js) which likely encapsulate API calls or data processing related to courses.
• Src Directory: Holds all the application code:
• Components (DegreeForm.js, RemainingCourses.js, RenderGraph.js) that build the UI for input, output, and graphical representation using GoJS.
• Pages: Custom Next.js pages including _app.js, _document.js for global setup and the index page for the homepage. Importantly, the api folder (with [course].js) defines the backend endpoint for fetching prerequisites and corequisites.
• Styles and Utils: Global styling in CSS and utility functions.
a. Main Components:
• Frontend Interface:
• UI Components: DegreeForm, RemainingCourses, RenderGraph.
• Pages: The primary pages of the application (index, _app, _document).
• Styling: Managed with Tailwind CSS and global styles.
• Backend API:
• API Routes: The [course].js endpoint that handles queries to get prerequisites and corequisites.
• Handler Functions: Likely using utilities from the lib folder (fetchCourses.js and fetchRequirements.js).
• Static Assets:
• Program Requirements: JSON files under public/programs that define different degree tracks.
• External Libraries/Integrations:
• GoJS: For rendering dynamic graphs that illustrate course prerequisites and progress.
• Next.js Framework: For both client and server-side rendering.
b. Relationships and Interactions:
• A user interacts with the frontend via the DegreeForm component to input completed courses.
• Frontend then makes a request to the backend API (located in src/pages/api/[course].js) to retrieve course dependency information.
• The API uses functions from the lib folder (fetchCourses.js, fetchRequirements.js) to process the request.
• The backend responds with the prerequisites and corequisites data, which is then used by the RemainingCourses component to compute remaining degree requirements.
• Static JSON files serve as a baseline reference for program-specific requirements.
c. Architectural Patterns/Design Principles:
• Separation of Concerns: The clear division between frontend (user interface and visualization) and backend (API for course dependency lookups) promotes scalability and maintainability.
• Modularization: Utility functions in lib and utils further decouple logic, making the application easier to test and extend.
• API-First Communication: The client fetches data through a RESTful API endpoint, emphasizing a service-oriented approach.
d. Relevant Technologies and Frameworks:
• Next.js for application structure and server-side rendering.
• React for building dynamic UI components.
• Tailwind CSS for styling.
• Node.js environment with its npm package management (package.json, package-lock.json) for backend operations.