How adityasharmawork/algosprint works
Project’s Main Purpose and Type
• AlgoSprint is a full-stack web application that tracks coding contests from platforms such as Codeforces, CodeChef, and LeetCode.
• Its primary purpose is to fetch and present both upcoming and past contests, allow bookmarking of contests, and provide video solution links.
• The project uses the MERN stack (MongoDB, Express.js, React.js, Node.js) with additional features like web scraping and GraphQL for API data handling.
File Structure
• The top-level directories include ‘client’ and ‘server’, indicating a clear separation between the frontend and backend layers.
• The “client” folder contains all the React source code, including various UI components (many of which follow a design system pattern with components in a “ui” subdirectory), pages, hooks, and configuration files (like Tailwind, Vite).
• The “server” folder contains controller files for different contest platforms (organized by platform: Codechef, Codeforces, LeetCode) as well as routes and authentication middleware.
• The presence of configuration files such as package.json (at the root, client, and server) indicates clear dependency management and build processes.
Main Components
a. Frontend:
• React Application: Contains UI components (e.g., ContestCard, Navbar), pages (HomePage, AdminPage, NotFound, etc.), and various utility hooks.
• Styling & State Management: Tailwind CSS along with light/dark mode toggling, search functionality and filtering UI.
b. Backend:
• Node.js Server using Express.js:
• Controllers divided by contest platforms (Codechef, Codeforces, LeetCode) for handling API logic.
• Routes that expose endpoints for fetching upcoming and past contests.
• Middleware for authentication (JWT-based) and other request handling.
• Integration of GraphQL endpoints and web scraping logic to fetch contest data.
c. Database:
• MongoDB: Stores user data, bookmarks, and additional contest-related metadata (e.g., saved video solutions).
d. External Services:
• Web sources for contest information (via web scraping and/or API calls).
• Deployment services (Render and possibly Vercel for the frontend).
• YouTube as an external provider for video solution content.
Relationships and Interactions
• The frontend communicates with the backend through RESTful API endpoints (e.g., /api/codechef/upcoming, /api/codeforces/past) and possibly GraphQL for more complex queries.
• The backend controllers act as intermediaries: they perform web scraping and API calls to third-party contest platforms, then format the data to be consumed by the frontend.
• The backend likely interacts with MongoDB to manage user sessions, store bookmarks, and save video solution links.
• Authentication middleware protects routes to ensure that only authenticated users can bookmark and access certain functionalities.
Architectural Patterns and Design Principles
• Separation of Concerns: Clear split between client and server functionality.
• MVC-like pattern on the backend: Controllers (handling business logic), Routes (defining API endpoints), and middleware (handling cross-cutting concerns like authentication).
• Component-based architecture in the frontend: Organized UI components and hooks that promote reusability.
• Usage of modern JavaScript frameworks (React, Node.js) and configuration-driven styling (Tailwind CSS).
Customize for AlgoSprint Specifics
• For the Frontend: Emphasize the modular structure found in the “client” directory with components and pages, including UI components like ThemeToggle and the various dialog components.
• For the Backend: Highlight how there are separate controllers and routes for the three main contest platforms. Mark the organizational structure that delineates between upcoming and past contests for each platform.
• Since the project involves web scraping and GraphQL, consider adding sub-components within the backend block that represent “Web Scraping Logic” and “GraphQL API Handler.”
Final Touches
• Notable configuration elements such as authentication (JWT middleware) and deployment targets (Render for backend, Vercel for frontend).