A scalable backend for CodeArena, a competitive coding platform. Built with Node.js, Express, TypeScript, MongoDB, and Socket.io. Supports user authentication, contest management, problem submissions, social features, and more.
- User registration, login (OTP & Google), password management
- Contest creation, joining, and management
- Problem submission and evaluation
- Social features: follow, search, suggested users
- Real-time updates via Socket.io
- Email notifications (OTP, password reset)
- Node.js
- Express
- TypeScript
- MongoDB (Mongoose)
- Socket.io
- Cloudinary (file uploads)
- Redis (caching)
- Multer (file handling)
- Nodemailer (emails)
- Clone the repository
git clone https://github.com/parikshit-jaiswal/Code-Arena-Backend.git cd Code-Arena-Backend - Install dependencies
npm install
- Configure environment variables
- Copy
.env.exampleto.envand fill in required values (MongoDB URI, JWT secret, Cloudinary, etc.)
- Copy
- Run in development
npm run dev
- Build for production
npm run build npm start
| Endpoint | Method | Description | Auth |
|---|---|---|---|
/register |
POST | Register new user | No |
/login |
POST | Login with password/OTP | No |
/v |
POST | Verify login OTP | No |
/forgot-password |
POST | Request password reset OTP | No |
/verify-reset-password-otp |
POST | Verify password reset OTP | No |
/update-password |
POST | Update password | No |
/google |
POST | Google login | No |
/logout |
POST | Logout user | Yes |
/refresh-token |
POST | Refresh JWT token | No |
/get-user-data |
GET | Get current user data | Yes |
/change-password |
POST | Change password | Yes |
/manageable-contests |
GET | Get contests manageable by user | Yes |
/profile-picture |
POST | Upload profile picture | Yes |
/current |
GET | Get current user data | Yes |
/:userId |
GET | Get user by ID | Yes |
/follow |
POST | Follow/unfollow user | Yes |
/search-friends |
POST | Search friends by name | Yes |
/suggested-users |
GET | Suggested users to follow | Yes |
/profile/:userId |
GET | Get profile of user | Yes |
/create-password |
POST | Create password for Google user | Yes |
| Endpoint | Method | Description | Auth |
|---|---|---|---|
/join-contest/:contestId |
POST | Join a contest | Yes |
/getAllContests |
GET | Get all contests | Yes |
/getContestById/:contestId |
GET | Get contest by ID | Yes |
/create-contest |
POST | Create a new contest | Yes |
| Endpoint | Method | Description | Auth |
|---|---|---|---|
/submit-solution/:contestId/:problemId |
POST | Submit solution to a problem | Yes |
/get-problem/:contestId/:problemId |
GET | Get problem details | Yes |
| Endpoint | Method | Description | Auth |
|---|---|---|---|
/suggested-users |
GET | Get suggested users | Yes |
/search-users |
POST | Search users | Yes |
/follow |
POST | Follow/unfollow user | Yes |
/followers |
GET | Get followers | Yes |
/following |
GET | Get following | Yes |
| Endpoint | Method | Description | Auth |
|---|---|---|---|
/ |
GET | Test API health | No |
- Most endpoints require JWT authentication (see
Authcolumn above). - Use the
/loginor/googleendpoints to obtain a token. - Pass token in
Authorization: Bearer <token>header.
- Fork the repo and create your branch.
- Write clear, documented code and tests.
- Submit a pull request with a detailed description.
This project is licensed under the ISC License.