This repository contains the backend implementation of a cab booking application similar to Ola, built using Spring Boot and Java. The backend provides REST APIs for managing users, drivers, cabs, and bookings, ensuring smooth functionality for a cab booking platform.
- User Management: Registration, login, and profile management.
- Driver Management: Registration, driver status updates, and location tracking.
- Cab Booking: Search for available cabs, book rides, and track booking history.
- Backend Framework: Spring Boot
- Programming Language: Java
- Database: MySQL
- Build Tool: Maven
- Others: Hibernate, Spring Data JPA, Spring Security
- Java Development Kit (JDK) 17 or higher
- Maven 3.8+ installed
- MySQL database server
- Git installed on your machine
-
Clone the repository:
git clone <your-repo-url> cd <repository-directory>
-
Configure the application properties:
- Open
src/main/resources/application.properties
. - Update the database credentials:
spring.datasource.url=jdbc:mysql://localhost:3306/cab_booking spring.datasource.username=<your-db-username> spring.datasource.password=<your-db-password>
- Open
-
Build the project:
mvn clean install
-
Run the application:
mvn spring-boot:run
-
Access the application:
- Swagger API Documentation: http://localhost:8080/swagger-ui.html
POST /api/auth/register
- Register a new userPOST /api/auth/login
- User login
GET /api/users/{id}
- Get user profile
POST /api/drivers/register
- Register a new driverPUT /api/drivers/{id}/status
- Update driver statusGET /api/drivers/available
- Get available drivers
POST /api/rides/create
- Create a new bookingGET /api/rides/{id}
- Get booking detailsPUT /api/rides/{id}/cancel
- Cancel a booking
GET /api/home
- Get app home information
users
- Stores user detailsdrivers
- Stores driver detailscabs
- Stores cab detailsbookings
- Stores booking details