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, role-based cab booking backend application developed using Spring Boot to manage customers, drivers, cabs, and bookings through RESTful APIs. The system supports the complete booking lifecycle, including cab booking, cancellation, trip completion, and automated email notifications based on booking status.
The application implements authentication and role-based authorization (ADMIN, DRIVER, CUSTOMER) using Spring Security, along with ownership-based access control to ensure users can access only their own profiles and bookings through secure /me APIs. An Admin module is designed to manage customers, drivers, cabs, and bookings with status-based filtering and search functionality.
The project follows a clean layered architecture (ControllerβServiceβRepositoryβDTO) with validation, global exception handling, pagination, and filtering APIs for scalable backend design. APIs are documented and tested using Swagger UI.
The backend is deployed on Render and integrated with a frontend application generated using Antigravity AI, which is deployed on Vercel.
Backend Live URL: https://easytrip-api-kaeq.onrender.com
Frontend Live URL: https://easytrip-app.vercel.app
This project is suitable for demonstrating real-world backend development concepts such as:
The backend has been enhanced with several industry-level practices:
- Deployment on Render cloud platform
- Integration with a live frontend (Vercel)
- CORS configuration for cross-origin frontend communication
- PostgreSQL production database support
- Docker support for deployment
- Asynchronous email sending
- Environment-based configuration
- Clean service abstraction
- Structured API responses
- Enum-based status management
- Principal-based ownership security
- Centralized validation and exception handling
The project follows a clean layered architecture:
Controller β Service β Repository β Database
Additional layers:
- DTO layer
- Transformer layer
- Security layer
- Email module
- Exception module
- Configuration module
This ensures maintainability, scalability, and separation of concerns.
The application uses Spring Security with session-based authentication.
Security features include:
- Role-based authorization (ADMIN, DRIVER, CUSTOMER)
- Ownership-based access control
- BCrypt password encryption
- Login / Logout
- Change password flow
- Profile status validation
- Principal-based data access
- Protected REST endpoints
Ownership security ensures users can access only their own data using /me APIs.
The system sends automated emails to customers for:
- Booking Confirmation
- Booking Completion
- Booking Cancellation
Emails are generated dynamically using booking data.
Email sending is implemented using JavaMailSender and asynchronous execution.
- 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
- Pagination & Sorting
- 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
| 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)
- Render (Backend hosting)
- Docker
- Antigravity AI generated frontend
- Vercel deployment
- CORS enabled backend APIs
- Postman
- Swagger UI
easetrip
β
βββ src
β βββ main
β β βββ java
β β β βββ com.sajidtech.easytrip
β β β βββ config
β β β βββ controller
β β β βββ dto
β β β βββ emails
β β β βββ enums
β β β βββ exception
β β β βββ model
β β β βββ repository
β β β βββ security
β β β βββ service
β β β βββ transformer
β β β βββ EasytripApplication.java
β β βββ resources
β β βββ static
β β βββ templates
β β βββ application.properties
β β βββ application-dev.properties
β β βββ application-prod.properties
β βββ test
βββ target
βββ .gitattributes
βββ .gitignore
βββ Dockerfile
βββ HELP.md
βββ mvnw
βββ mvnw.cmd
βββ pom.xml
The project supports multiple environment configurations for local development and production deployment.
You can configure them inside application.properties or using environment variables.
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.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect
Steps to run locally:
- Install MySQL
- Create database:
create database easytrip_db;
- Update username and password
- Run Spring Boot application
Render provides PostgreSQL database credentials via environment variables.
Example configuration:
spring.datasource.url=${DB_URL}
spring.datasource.username=${DB_USERNAME}
spring.datasource.password=${DB_PASSWORD}
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=update
Render Environment Variables:
DB_URL=jdbc:postgresql://host:5432/db_name
DB_USERNAME=your_username
DB_PASSWORD=your_password
Steps on Render:
- Create PostgreSQL database
- Copy database credentials
- Add Environment Variables in Render service
- Redeploy backend service
Email notifications are sent using Gmail SMTP.
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
Steps:
- Enable 2-Step Verification in Gmail
- Generate App Password
- Use App Password in configuration
- Restart application
For production deployment, sensitive credentials should always be stored in environment variables instead of hardcoding them in application.properties.
This project is already configured to support environment-based configuration when deployed on Render.
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
β Payment gateway integration
β Ride tracking
β Rating system
β API rate limiting
β Logging & monitoring
β CI/CD pipeline
Er. Mohd Sajid
Java Backend Developer
This project is developed for learning and practice purposes.