Contest Hub is a web application designed to help competitive programmers track upcoming and past coding contests from platforms like LeetCode, Codeforces, and CodeChef. The platform allows users to bookmark contests, view solutions for past contests, and enables admins to add video solutions.
- View upcoming coding contests with details such as title, platform, start time, and duration
- Browse past contests and check available solutions (if added by an admin)
- Filter contests by platform (LeetCode, Codeforces, CodeChef) and duration
- Bookmark contests for easy access later
- Saved bookmarks persist across multiple sessions
- Access past contests and view available solutions
- Add video solutions to past contests using predefined YouTube playlists
- Select a video from LeetCode, Codeforces, or CodeChef playlists and attach it as a solution to a contest
- Solutions will be visible to all users once added
The main page displays upcoming contests with filtering options by platform (LeetCode, Codeforces, CodeChef).
Each contest shows:
- Contest name and number
- Platform with color coding
- Status (Upcoming)
- Time left until the contest starts
- Contest duration
- Action buttons (Visit, Bookmark)
Displays completed contests with options to:
- Search contests
- Filter by platform and duration
- View contest details (name, platform, start time, duration)
- Visit the contest page
- Access solutions (if available)
- Add solutions (admin only)
- Bookmark contests
Shows all contests bookmarked by the user with:
- Contest details in card format
- Platform and status indicators
- Start time and duration
- Visit and solution availability information
Admins can add video solutions to past contests:
- Modal interface for selecting and previewing YouTube videos
- Embedded video player for previewing content
- Input field for pasting selected video URL
- Add Solution button to confirm and save the solution
- Solutions become immediately available to all users
- React.js
- Tailwind CSS
- React Icons
- React Router
- React Toastify (for notifications)
- Node.js
- Express.js
- MongoDB (Mongoose ORM)
- JWT Authentication
- Multer (for file uploads)
- MongoDB (for storing contests, users, and bookmarks)
-
Clone the repository
git clone https://github.com/adi-rajput/TLE-Codehub.git cd contest-hub -
Install dependencies
npm install
-
Set up environment variables Create a .env file in the backend directory and add:
PORT=3000 MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_secret_key -
Start the backend server
npm start
-
Start the frontend
cd client npm install npm start
- POST /user/register → Register a new user
- POST /user/login → Log in with email & password
- GET /user/me → Get logged-in user details
- GET /user/bookmarks → Get bookmarked contests
- PUT /user/toggle-bookmark/:contestId → Toggle bookmark status for a contest
- GET /contests/upcoming → Fetch upcoming contests
- GET /contests/past?page=1&limit=50 → Fetch paginated past contests
- GET /contests/codeforces-contests → Fetch Codeforces contests
- GET /contests/leetcode-contests → Fetch LeetCode contests
- GET /contests/codechef-contests → Fetch CodeChef contests
- PUT /user/add-solution-link/:contestId → Add a solution link to a past contest
- Open the homepage to see upcoming contests
- Go to the Past Contests page to view past contests
- Click the star icon to save a contest
- Visit the Bookmarks section to view saved contests
- Click "ADD SOLUTION" button on a past contest
- Review the embedded YouTube video preview
- Paste the selected video URL in the input field
- Click "Add Solution" to save and make it available to all users
- Users must log in to bookmark contests
- Admins have additional privileges to add solutions
- Authentication is handled via JWT tokens stored in cookies
- Responsive UI built with Tailwind CSS
- Toast notifications for bookmarks & solution updates
- Modal interfaces for solution management