{"id":23317954,"url":"https://github.com/riishabhraj/college-appointment-backend","last_synced_at":"2026-04-10T04:45:29.497Z","repository":{"id":268532758,"uuid":"904637698","full_name":"riishabhraj/college-appointment-backend","owner":"riishabhraj","description":"College Appointment System Backend API","archived":false,"fork":false,"pushed_at":"2024-12-17T10:11:14.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T04:52:48.819Z","etag":null,"topics":["expressjs","jest","mongodb","nodejs","postman","testing"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/riishabhraj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-17T09:22:28.000Z","updated_at":"2024-12-17T10:13:57.000Z","dependencies_parsed_at":"2024-12-17T11:35:11.177Z","dependency_job_id":null,"html_url":"https://github.com/riishabhraj/college-appointment-backend","commit_stats":null,"previous_names":["riishabhraj/college-appointment-backend"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/riishabhraj/college-appointment-backend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riishabhraj%2Fcollege-appointment-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riishabhraj%2Fcollege-appointment-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riishabhraj%2Fcollege-appointment-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riishabhraj%2Fcollege-appointment-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/riishabhraj","download_url":"https://codeload.github.com/riishabhraj/college-appointment-backend/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riishabhraj%2Fcollege-appointment-backend/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28131610,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-30T02:00:05.476Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["expressjs","jest","mongodb","nodejs","postman","testing"],"created_at":"2024-12-20T17:14:37.132Z","updated_at":"2025-12-30T20:03:19.917Z","avatar_url":"https://github.com/riishabhraj.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# College Appointment System - Backend API Documentation\n\nThis repository provides the backend APIs for a College Appointment System that \nallows students to book appointments with professors. The system supports professor \navailability management, student authentication, appointment booking, and cancellation. \nThe backend is built using **Node.js**, **Express.js**, and **MongoDB**.\n\n## **Table of Contents**\n1. [Introduction](#introduction)\n2. [API Endpoints](#api-endpoints)\n    - [Authentication](#authentication)\n    - [Professor Availability](#professor-availability)\n    - [Appointments](#appointments)\n3. [Database Setup](#database-setup)\n4. [Environment Configuration](#environment-configuration)\n5. [Running the Application](#running-the-application)\n6. [Testing](#testing)\n\n---\n\n## **1. Introduction**\n\nThis system allows students to book appointments with professors based on their availability. \nProfessors can specify their available time slots, and students can book an appointment based on \nthose slots. The system also includes the functionality to cancel appointments and view existing appointments.\n\n### **Features:**\n\n- Students can register, log in, and view professor availability.\n- Professors can register, log in, and manage their available time slots.\n- Students can book and cancel appointments with professors.\n- Professors can view and cancel appointments.\n\n---\n\n## **2. API Endpoints**\n\n### **Authentication**\n\n- **POST** `/api/auth/register`  \n  Register a new user (student or professor).  \n  **Request Body**:  \n  ```json\n  {\n      \"name\": \"John Doe\",\n      \"password\": \"password\",\n      \"email\": \"john@gmail.com\",\n      \"role\": \"student/professor\"\n  }\n\n- **POST** `/api/auth/login`  \n  Log in an existing user.\n  **Request Body**:  \n  ```json\n  {\n    \"email\": \"john@gmail.com\",\n    \"password\": \"password\"\n  }\n\n### **Response for login**:\n``` json\n{\n    \"token\": \"a_jwt_token_will_be_displayed_here\"\n}\n```\n\n### **Professor Availability**\n\n- **POST** `/api/availability`  \n  Professor adds an available time slot.\n  Authorization: Bearer token (Only accessible to professors)\n  **Request Body**:  \n  ```json\n  {\n    \"startTime\": \"2024-12-20T09:00:00Z\",\n    \"endTime\": \"2024-12-20T11:00:00Z\"\n  }\n  \n- **GET** `/api/availability/:professorId`\n  Get all available time slots for a specific professor.\n  Authorization: Bearer token (Only accessible to authenticated users)\n  **Request Body**:\n  ```\n  [\n      {\n          \"professorId\": \"123456\",\n          \"startTime\": \"2024-12-20T09:00:00Z\",\n          \"endTime\": \"2024-12-20T11:00:00Z\"\n      }\n  ]\n  ```\n  \n### **Appointments**\n\n- **POST** `/api/appointments`\n  Student books an appointment with a professor.\n  Authorization: Bearer token (Only accessible to students)\n  **Request Body**:\n  ```\n  {\n      \"professorId\": \"123456\",\n      \"startTime\": \"2024-12-20T09:00:00Z\"\n  }\n  ```\n  \n- **DELETE** `/api/appointments/:id`\n  Student cancels their appointment.\n  Authorization: Bearer token (Only accessible to students who made the appointment)\n  **Request Body**:\n  ```\n    {\n      \"appointmentId\": \"appointment123\"\n    }\n\n- **GET** `/api/appointments`\n  Get all appointments for the authenticated student.\n  Authorization: Bearer token (Only accessible to authenticated users)\n  **Response**:\n  ```\n  [\n      {\n          \"appointmentId\": \"appointment123\",\n          \"professorId\": \"123456\",\n          \"startTime\": \"2024-12-20T09:00:00Z\"\n      }\n  ]\n  ```\n  \n## **3. Database Setup (MongoDB)**\n\n### **Required Collections**:\n  Users Collection: Stores user data (students and professors).\n  Availability Collection: Stores the availability slots for professors.\n  Appointments Collection: Stores the appointments booked by students.\n  \n## **4. Environment Configuration**\n\n  To set up the environment variables, create a .env file in the root directory of the project. Here’s an example of the configuration:\n  .env\n  ```\n    DB_URI=mongodb://localhost:27017/college-appointment-system (use this for local setup)\n    JWT_SECRET: Secret key used for signing JWT tokens.\n  ```\n\n## **5. Running the Application**\n\n### **1. Install Dependencies**\n\n  To install the required dependencies, run the following command:\n  ```\n    npm install\n  ```\n\n### **2. Start the Application**\n\n  To start the application, use the following command:\n  ```    \n    npm start\n  ```\n\n  By default, the app will be available at http://localhost:3000.\n\n## **6. Testing**\n  End-to-End (E2E) Test\n  The system includes an E2E test to ensure the functionality of booking an appointment. You can run the tests using:\n  ```\n  npm run test\n  ```\n\n  The test suite uses Jest and Supertest for API testing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friishabhraj%2Fcollege-appointment-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Friishabhraj%2Fcollege-appointment-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friishabhraj%2Fcollege-appointment-backend/lists"}