A comprehensive Spring Boot backend system for a cab booking application with RESTful APIs. This project is Hacktoberfest 2025 friendly and welcomes contributions from developers of all skill levels!
This repository is participating in Hacktoberfest 2025! We welcome contributions from developers worldwide. Whether you're a beginner or an experienced developer, there are opportunities for everyone.
- Check our Issues for
hacktoberfestlabeled tasks - Look for issues tagged with
good first issueif you're a beginner - Comment on an issue to get it assigned to you
- Fork the repository and create your feature branch
- Make your changes and test them thoroughly
- Submit a Pull Request with a clear description
- 🐛 Bug Fixes: Help us identify and fix bugs
- ✨ New Features: Add exciting new functionality
- 📚 Documentation: Improve documentation and add examples
- 🧪 Testing: Write unit and integration tests
- 🎨 UI/UX: Enhance API design and user experience
- 🚀 Performance: Optimize code and database queries
- User Management: Registration, login, and profile management for customers, drivers, and admins
- Driver Management: Driver registration, verification, location tracking, and availability management
- Cab Management: Vehicle registration, status tracking, and cab assignment
- Booking System: Ride booking, driver assignment, real-time tracking, and payment processing
- Location Services: Real-time location tracking and history for drivers and rides
- Authentication & Authorization: Secure API endpoints with role-based access control
- Data Validation: Comprehensive input validation and error handling
- Framework: Spring Boot 3.2.0
- Language: Java 17
- Database: H2 (for development), MySQL (for production)
- Security: Spring Security with JWT
- ORM: Spring Data JPA with Hibernate
- Build Tool: Maven
- Testing: JUnit 5, Spring Boot Test
src/
├── main/
│ ├── java/
│ │ └── com/cabbooking/
│ │ ├── CabBookingSystemApplication.java
│ │ ├── config/ # Configuration classes
│ │ ├── controller/ # REST Controllers
│ │ ├── dto/ # Data Transfer Objects
│ │ ├── entity/ # JPA Entities
│ │ ├── exception/ # Exception handling
│ │ ├── repository/ # Data repositories
│ │ └── service/ # Business logic services
│ └── resources/
│ ├── application.properties
│ └── application-test.properties
└── test/
└── java/
└── com/cabbooking/ # Test classes
POST /api/users/register- Register new userPOST /api/users/login- User loginGET /api/users/{id}- Get user by IDPUT /api/users/{id}- Update userDELETE /api/users/{id}- Delete user
POST /api/drivers- Register new driverGET /api/drivers/available- Get available driversGET /api/drivers/nearby- Find nearby driversPUT /api/drivers/{id}/status- Update driver statusPUT /api/drivers/{id}/location- Update driver location
POST /api/cabs- Register new cabGET /api/cabs/available- Get available cabsGET /api/cabs/type/{cabType}- Get cabs by typePUT /api/cabs/{id}/status- Update cab status
POST /api/bookings- Create new bookingGET /api/bookings/{id}- Get booking detailsPUT /api/bookings/{bookingId}/assign-driver/{driverId}- Assign driverPUT /api/bookings/{bookingId}/status- Update booking statusGET /api/bookings/pending- Get pending bookings
POST /api/locations- Log location dataGET /api/locations/driver/{driverId}- Get driver location historyGET /api/locations/booking/{bookingId}- Get booking location history
- Java 17 or higher
- Maven 3.6+
- Docker & Docker Compose
- IDE (IntelliJ IDEA, Eclipse, or VS Code)
-
Clone the repository
git clone <repository-url> cd cab-booking-system
-
Start MySQL Database
cd docker docker-compose up -d mysqlOr from project root:
docker-compose -f docker/docker-compose.yml up -d mysql
-
Build the project
mvn clean install
-
Run the application
mvn spring-boot:run
-
Access the application
- API Base URL:
http://localhost:8080/cab-booking-api
- API Base URL:
mvn test- User: Customer, driver, and admin user accounts
- Driver: Driver-specific information and verification status
- Cab: Vehicle information and current status
- Booking: Ride booking details and tracking
- LocationLog: Real-time location tracking data
- One User can be one Driver (one-to-one)
- One Driver has one Cab (one-to-one)
- One User can have multiple Bookings (one-to-many)
- One Driver can have multiple Bookings (one-to-many)
- One Driver can have multiple LocationLogs (one-to-many)
- Database: MySQL 8.0 (via Docker Compose)
- Migration: This project uses Flyway for database schema version management
- Migration scripts are located in
src/main/resources/db/migration/ - Flyway automatically runs migrations on application startup
- Schema is created by Flyway, JPA only validates (ddl-auto=validate)
- Migration scripts are located in
- JWT-based authentication
- Role-based authorization (CUSTOMER, DRIVER, ADMIN)
- CORS enabled for frontend integration
- Default: Development profile with H2 database
- Test: Test profile for running unit tests
- Production: Production profile (configure database URL and credentials)
curl -X POST http://localhost:8080/cab-booking-api/api/users/register \
-H "Content-Type: application/json" \
-d '{
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com",
"phoneNumber": "1234567890",
"password": "password123",
"role": "CUSTOMER"
}'curl -X POST http://localhost:8080/cab-booking-api/api/bookings \
-H "Content-Type: application/json" \
-d '{
"user": {"id": 1},
"pickupAddress": "123 Main St",
"pickupLatitude": 40.7128,
"pickupLongitude": -74.0060,
"dropoffAddress": "456 Oak Ave",
"dropoffLatitude": 40.7589,
"dropoffLongitude": -73.9851,
"requestedCabType": "SEDAN",
"requestedTime": "2024-01-15T10:30:00"
}'curl "http://localhost:8080/cab-booking-api/api/drivers/nearby?latitude=40.7128&longitude=-74.0060&radiusKm=5"We love contributions! This project follows the Contributor Covenant Code of Conduct.
-
Fork the repository
git clone https://github.com/your-username/cab-booking-system.git cd cab-booking-system -
Create a feature branch
git checkout -b feature/your-feature-name
-
Set up the development environment
mvn clean install mvn spring-boot:run -Dapp.profiles=dev
-
Make your changes and test
mvn test -
Commit your changes
git commit -am 'Add: your feature description' -
Push to your fork
git push origin feature/your-feature-name
-
Create a Pull Request
- Go to the original repository
- Click "New Pull Request"
- Provide a clear description of your changes
- Code Style: Follow Java naming conventions and Spring Boot best practices
- Testing: Add unit tests for new features and bug fixes
- Documentation: Update README and add JavaDoc comments
- Commit Messages: Use clear, descriptive commit messages
- Pull Requests: Include a detailed description and reference any related issues
Contributors will be:
- Added to our contributors list
- Mentioned in release notes
- Eligible for special recognition during Hacktoberfest
- 💬 Discussions: Use GitHub Discussions for questions and ideas
- 🐛 Bug Reports: Create an Issue with the bug template
- 💡 Feature Requests: Use the feature request template in Issues
- 📧 Contact: Reach out to maintainers for any questions
This project is licensed under the MIT License - see the LICENSE file for details.
- Thanks to all contributors who help make this project better
- Inspired by real-world cab booking systems and best practices
If you find this project helpful, please consider:
- ⭐ Starring the repository
- 🍴 Forking it for your own projects
- 📢 Sharing it with others
- 🤝 Contributing to make it even better!