Repository navigation
API Endpoints Draft
The Medical Booking System will use a REST API for communication between the React frontend and the backend.
The API will use HTTP methods such as:
- GET — retrieve data
- POST — create new data
- PUT/PATCH — update existing data
- DELETE — remove or cancel data
The main API base URL will be:
/api
The following endpoints represent the initial API design.
POST
/api/auth/register
Creates a new user account.
{
"name": "Ana Bardanashvili",
"email": "ana@example.com",
"password": "password123"
}{
"message": "User registered successfully",
"user": {
"id": 1,
"name": "Ana Bardanashvili",
"email": "ana@example.com"
}
}POST
/api/auth/login
Authenticates an existing user.
{
"email": "ana@example.com",
"password": "password123"
}{
"message": "Login successful",
"user": {
"id": 1,
"name": "Ana Bardanashvili",
"email": "ana@example.com"
}
}After successful authentication, the backend will set the JWT authentication token in an HttpOnly cookie.
GET
/api/doctors
Returns a list of available doctors.
{
"doctors": [
{
"id": 1,
"name": "Nino Beridze",
"specialty": "Cardiologist",
"experience": 10
},
{
"id": 2,
"name": "Giorgi Maisuradze",
"specialty": "Dermatologist",
"experience": 7
}
]
}This endpoint can later support filtering by medical specialty.
GET
/api/doctors/:id
Returns detailed information about a specific doctor and available appointment slots.
/api/doctors/1
{
"id": 1,
"name": "Nino Beridze",
"specialty": "Cardiologist",
"experience": 10,
"bio": "Cardiologist with 10 years of professional experience.",
"availableSlots": [
"2026-10-01T10:00:00",
"2026-10-01T11:00:00",
"2026-10-02T14:00:00"
]
}POST
/api/appointments
Creates a new medical appointment for an authenticated user.
{
"doctorId": 1,
"date": "2026-10-01",
"time": "10:00",
"reason": "Regular consultation"
}{
"message": "Appointment booked successfully",
"appointment": {
"id": 101,
"doctorId": 1,
"date": "2026-10-01",
"time": "10:00",
"status": "confirmed"
}
}This endpoint will require authentication.
GET
/api/appointments
Returns the appointments belonging to the currently authenticated user.
{
"appointments": [
{
"id": 101,
"doctor": "Nino Beridze",
"specialty": "Cardiologist",
"date": "2026-10-01",
"time": "10:00",
"status": "confirmed"
}
]
}This endpoint will require authentication.
DELETE
/api/appointments/:id
Cancels an existing appointment belonging to the authenticated user.
/api/appointments/101
{
"message": "Appointment cancelled successfully"
}This endpoint will require authentication.
- POST
/api/auth/register - POST
/api/auth/login
- GET
/api/doctors - GET
/api/doctors/:id
- POST
/api/appointments - GET
/api/appointments - DELETE
/api/appointments/:id
The API design can be expanded during development if additional functionality is required.