This service powers intelligent shipment routing, assignment, fleet matching, and delivery monitoring — driven by Kafka and Django.
- route_optimizer/: Optimizes delivery routes (independent service)
- fleet/: Manages vehicle data and availability
- assignment/: Assigns optimized routes to vehicles
- scheduler/: Triggers assignment logic periodically (future: Celery/Lambda)
- monitoring/: Logs delivery issues, performance (optional)
- shipments/: Manages shipment lifecycle
- map_service/ (optional): Calculates real-world distances via OpenRouteService or dummy matrix
git clone https://github.com/IASSCMS/Logistics.git
cd Logistics# .env
DJANGO_PORT=8000
KAFKA_BROKER_URL=kafka:9092
LOGISTICS_SERVICE_PORT=8002docker-compose up --buildThis spins up:
- Django app
- Kafka + Zookeeper
- Swagger docs: http://localhost:8002/swagger/
- Admin panel: http://localhost:8002/admin/
docker-compose run --rm logistics-service python manage.py testpython3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activatepip install -r requirements.txtSet these in .env or shell:
KAFKA_BROKER_URL=localhost:9092python manage.py migratepython manage.py runserverThis app connects to Kafka topic orders.created via kafka-python.
Kafka is provided via confluentinc/cp-kafka in docker-compose.yml.
- Send test events using
publish_mock_event.py - Consumer listens via
shipments.consumers.order_events
logistics/
├── logistics_core/ # Django project
├── fleet/ # Vehicle models & APIs
├── shipments/ # Shipment status, tracking
├── assignment/ # Route-to-vehicle mapping
├── monitoring/ # Logs, dashboard, alerts
├── route_optimizer/ # Standalone optimization engine
├── manage.py
├── Dockerfile
├── entrypoint.sh
├── docker-compose.yml
└── requirements.txt
Once server is running:
- Swagger UI: http://localhost:8002/swagger/
- Redoc: http://localhost:8002/redoc/
Create one manually:
python manage.py createsuperuserOr inside Docker:
docker-compose exec logistics-service python manage.py createsuperuser