Therapist Booking Project - GraphQL and TypeScript
This repository contains a Therapist Booking Project built using GraphQL and TypeScript. The project aims to create a platform where users can book appointments with therapists for counseling sessions.
Features
- User authentication and authorization
- Search for available therapists and their specialties
- Schedule and manage therapy appointments
- View upcoming and past appointments
- Rate and review therapists based on their services
Demo
Register users

Login users

Create review (Auth required)

Find all review

User details

Find all users (Admin role required)

Create therapist by admin (Admin role required)

Therapist count

Find therapist by location

Get all therapist appoinemnt (therapist role required)

Change Appoinemnt status by therapist

Getting Started
Prerequisites
Before running this project, make sure you have the following prerequisites installed on your system:
Installation
Clone this repository to your local machine using:
git clone https://github.com/BaseMax/TherapistBookingGraphQLTS.git
Navigate to the project directory:
cd TherapistBookingGraphQLTS
Install the project dependencies:
Using npm:
Or using yarn:
Init Prisma :
npx prisma migrate dev --name init
Configuration
Create a .env file in the root directory and add the following environment variables:
# Set enviornment variable :
DATABASE_URL="postgresql://username:password@localhost:5432/your-database?schema=public"
Configure any other necessary environment variables based on your specific setup.
Usage
To start the development server, run the following command:
Using npm:
Or using yarn:
The server should now be running on http://localhost:3000 (or the port you specified in the .env file). You can access the GraphQL Playground to interact with the API and test various queries and mutations.
GraphQL API
The GraphQL API provides the following endpoints:
POST /graphql: The main endpoint for executing GraphQL queries and mutations.
You can explore the available schema and operations using the GraphQL Playground available at the server's root URL.
GraphQL
GetTherapists: Fetch a list of therapists based on specified filters.
query GetTherapists($specialty: String, $location: String, $available: Boolean) {
therapists(specialty: $specialty, location: $location, available: $available) {
id
name
specialty
location
available
}
}
GetTherapistById: Get details of a specific therapist by their ID.
query GetTherapistById($therapistId: ID!) {
therapist(id: $therapistId) {
id
name
specialty
location
available
reviews {
id
rating
comment
}
}
}
GetAppointments: Fetch a list of appointments for the authenticated user.
query GetAppointments {
appointments {
id
therapist {
id
name
}
date
status
}
}
GetTherapistSpecialties: Fetch a list of all available therapist specialties.
query GetTherapistSpecialties {
therapistSpecialties {
id
name
}
}
GetUser: Get the details of the authenticated user.
query GetUser {
me {
id
name
email
}
}
GetTherapistReviews: Get reviews for a specific therapist.
query GetTherapistReviews($therapistId: ID!) {
therapistReviews(therapistId: $therapistId) {
id
rating
comment
user {
id
name
}
}
}
GetAvailableAppointments: Fetch a list of available appointments for a specific therapist within a given date range.
query GetAvailableAppointments($therapistId: ID!, $startDate: String!, $endDate: String!) {
availableAppointments(therapistId: $therapistId, startDate: $startDate, endDate: $endDate) {
id
therapist {
id
name
}
date
}
}
GetUserAppointments: Fetch a list of appointments for a specific user within a given date range.
query GetUserAppointments($startDate: String!, $endDate: String!) {
userAppointments(startDate: $startDate, endDate: $endDate) {
id
therapist {
id
name
}
date
status
}
}
GetTherapistAvailabilities: Fetch a therapist's weekly schedule and availability.
query GetTherapistAvailabilities($therapistId: ID!) {
therapistAvailabilities(therapistId: $therapistId) {
dayOfWeek
startTime
endTime
}
}
GetTherapistsByLocation: Fetch therapists within a certain radius of a specified location.
query GetTherapistsByLocation($location: String!, $radius: Float!) {
therapistsByLocation(location: $location, radius: $radius) {
id
name
specialty
location
available
}
}
GetUpcomingAppointments: Fetch upcoming appointments for the authenticated user.
query GetUpcomingAppointments {
upcomingAppointments {
id
therapist {
id
name
}
date
status
}
}
GetPastAppointments: Fetch past appointments for the authenticated user.
query GetPastAppointments {
pastAppointments {
id
therapist {
id
name
}
date
status
}
}
GetTherapistsBySpecialty: Fetch therapists specializing in a specific therapy category.
query GetTherapistsBySpecialty($specialty: String!) {
therapistsBySpecialty(specialty: $specialty) {
id
name
specialty
location
available
}
}
GetTherapistCount: Get the total number of registered therapists.
query GetTherapistCount {
therapistCount
}
GetUserReviews: Fetch reviews given by the authenticated user to therapists.
query GetUserReviews {
userReviews {
id
therapist {
id
name
}
rating
comment
}
}
GetUserRatings: Get the average rating and the total number of reviews given by the authenticated user.
query GetUserRatings {
userRatings {
averageRating
totalReviews
}
}
GetTherapistRating: Get the average rating and the total number of reviews for a specific therapist.
query GetTherapistRating($therapistId: ID!) {
therapistRating(therapistId: $therapistId) {
averageRating
totalReviews
}
}
GetUserBookedTherapists: Fetch a list of therapists booked by the authenticated user.
query GetUserBookedTherapists {
userBookedTherapists {
id
name
specialty
location
available
}
}
GetTherapistAvailability: Fetch the availability of a specific therapist for a given date.
query GetTherapistAvailability($therapistId: ID!, $date: String!) {
therapistAvailability(therapistId: $therapistId, date: $date) {
available
startTime
endTime
}
}
GetUserUpcomingTherapists: Fetch a list of therapists for whom the authenticated user has upcoming appointments.
query GetUserUpcomingTherapists {
userUpcomingTherapists {
id
name
specialty
location
available
}
}
GetTherapistSchedules: Fetch the weekly schedules of multiple therapists.