A Node RESTful API that helps clinics manage their daily tasks.
Technologies Used: Node.js - Express.js - TypeScript - MySQL - Sequelize - Jest
- CRUD Operations for different roles and reserving appointments.
- Validation & Sanitization of Data with Sequelize & Express-Validator
- Securely Storing Passwords with bcrypt.
- Authorization & Authentication with JWT.
- Unit Testing with Jest.
- Assigning different operations based on role [ Admin - Receptionists - Doctors ].
- Patients can choose to reserve an appointment with a certian doctor or specialty.
- Patients can reschedule their appointments to the nearest date available, done using binary search algorithm & Map data structure.
- Doctors can view their own appointments schedule on any day.
- Receptionists can query about each doctor and specialty nearest available appointment.
To run this project, you will need to create a config folder in the root directory of the project, create dev.env & test.env files then add the following environment variables to your .env files
PORT
JWT_SECRET
DB_DIALECT
DB_USERNAME
DB_PASSWORD
DB_NAME
ADMIN_EMAIL
ADMIN_PASSWORD
Clone the project
git clone https://github.com/Ahmed-Yassen/clinic-management-system.git
Go to the project directory
cd clinic-management-system
Install dependencies
npm install
Start the server
npm run start
To run the tests
npm run test
- Clinic working hours are from 5PM to 11PM, from Sunday to Thursday.
- Make sure not to create an appointment on a weekend or an old date.
- Make sure a doctor doesn't get two appointments at the same time.
- Session duration is up to 20 minutes.
- Admin creates specialties, every doctor should have a specialty.
- Receptionists data include [email, password, name, phoneNumber, salary, address]
- Doctors data include [email, password, name, phoneNumber, examinationPrice, address]
- Receptionists & Doctors should be able to update their profile data except for salary & examinationPrice.
- Only the admin can update receptionists's salaries & doctor's specialty or examinationPrices.
POST /api/auth/signup/receptionist
Parameter | Type | Description |
---|---|---|
email |
string |
Required. |
password |
string |
Required. should be between 8 and 32 characters. |
phoneNumber |
string |
Required. A phone number that follows Egyptian phone numbers standard. |
address |
string |
Optional. |
fullName |
string |
Required. |
salary |
number |
Required. Should be atleast 2500 |
POST /api/auth/signup/doctor
Parameter | Type | Description |
---|---|---|
email |
string |
Required. |
password |
string |
Required. should be between 8 and 32 characters. |
phoneNumber |
string |
Required. A phone number that follows Egyptian phone numbers standard. |
address |
string |
Optional. |
fullName |
string |
Required. |
examinationPrice |
number |
Required. should be atleast 50 |
specialtyId |
number |
Required. doctor's specialty, |
POST /api/auth/login
Parameter | Type | Description |
---|---|---|
email |
string |
Required. |
password |
string |
Required. should be between 8 and 32 characters. |
PATCH /api/auth/changepassword
Parameter | Type | Description |
---|---|---|
password |
string |
Required. |
GET /api/users/login
GET /api/users/profile
GET /api/users/doctors/:id
Parameter | Type | Description |
---|---|---|
id |
number |
Required. doctor's id |
GET /api/users/receptionists/:id
Parameter | Type | Description |
---|---|---|
id |
number |
Required. receptionist's id |
PATCH /api/users/doctors/:id
Parameter | Type | Description |
---|---|---|
id |
number |
Required. receptionist's id |
examinationPrice |
number |
Optional. |
specialtyId |
number |
Optional. |
PATCH /api/users/doctors/:id
Parameter | Type | Description |
---|---|---|
id |
number |
Required. receptionist's id |
salary |
number |
Required. |
DELETE /api/users/:id
Parameter | Type | Description |
---|---|---|
id |
number |
Required. user id |
PATCH /api/users/receptionists
Parameter | Type | Description |
---|---|---|
fullName |
string |
Optional. |
address |
string |
Optional. |
phoneNumber |
string |
Optional. |
PATCH /api/users/doctors
Parameter | Type | Description |
---|---|---|
fullName |
string |
Optional. |
address |
string |
Optional. |
phoneNumber |
string |
Optional. |
POST /api/specialties
Parameter | Type | Description |
---|---|---|
name |
string |
Required. |
GET /api/specialties
PATCH /api/specialties/:id
Parameter | Type | Description |
---|---|---|
id |
number |
Required. |
name |
string |
Required. |
DELETE /api/specialties/:id
Parameter | Type | Description |
---|---|---|
id |
number |
Required. |
POST /api/patients
Parameter | Type | Description |
---|---|---|
fullName |
string |
Required. |
phoneNumber |
string |
Required. |
GET /api/patients
PATCH /api/patients/:id
Parameter | Type | Description |
---|---|---|
id |
number |
Required. |
fullName |
string |
Optional. |
phoneNumber |
string |
Optional. |
DELETE /api/patients/:id
Parameter | Type | Description |
---|---|---|
id |
number |
Required. |
GET /api/appointments/on/:day
Parameter | Type | Description |
---|---|---|
day |
Date |
Required. Should follow MM-DD-YYYY format. |
GET /api/doctors/appointments/on/:day
Parameter | Type | Description |
---|---|---|
day |
Date |
Required. Should follow MM-DD-YYYY format. |
POST /api/appointments/doctor/:id
Parameter | Type | Description |
---|---|---|
id |
number |
Required. doctor's id. |
day |
Date |
Required. Should follow MM-DD-YYYY format. |
patientId |
number |
Required. |
Create an appointment with the nearest available doctor in the given specialty (Requires Auth & Role: receptionist)
POST /api/appointments/specialty/:id
Parameter | Type | Description |
---|---|---|
id |
number |
Required. specialty's id. |
day |
Date |
Required. Should follow MM-DD-YYYY format. |
patientId |
number |
Required. |
GET /api/appointments/doctor/:id/on/:day
Parameter | Type | Description |
---|---|---|
id |
number |
Required. doctor's id. |
day |
Date |
Required. Should follow MM-DD-YYYY format. |
GET /api/appointments/specialty/:id/on/:day
Parameter | Type | Description |
---|---|---|
id |
number |
Required. specialty's id. |
day |
Date |
Required. Should follow MM-DD-YYYY format. |
GET /api/appointments/nearest/doctor/:id/on/:day
Parameter | Type | Description |
---|---|---|
id |
number |
Required. doctor's id. |
day |
Date |
Required. Should follow MM-DD-YYYY format. |
Get a specialty's nearest available appointment on a specific day (Requires Auth & Role: receptionist)
GET /api/appointments/nearest/specialty/:id/on/:day
Parameter | Type | Description |
---|---|---|
id |
number |
Required. specialty's id. |
day |
Date |
Required. Should follow MM-DD-YYYY format. |
PATCH /api/appointments/:id
Parameter | Type | Description |
---|---|---|
id |
number |
Required. appointment's id. |
day |
Date |
Required. Should follow MM-DD-YYYY format. |
withSameDoctor |
boolean |
Required. Indicate if the patient wants to reschedule with the same doctor or the nearest available doctor in the same specialty. |
DELETE /api/appointments/:id
Parameter | Type | Description |
---|---|---|
id |
number |
Required. appointment's id. |
If you have any feedback, please reach out to me at ahmed.ibrahim.yassen@gmail.com