The SARC backend is designed for the CSE Society website of IIT (ISM) Dhanbad. All backend logic is implemented within the SERVER folder. The system is built using Node.js, Express.js, and MongoDB for database management. Additionally, Redis is used for caching, Cloudinary handles cloud storage for images and PDFs, and the application is containerized using Docker for seamless deployment.
The system supports three types of users:
- Professors
- Students
- Alumni
Currently, user data is stored in MongoDB, with sample datasets available in the randomdata folder. Authentication is handled through a middleware called setUser, which can be replaced with a robust authentication mechanism using CSES authentication and LinkedIn verification.
- Created by: Professors (Admins)
- Professors can publish events by providing:
- Title
- Description
- Registration URL
- Person-in-Charge (FIC)
- Optional event background image
- Each event is assigned a unique event ID (not MongoDB’s ObjectId).
- Supported operations:
- Create an event
- Retrieve all events
- Get event details by ID
- Delete an event
- Created by: Alumni
- Alumni can publish job referrals with:
- Job profile
- Company
- Application deadline
- Eligibility criteria
- Supported operations:
- List all referrals
- Apply for referrals (students only)
- Get referral details (for publisher)
- Fetch publisher’s referrals
- Delete referral (for publisher)
- Created by: Professors
- Professors can upload PDF publications, specifying the number of pages to be displayed.
- The frontend extracts the specified pages using PDF-lib, generates a new PDF, and sends it to the backend.
- Supported operations:
- Upload a publication
- List all publications
- Retrieve a publication
- Delete a publication
- A custom error-handling class extending JavaScript's built-in
Errorclass. - Works with a centralized Error Handler Middleware, which catches and formats all errors before sending responses.
- A structured response format to ensure consistency across API responses.
- A higher-order function to handle asynchronous operations without the need for repetitive
try-catchblocks in controllers.
Endpoint: POST /api/publications/create-publication
Headers:
Authorization: Bearer <token>(Required)
Body Parameters (Form-Data):
publication_pdf(File, Required): The PDF file to upload.
Response:
{
"status": 200,
"data": {
"publicationID": "...",
"publication-cloudinaryURL": "...",
"publisher-details": "..."
},
"message": "Publication created successfully"
}Endpoint: GET /api/publications/publication-list
Description: Fetches a list of all available publications.
Response:
{
"status": 200,
"data": [
{
"publicationID": "...",
"publication-cloudinaryURL": "...",
"publisher-details": "..."
}
],
"message": "All publications fetched successfully"
}Endpoint: GET /api/publications/:publicationid
Description: Fetches details of a specific publication.
Path Parameters:
publicationid(String, Required): The unique ID of the publication.
Response:
{
"status": 200,
"data": {
"publicationID": "...",
"publication-cloudinaryURL": "...",
"publisher-details": "..."
},
"message": "Publication details fetched successfully"
}Endpoint: DELETE /api/publications/delete/:publicationid
Description: Allows a professor to delete their own publication.
Headers:
Authorization: Bearer <token>(Required)
Path Parameters:
publicationid(String, Required): The unique ID of the publication.
Response:
{
"status": 200,
"data": null,
"message": "Publication deleted successfully"
}Endpoint: POST /api/publications/get-my-publications
Description: Fetches all publications uploaded by the logged-in professor.
Headers:
Authorization: Bearer <token>(Required)
Response:
{
"status": 200,
"data": [
{
"publicationID": "...",
"publication-cloudinaryURL": "..."
}
],
"message": "Publication details fetched successfully"
}Authorization: Bearer <token>(Required)
company_name(String, Required): Name of the company.deadline(Date, Required): Application deadline.eligibility(String, Required): Eligibility criteria.job_profile(String, Required): Job profile for the referral.
{
"status": 201,
"data": {
"company_name": "...",
"job_profile": "...",
"deadline": "...",
"eligibility": "...",
"referral_id": "..."
},
"message": "Referral created successfully"
}{
"status": 200,
"data": [
{
"company_name": "...",
"job_profile": "...",
"deadline": "...",
"eligibility": "...",
"referral_id": "..."
}
],
"message": "List of all referrals"
}Authorization: Bearer <token>(Required)
referralId(String, Required): The unique ID of the referral.
{
"status": 200,
"data": null,
"message": "Applied successfully"
}Authorization: Bearer <token>(Required)
referralId(String, Required): The unique ID of the referral.
{
"status": 200,
"data": {
"referral_id": "...",
"company_name": "...",
"job_profile": "...",
"deadline": "...",
"applicants": [
{
"full_name": "...",
"linkedIn": "...",
"email": "...",
"grad_yr": "..."
}
]
},
"message": "Data fetched successfully"
}Authorization: Bearer <token>(Required)
{
"status": 200,
"data": [
{
"job_profile": "...",
"deadline": "...",
"company_name": "...",
"eligibility": "...",
"referral_id": "..."
}
],
"message": "Referral details fetched successfully"
}Authorization: Bearer <token>(Required)
refid(String, Required): The unique ID of the referral.
{
"status": 200,
"data": null,
"message": "Referral deleted successfully"
}Authorization: Bearer <token>(Required)Content-Type: multipart/form-data
title(String, Required): Title of the event.eventDate(Date, Required): Date of the event.reg_url(String, Required): Registration URL.description(String, Required): Description of the event.event_img(File, Optional): Event image.
{
"status": 201,
"data": {
"title": "...",
"eventId": "...",
"eventDate": "...",
"reg_url": "...",
"description": "...",
"FIC": "...",
"img_url": "..."
},
"message": "Event created successfully"
}{
"status": 200,
"data": [
{
"title": "...",
"eventDate": "...",
"description": "...",
"img_url": "...",
"reg_url": "...",
"eventId": "...",
"FIC": {
"full_name": "...",
"email": "...",
"linkedIn": "..."
}
}
],
"message": "List of all events"
}eventid(String, Required): The unique ID of the event.
{
"status": 200,
"data": {
"title": "...",
"eventDate": "...",
"description": "...",
"img_url": "...",
"reg_url": "...",
"eventId": "...",
"FIC": {
"full_name": "...",
"email": "...",
"linkedIn": "..."
}
},
"message": "Event details fetched successfully"
}Authorization: Bearer <token>(Required)
eventid(String, Required): The unique ID of the event.
{
"status": 200,
"data": null,
"message": "Event deleted successfully"
}