🚀 Demo Video 👉 Watch Here
- Overview
- Core Features
- Architecture
- Technology Stack
- Setup and Local Development
- API Documentation (Backend Endpoints)
- Data Synchronization & Cron Job (
node-cron) - Database Schema
- Frontend User Interface & Experience
- Future Enhancements
- Contributing Guidelines
- License
- Acknowledgements
This project is a full-stack MERN web application developed as part of an internship assignment. It focuses on automating the tracking, analysis, and visualization of Codeforces activity for competitive programmers.
It is designed to:
Automate fetching Codeforces data such as user profiles, ratings, contests, and submissions.
Provide visual analytics on competitive programming progress, including rating changes and problem-solving trends.
Identify inactive Codeforces users and send automated reminder emails to help encourage consistent participation.
Export competitive programming data to CSV files for further analysis.
Ensure secure access with authentication & authorization systems.
Use a cron job for daily data synchronization and background task automation.
This project demonstrates API integration, background task handling, and data-driven visualization for a real-world use case in competitive programming ecosystems.
- Automated Data Synchronization: Daily cron job fetches and updates student rating history, contest participation, and problem submissions from Codeforces.
- Student Profile Management: Comprehensive profiles including name, email, contact, and Codeforces handle.
- Performance Analytics: Visualizations of rating changes over time, average problems solved per day, and detailed submission history.
- Inactivity Monitoring: Identifies students who have been inactive for a configurable period.
- Automated Inactivity Reminders: Sends personalized email notifications to inactive students to encourage consistent practice.
- CSV Data Export: Allows administrators to download student data for offline analysis.
- User Authentication & Authorization: Secure login system with administrative roles.
- Feedback System: A channel for users to submit comments and report issues.
- Frontend (React.js): Manages the user interface, client-side routing, state, and interacts with the backend API to display and visualize data.
- Backend Server (Node.js/Express.js): Acts as a RESTful API gateway, handles business logic, communicates with MongoDB, orchestrates external API calls (Codeforces), manages user authentication, and runs scheduled tasks.
- MongoDB (Database): A NoSQL document database used for persistent storage of all application data, including student profiles, Codeforces submissions, and contest details.
- Cron Job (
node-cron): A scheduled task within the backend responsible for periodic data synchronization with the Codeforces API and triggering automated email reminders.
- Frontend ↔ Backend: Communicates via RESTful HTTP requests, with JSON as the data format. JWTs are used for secure, stateless authentication.
- Backend ↔ MongoDB: Interacts via Mongoose ODM, providing schema validation and robust data modeling.
- Backend ↔ Codeforces API: Uses Axios to make HTTP requests, with built-in rate limiting to manage API call frequency.
The architecture is designed for maintainability and resilience. The backend is stateless to facilitate horizontal scaling. Robust error handling, asynchronous operations, and idempotent data updates ensure system stability and data integrity, even during failures or repeated operations.
- React.js: For building dynamic user interfaces.
- Tailwind CSS: Utility-first CSS framework for responsive design.
- Recharts: For data visualization (e.g., rating graphs).
- Lucide React: For SVG icons.
- Axios: HTTP client for API requests.
- Node.js & Express.js: Runtime environment and web framework for the RESTful API.
- Mongoose: MongoDB ODM for data modeling.
- Axios: For external API calls.
node-cron: For scheduling automated tasks.nodemailer: For sending emails.dotenv: For environment variable management.jsonwebtoken&bcryptjs: For secure authentication.cors: Middleware for Cross-Origin Resource Sharing.
- MongoDB: NoSQL document database for flexible and scalable data storage.
- Codeforces API: The primary source for competitive programming data (user info, submissions, contest details).
Follow these detailed instructions to set up and run the TLE Eliminators project on your local development environment.
- Node.js (LTS version recommended) & npm
- MongoDB instance (local or cloud-hosted via MongoDB Atlas)
- Git
- Clone the repository:
git clone https://github.com/Kunal1522/Smart-Cp--TLE.git - Navigate:
cd Smart-Cp--TLE/backend - Install dependencies:
npm install - Create
.env: Create a.envfile inbackend/with:PORT=5000 MONGODB_URI=your_mongodb_connection_string_here JWT_SECRET=a_very_strong_random_secret_key_for_jwt_signing JWT_EXPIRES_IN=1d EMAIL_USER=[email protected] EMAIL_PASS=your_gmail_app_password # Use App Password for Gmail with 2FA CLIENT_ORIGIN=http://localhost:3000 FRONTEND_URL=http://localhost:3000 CODEFORCES_API_BASE_URL=[https://codeforces.com/api/](https://codeforces.com/api/)
- Navigate:
cd Smart-Cp--TLE/frontend - Install dependencies:
npm install - Create
.env: Create a.envfile infrontend/with:REACT_APP_API_BASE_URL=http://localhost:5000/api
- Start Backend: In
backend/directory, runnpm start. - Start Frontend: In
frontend/directory, runnpm start. The frontend will typically open in your browser athttp://localhost:3000.
EADDRINUSE: A port is already in use. ChangePORTin.envor terminate the conflicting process.- MongoDB Connection: Verify
MONGODB_URIand ensure your MongoDB instance is running and accessible. - CORS Errors: Ensure
CLIENT_ORIGINinbackend/.envexactly matches your frontend's URL. - Network Error /
SyntaxError(Frontend): Confirm backend server is running andREACT_APP_API_BASE_URLinfrontend/.envis correct.
The TLE Eliminators backend provides a RESTful API for managing student data and system functionalities.
All sensitive endpoints require a valid JWT in the Authorization: Bearer <token> header. Role-based authorization (admin access) restricts certain routes.
API responses use standard HTTP status codes. Errors are consistently returned as JSON objects with a message field.
POST /api/auth/register: Register a new user.- Request:
{ username, email, password, role } - Response:
{ token, user }(201 Created)
- Request:
POST /api/auth/login: Authenticate a user and get a JWT.- Request:
{ email, password } - Response:
{ token, user }(200 OK)
- Request:
GET /api/students: Retrieve a list of all students with summarized data.GET /api/students/:id: Retrieve basic details for a specific student by MongoDB ID.GET /api/students/:id/profile: Retrieve comprehensive profile data (student, contests, submissions).POST /api/students: Register a new student. Triggers async Codeforces data sync.- Request:
{ name, email, phoneNumber, codeforcesHandle, autoEmailEnabled }
- Request:
PUT /api/students/:id: Update student details. Triggers async re-sync if handle changes.DELETE /api/students/:id: Delete a student and all associated data.GET /api/students/download-csv: Download all student data as a CSV file.
POST /api/feedback: Submit user feedback.- Request:
{ name, email, message } - Response:
{ message: "Feedback submitted successfully." }(201 Created)
- Request:
The node-cron job runs daily within the backend server to keep student data current.
- Fetch All Students: Retrieves student records from the database.
- Iterate & Sync: For each student, it makes sequential API calls to Codeforces (
user.info,user.status,user.rating) to fetch the latest data.- Student profiles, contest history, and submissions are updated/inserted into MongoDB.
- Rate limits are respected with delays between calls.
- Post-Sync Analytics: Calculates derived metrics like "average problems per day" using MongoDB aggregation pipelines.
- Inactivity Detection: Identifies students inactive for a set period.
- Automated Reminders: Sends email reminders to inactive students via Nodemailer.
The sync process is idempotent, utilizing MongoDB's upsert: true and unique indexes to prevent data duplication on repeated runs. Comprehensive try-catch blocks and logging ensure individual student sync failures do not halt the entire job, and API rate limits are handled gracefully.
The MongoDB database includes the following key collections, managed by Mongoose:
students: Core student information, Codeforces handle, ratings, and meta-data.codeforcescontests: Records of student participation in Codeforces contests.codeforcessubmissions: Detailed records of individual Codeforces problem submissions.feedbacks: Stores user-submitted feedback messages.
All collections use appropriate indexing for query performance and data integrity.
The React frontend delivers an intuitive and responsive user experience:
- Welcome Page: Engaging introduction with animations and navigation.
- Authentication Pages: Secure login and signup forms.
- Dashboard: Central admin hub listing students, summary stats, and actions like adding students or downloading CSVs.
- Student Profile Page: Detailed view for individual students with rating graphs, contest history, and submission lists.
- Add/Edit Student Forms: Intuitive interfaces for managing student information.
Styling is handled by Tailwind CSS for a consistent and responsive design across all devices. The UI incorporates modern aesthetics and subtle animations to enhance user engagement.
- More granular user roles and permissions.
- In-app notifications for system events.
- Dedicated student-facing dashboard.
- Advanced problem tag and difficulty analysis.
- Integration with other competitive programming platforms.
- Dockerization for streamlined deployment.
- Automated testing and CI/CD pipeline.
Contributions are welcome!
- Fork the repository.
- Create a new feature or bugfix branch.
- Implement your changes following existing code style.
- Write clear, conventional commit messages.
- Open a Pull Request with a descriptive summary.
This project is open-source and licensed under the MIT License.
- Codeforces: For providing the platform and API.
- MERN Stack Technologies: MongoDB, Express.js, React, Node.js.
- All other open-source libraries and frameworks that make this project possible.