Smart Logistics Management System

AI-Powered logistics and route optimization platform built with Spring Boot 3

Java 17 Spring Boot PostgreSQL Docker

What is Smart Logistic?

A production-ready logistics optimization system demonstrating Clean Architecture, Domain-Driven Design, and SOLID principles.

100%

Test Coverage

12

Unit Tests

3

Core Features

REST

API Design

Core Features

🛡️

Capacity Guard

Prevents vehicle overload by validating package weight against remaining capacity before assignment.

totalWeight + currentLoad ≤ capacity
🔄

State Machine

Enforces valid package status transitions to maintain data integrity throughout the delivery lifecycle.

CREATED → LOADED → DELIVERED
🎯

Smart Routing

Automatically optimizes delivery routes by sorting packages based on delivery deadlines.

sorted(deadline ASC)

API Documentation

Vehicles API

GET /api/vehicles

List all vehicles with capacity and status information

GET /api/vehicles/{id}

Get specific vehicle details by ID

POST /api/vehicles

Create a new vehicle with license plate and capacity

Packages API

GET /api/packages

List all packages with delivery status and deadlines

GET /api/packages/unassigned

Get packages that haven't been assigned to any vehicle

PATCH /api/packages/{id}/status

Update package status (validates state machine rules)

Delivery Operations API

POST /api/delivery/assign

Assign packages to vehicle (validates capacity guard)

GET /api/delivery/routes

Get all active delivery routes with package details

PATCH /api/delivery/routes/{id}/complete

Mark a delivery route as completed

Example Request

POST /api/delivery/assign
Content-Type: application/json

{
  "vehicleId": 1,
  "packageIds": [4, 2, 5]
}

Example Response (Success)

{
  "id": 1,
  "vehicleId": 1,
  "vehicleLicensePlate": "ABC-1234",
  "packages": [
    {
      "id": 4,
      "weightKg": 500.0,
      "status": "LOADED",
      "deliveryDeadline": "2025-12-10T13:45:06"
    },
    {
      "id": 2,
      "weightKg": 250.0,
      "status": "LOADED",
      "deliveryDeadline": "2025-12-10T14:45:06"
    }
  ],
  "totalWeight": 950.0
}

Example Response (Capacity Guard Error)

{
  "status": 400,
  "error": "Vehicle Overload",
  "message": "Vehicle 'ABC-1234' cannot load package of 950.00 kg. Remaining capacity: 550.00 kg"
}

Technology Stack

Java 17
Spring Boot 3.2.1
PostgreSQL 16
Spring Data JPA
MapStruct
Lombok
JUnit 5
Docker