Skip to content
Laviyx Learn

Try

Final-year project

Hospital Appointment Booking System

A full-stack web app where patients book doctor appointments in free time slots, doctors manage their schedule, and admins manage doctors, with login, roles and a SQL database.

Advanced 8–12 weeks 2–4 studentsUpdated

Node.jsExpressSQLite or PostgreSQLJWTHTML, CSS, JavaScript or React

The problem

Patients often wait in long queues just to get an appointment, and clinics manage bookings on paper or by phone, which leads to double bookings and missed slots. An online booking system shows free slots, prevents two patients booking the same time, and lets doctors see their day at a glance.

It is a strong final-year project because it has real users with different roles, a relational database with clear rules, and security to think about.

Features to build

  • Sign up and log in for patients, with hashed passwords and token-based sessions
  • Three roles: patient, doctor and admin, each seeing only their own screens
  • Admin adds doctors with department, consultation hours and slot length
  • Patients search doctors by department and see free slots for a chosen date
  • Book, view and cancel appointments, with a rule that a slot can be booked only once
  • Doctors see today's appointments, mark them completed and add short notes
  • Input validation on every API route and clear error responses
  • Admin dashboard: appointments per day and per department

Suggested data model

TableKey columns
usersid, name, email (unique), password_hash, role
doctorsid, user_id, department, start_time, end_time, slot_minutes
appointmentsid, doctor_id, patient_id, date, slot_time, status, notes

Add a unique constraint on (doctor_id, date, slot_time) for active appointments. The database then refuses a double booking even if two requests arrive at the same moment.

Build plan

  1. 1

    Requirements and design

    Write user stories for each role, draw the ER diagram and the screens, and list every API route with its method, input and response.

  2. 2

    Database

    Create the tables with primary keys, foreign keys, NOT NULL and the unique booking constraint. Add sample doctors.

  3. 3

    Authentication

    Build sign-up and login routes. Hash passwords with bcrypt, issue a JWT on login, and write middleware that checks the token and the user's role.

  4. 4

    Booking API

    Generate a doctor's slots for a date from their hours, remove booked ones, and create bookings inside a transaction. Return 409 Conflict when a slot is taken.

  5. 5

    Front end

    Build the patient, doctor and admin screens that call the API with fetch and show loading and error states.

  6. 6

    Testing

    Write automated API tests for login, booking, double booking and cancelling, and test each role's access.

  7. 7

    Deployment and report

    Deploy to a free or low-cost host, then write the report with the ER diagram, API table, test cases and screenshots.

Learn these first

Each part of the project is taught in one of these free lessons.

Make it stand out

  • Email or SMS reminders the day before an appointment
  • Prescription upload after the visit
  • Online payment of the consultation fee in a payment gateway's test mode
  • Deploy with Docker and a managed database

Viva and interview questions

Try to answer each one aloud before you open it.

  • How do you prevent two patients booking the same slot?

    A unique constraint on doctor, date and slot time in the database. Even if two requests arrive together, the database accepts only one insert and the other fails, and the API returns 409 Conflict. Checking in code alone is not enough because both requests could pass the check before either inserts.

  • Why do you hash passwords instead of encrypting them?

    Hashing is one-way: even we cannot read the original password. At login we hash the entered password and compare. bcrypt also adds a salt and is deliberately slow, which makes guessing attacks expensive.

  • What is a JWT and what does it contain in your app?

    A JSON Web Token is a signed string the server gives after login. It holds the user id and role and an expiry time. The server checks the signature on every request, so it knows who the user is without storing sessions.

  • How do you make sure a patient cannot see another patient's appointments?

    The API never trusts an id sent by the client for this. It takes the user id from the verified token and only queries appointments where patient_id matches it.

  • Why did you choose a relational database?

    The data has clear relationships (users, doctors, appointments) and strict rules like unique bookings and valid foreign keys. A relational database enforces those rules and handles joins for reports.

  • What would you change to handle thousands of users?

    Move from SQLite to PostgreSQL, add indexes on the columns used for searching slots, run several app instances behind a load balancer, and send reminders through a background job queue.

What to put in your project report

  1. Abstract: the problem, your solution and the result in one paragraph.
  2. Introduction and problem statement: who has the problem and why it matters.
  3. Requirements: the features (functional) and qualities such as speed and security (non-functional).
  4. Design: architecture diagram, database tables or data flow, and screen layouts.
  5. Implementation: the main modules and the most interesting code, explained.
  6. Testing: the test cases you ran, with inputs, expected and actual results.
  7. Results: screenshots or numbers that show the project working.
  8. Conclusion and future scope: what you achieved and what you would add next.

Your college may give its own format. Follow that first, and use this list to check nothing is missing.

All project ideas →