Skip to content

Beeram12/college-appointment-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

College Appointment System

The College Appointment System is a web application that enables students to book appointments with professors based on their availability. The system is built using Go (Golang) as the backend language, MongoDB as the database, and JWT (JSON Web Token) for secure authentication.


Table of Contents

  1. Project Overview
  2. Features
  3. Technologies Used
  4. Setup Instructions
  5. Endpoints
  6. Authentication
  7. Testing
  8. Contributing
  9. License

Project Overview

The College Appointment System simplifies the process of scheduling appointments between students and professors. Professors can set their availability, while students can view and book available slots. The system ensures secure access and proper role-based permissions using JWT-based authentication.


Features

  • User Registration and Login:
    • Students and professors can register and log in to the system.
  • Set Availability:
    • Professors can set their available time slots.
  • Book Appointments:
    • Students can book appointments with professors based on their availability.
  • View Appointments:
    • Students can view their booked appointments.
  • Cancel Appointments:
    • Students can cancel their appointments.
  • Role-Based Access Control:
    • Separate access levels for student and professor roles.

Technologies Used

  • Backend: Go (Golang)
  • Database: MongoDB
  • Authentication: JWT (JSON Web Token)
  • API Framework: Gorilla Mux
  • Utilities:
    • golang.org/x/crypto for password hashing
    • github.com/golang-jwt/jwt/v5 for JWT generation and validation
  • Build Tool: Makefile
  • Testing: Postman

Setup Instructions

Prerequisites

  1. Go:

  2. MongoDB:

    • Install MongoDB locally or use a cloud-hosted instance like MongoDB Atlas.
    • Update the connection string in .env.
  3. Postman:

  4. Make:

    • Install make for running build and test commands.

Steps to Set Up

  1. Clone the Repository:

    git clone https://github.com/Beeram12/college-appointment-system.git
    cd college-appointment-system
  2. Install Dependencies: Make sure you have go mod initialized and install the required dependencies:

    make deps

    This will execute go mod tidy, downloading and organizing all dependencies specified in the go.mod file.

  3. Configure Environment Variables: Create a .env file in the root directory and add the following configurations:

    MONGO_URI=mongodb://localhost:27017
    MONGO_DB="Your DB name"
    JWT_SECRET=your_secret_key
    PORT=8000
    • Replace mongodb://localhost:27017 with your MongoDB connection string (e.g., for MongoDB Atlas).
    • Replace your_jwt_secret_key_here with a strong secret key for signing JWT tokens.
    • Ensure the .env file is added to .gitignore to prevent sensitive information from being committed:
  4. Run the Application: Start the server using the following command:

    make run

    The application will run at http://localhost:8000.


Endpoints

Authentication

Method Endpoint Description Request Body
POST /auth/register Register a user { "username": "user1", "password": "password123", "role": "student" }
POST /auth/login Login to get a JWT token { "username": "user1", "password": "password123" }

Professor Endpoints

Method Endpoint Description Request Body
POST /professor/availability Set available time slots { "time_slot": "09:00 AM"}
GET /professor/appointments View all appointments None

Student Endpoints

Method Endpoint Description Request Body
GET /appointments/{professor_id} View available slots None
POST /appointments/book Book an appointment { "professor_id": "67a62b8f1dae6c55fdddf2d9", "time_slot": "09:00 AM" }
DELETE /appointments/cancel/{appointment_id} Cancel a booked appointment None
GET /student/appointments View booked appointments None

Authentication

  • The system uses JWT(JSON Web Token) for secure authentication.
  • Users must include their token in the Authorization header for protected endpoints:
    Authorization: Bearer <your_token>

Testing

Manual Testing

  • Use Postman to test all endpoints individually.
  • Include the JWT token in headers for authenticated routes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published