A powerful Java Spring Boot backend for logistics and delivery route optimization.
This project provides comprehensive solutions for vehicle routing, delivery scheduling, and optimization in logistics operations.
- 🗺️ Vehicle Route Optimization: Advanced VRP (Vehicle Routing Problem) solution using GraphHopper and Jsprit libraries
- ⏰ Delivery Scheduling: Time-window based delivery optimization for precise planning
- 📍 Geographic Boundaries: BoundingBox support for delivery zones and territories
- 🔄 RESTful API: Modern REST API endpoints for all operations
| Technology | Purpose |
|---|---|
| Java 17 | Core programming language |
| Spring Boot 3.3.4 | Application framework |
| Spring Data JPA | Data access layer |
| PostgreSQL | Database management |
| Lombok | Boilerplate code reduction |
| GraphHopper (Jsprit) | Route optimization engine |
The project consists of the following components:
Branch: Company branches with geographic coordinatesCustomer: Customer information and delivery detailsVehicle: Delivery vehicles with capacity and typeDispatch: Delivery tasks and assignmentsDispatchVehicle: Vehicle-dispatch relationship mappingBoundingBox: Geographic boundaries for delivery zones
JPA-based data access layer providing basic CRUD operations for all entities.
Services that manage business logic:
BranchService: Branch management operationsCustomerService: Customer data managementVehicleService: Vehicle fleet managementDispatchService: Delivery task managementDispatchVehicleService: Vehicle-dispatch matching and route optimization
OptRoutingProblem: Route problem definition and constraintsRoutingProblemSolver: VRP solver implementationDistanceMatrixService: Distance calculation between locations
Controllers providing RESTful APIs:
BranchController:/branchesendpointsCustomerController:/customersendpointsVehicleController:/vehiclesendpointsDispatchController:/dispatchesendpointsDispatchVehicleController:/dispatch-vehiclesendpoints
- Java 17 or higher
- PostgreSQL database
- Maven
-
Clone the repository:
git clone https://github.com/endmr11/routing_backend.git cd routing_backend -
Configure the database:
- Create a PostgreSQL database named
routing - Update the database configuration in
application.yml:
spring: datasource: url: jdbc:postgresql://localhost:5432/routing username: [your-database-username] password: [your-database-password]
- Create a PostgreSQL database named
-
Build the project:
mvn clean install
-
Launch the application:
mvn spring-boot:run
-
Access the application: The application will be available at http://localhost:8070
| Endpoint | Method | Description |
|---|---|---|
/branches |
GET | List all branches |
/branches |
POST | Create a new branch |
| Endpoint | Method | Description |
|---|---|---|
/customers |
GET | List all customers |
/customers |
POST | Create a new customer |
| Endpoint | Method | Description |
|---|---|---|
/vehicles |
GET | List all vehicles |
/vehicles/{id} |
GET | Get vehicle by ID |
/vehicles |
POST | Create a new vehicle |
| Endpoint | Method | Description |
|---|---|---|
/dispatches |
GET | List all dispatches |
/dispatches/{id} |
GET | Get dispatch by ID |
/dispatches |
POST | Create a new dispatch |
/dispatches/bulk |
POST | Create multiple dispatches |
| Endpoint | Method | Description |
|---|---|---|
/dispatch-vehicles |
GET | List all vehicle-dispatch mappings |
/dispatch-vehicles/{id} |
GET | Get vehicle-dispatch by ID |
/dispatch-vehicles |
POST | Create a new vehicle-dispatch mapping |
/dispatch-vehicles/route/{id} |
GET | Calculate optimal route for a specific vehicle-dispatch mapping |
The system implements a VRP (Vehicle Routing Problem) solution using the GraphHopper Jsprit library. The algorithm considers the following constraints:
- ⏱️ Delivery time windows
- 🗺️ Geographic delivery zones
- 🚛 Vehicle capacities
- 📏 Distance optimization
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Create Problem │────▶│ Calculate │────▶│ Solve Using │
│ Definition │ │ Distance Matrix │ │ Jsprit Engine │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │
│ ▼
┌─────────────────┐ ┌─────────────────┐
│ Define │ │ Generate │
│ Constraints │ │ Optimal Routes │
└─────────────────┘ └─────────────────┘
This project is licensed under the MIT License - see the LICENSE file for details.