EasyTrip is a secure, role-based RESTful backend application built using Spring Boot for a cab booking system. It provides APIs to manage authentication, customers, drivers, cabs, and bookings with support for secure login, ownership-based access, and admin controls.
EasyTrip is a secure and scalable backend RESTful web application developed using Spring Boot for managing a complete cab booking system. The application is designed around dedicated dashboards for Customer, Driver, and Admin, with strict authentication and role-based authorization applied across all APIs. Customers can manage their profiles and book cabs, drivers can handle trip execution and booking status updates, and administrators can monitor and control customers, drivers, cabs, and bookings efficiently. All user operations are protected through ownership-based access control, ensuring that each user can access only their own data and related bookings.
The project follows a clean layered architecture using Controller, Service, Repository, DTO, and Transformer layers to ensure maintainability, scalability, and readability. Centralized exception handling provides consistent and structured error responses. Swagger UI is integrated for interactive API documentation and testing. The system also implements essential security features such as password encryption (BCrypt), login/logout mechanisms, change password and forgot password flows, along with status-based entity management (ACTIVE, INACTIVE, CONFIRMATION, COMPLETED, CANCELLED, etc.), reflecting real-world cab booking workflows.
This project is suitable for demonstrating real-world backend development concepts such as:
- RESTful API design
- DTO based architecture
- Entity to DTO transformation
- Spring Security integration
- Role based authorization (Admin, Driver, Customer)
- Ownership security (user can access only his own data)
- Validation annotations
- Service layer separation
- Interface-based services
- Global exception handling
- Status-based filtering using Enums
- Clean layered architecture (Controller, Service, Repository, Model)
- Swagger UI for API documentation
The application sends email notifications to customers for:
-
Booking Confirmation
-
Booking Completion
-
Booking Cancellation
Email templates are generated dynamically based on booking status.
| Role | Access |
|---|---|
| CUSTOMER | Own profile, own bookings, cab search |
| DRIVER | Own profile, assigned bookings, cab qureries |
| ADMIN | Full system access |
β Ownership security is applied using logged-in user identity
β No user can access another user's data
β /me APIs are used instead of {id}
Every customer or driver API uses the logged-in userβs Principal email to fetch only that userβs own data.
This ensures:
β Prevents ID tampering
β Only owners see their own bookings
β Admin has privileged access
- All protected APIs require session authentication.
β Signup with Role (Customer / Driver only)
β Login User
β Logout User
β Change Password
β BCrypt password encryption
β Role based access (ADMIN / DRIVER / CUSTOMER)
β Profile status check (ACTIVE / INACTIVE)
β Ownership based security (user can access only own data)
π§Ύ Customer Profile
β Create customer profile
β View own profile
β Update profile
β Deactivate (inactive) profile
π Customer Booking Window
β View all bookings
β View active booking
β View completed bookings
β View cancelled bookings
β Book cab
β Update booking
β Cancel booking
π Cab Availability
β Check available cabs
π€ Driver Profile
β Create driver profile
β View own profile
β Update profile
β Deactivate (inactive) profile
π Driver Booking Window
β View all assigned bookings
β View active booking
β View completed bookings
β View cancelled bookings
β Complete booking (trip end)
π Driver Cab Queries
β Register cab
β Update cab details
β Get own cab details
π₯ Customer Management
β View all customers
β View active customers
β View inactive customers
β Find customer by ID
β Search customers by gender & age
β Search customers by age greater than
β Activate customer profile
β Inactivate customer profile
π Driver Management
β View all drivers
β View active drivers
β View inactive drivers
β Find driver by ID
β Activate driver profile
β Inactivate driver profile
π Cab Management
β View all listed cabs
β View active cabs
β View inactive cabs
β View available cabs
β View unavailable cabs
β Find cab by ID
π Booking Management
β View all bookings
β Find booking by ID
β Get bookings by customer
β Get bookings by driver
β View active bookings
β View completed bookings
β View cancelled bookings
- Java
- Spring Boot
- Spring Security
- Spring MVC
- Spring Data JPA
- Hibernate ORM
- MySQL Database / H2 (optional)
- JavaMailSender (email)
- RESTful APIs
- Maven
- Lombok
- Postman / Swagger (for testing)
easetrip
β
βββ .idea
βββ .mvn
β
βββ src
β βββ main
β β βββ java
β β β βββ com.sajidtech.easytrip
β β β βββ config
β β β βββ controller
β β β βββ dto
β β β βββ emails
β β β βββ enums
β β β βββ exception
β β β βββ model
β β β βββ repository
β β β βββ security
β β β βββ service
β β β βββ transformer
β β β βββ EasytripApplication.java
β β β
β β βββ resources
β β βββ static
β β βββ templates
β β βββ application.properties
β β
β βββ test
β
βββ target
β
βββ .gitattributes
βββ .gitignore
βββ HELP.md
βββ mvnw
βββ mvnw.cmd
βββ pom.xml
Configure database in application.properties:
spring.datasource.url=jdbc:mysql://localhost:3306/easytrip_db
spring.datasource.username=root
spring.datasource.password=your_password
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username=your_email@gmail.com
spring.mail.password=your_app_password
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
1οΈ. Clone repository
git clone https://github.com/mohdsajid9600/easetrip-app.git
2οΈ. Open project in IntelliJ / Eclipse
3. Configure database in application.properties
4. Run the application
5. Go to project directory
cd easetrip-app
6. Build project
mvn clean install
7. Run application
mvn spring-boot:run
http://localhost:8080
Use Postman or Swagger UI to test APIs.
| Method | Endpoint | Description |
|---|---|---|
| POST | /auth/signup |
Signup user with role (CUSTOMER / DRIVER only) |
| POST | /auth/login |
Login user |
| POST | /auth/logout |
Logout current user |
| PUT | /auth/change-password |
Change logged-in user password |
π§Ύ Customer Profile
| Method | Endpoint | Description |
|---|---|---|
| POST | /customer/create-profile |
Create customer profile |
| GET | /customer/me |
Get logged-in customer profile |
| PUT | /customer/me/update |
Update customer profile |
| DELETE | /customer/me |
Deactivate customer profile |
π Customer Booking Windows
| Method | Endpoint | Description |
|---|---|---|
| GET | /booking/customer |
Get all bookings of logged-in customer |
| GET | /booking/customer/active |
Get active booking |
| GET | /booking/customer/completed |
Get completed bookings |
| GET | /booking/customer/cancelled |
Get cancelled bookings |
| POST | /booking/customer/booked |
Book a cab |
| PUT | /booking/customer/update |
Update booking |
| PUT | /booking/customer/cancel |
Cancel booking |
π Cabs Availability
| Method | Endpoint | Description |
|---|---|---|
| GET | /cab/available |
Get all available cabs |
π€ Driver Profile
| Method | Endpoint | Description |
|---|---|---|
| POST | /driver/register |
Create driver profile |
| GET | /driver/me |
Get logged-in driver profile |
| PUT | /driver/me/update |
Update driver profile |
| DELETE | /driver/me |
Deactivate driver profile |
π Driver Booking Windows
| Method | Endpoint | Description |
|---|---|---|
| GET | /booking/driver |
Get all bookings assigned to driver |
| GET | /booking/driver/active |
Get active booking |
| GET | /booking/driver/completed |
Get completed bookings |
| GET | /booking/driver/cancelled |
Get cancelled bookings |
| PUT | /booking/driver/complete |
Complete booking (trip finished) |
π Driver Cab Queries
| Method | Endpoint | Description |
|---|---|---|
| POST | /cab/driver/register |
Register cab |
| PUT | /cab/driver/update |
Update cab details |
| GET | /cab/driver |
Get own cab details |
π‘οΈ Admin β Customer Fetch APIs
| Method | Endpoint | Description |
|---|---|---|
| GET | /admin/customers |
Get all customers |
| GET | /admin/customers/active |
Get active customers |
| GET | /admin/customers/inactive |
Get inactive customers |
| GET | /admin/customer/search |
Search customer by id |
| GET | /admin/customers/search |
Search customers by gender & age |
| GET | /admin/customers/search/greater |
Search customers by age greater than |
| PUT | /admin/customer/{id}/active |
Activate customer |
| PUT | /admin/customer/{id}/inactive |
Inactivate customer |
π‘οΈ Admin β Driver Fetch APIs
| Method | Endpoint | Description |
|---|---|---|
| GET | /admin/drivers |
Get all drivers |
| GET | /admin/drivers/active |
Get active drivers |
| GET | /admin/drivers/inactive |
Get inactive drivers |
| GET | /admin/driver/search |
Search driver by id |
| PUT | /admin/driver/{id}/active |
Activate driver |
| PUT | /admin/driver/{id}/inactive |
Inactivate driver |
π‘οΈ Admin β Cab Fetch APIs
| Method | Endpoint | Description |
|---|---|---|
| GET | /admin/cabs |
Get all cabs |
| GET | /admin/cabs/active |
Get active cabs |
| GET | /admin/cabs/inactive |
Get inactive cabs |
| GET | /admin/cabs/available |
Get available cabs |
| GET | /admin/cabs/unavailable |
Get unavailable cabs |
| GET | /admin/cab/search |
Search cab by id |
π‘οΈ Admin β Booking Fetch APIs
| Method | Endpoint | Description |
|---|---|---|
| GET | /admin/bookings |
Get all bookings |
| GET | /admin/bookings/active |
Get active bookings |
| GET | /admin/bookings/complete |
Get completed bookings |
| GET | /admin/bookings/cancel |
Get cancelled bookings |
| GET | /admin/bookings/driver |
Get bookings by driver |
| GET | /admin/bookings/customer |
Get bookings by customer |
| GET | /admin/booking/search |
Search booking by id |
β JWT Authentication
β Swagger Documentation
β Ride Tracking
β Rating System
β Payment Gateway Integration
β Frontend (React)
Er. Mohd Sajid
Java Backend Developer
This project is developed for learning and practice purposes.