A full-stack Vehicle Route Problem (VRP) optimization platform for logistics and delivery management. This application provides real-time fleet tracking, delivery management, route optimization, and analytics reporting.
QOD-ROD/
├── backend/
│ ├── app/
│ │ ├── api/routes/ # API endpoints
│ │ ├── core/ # Config & database
│ │ ├── models/ # SQLAlchemy models
│ │ ├── schemas/ # Pydantic schemas
│ │ ├── services/ # Business logic
│ │ │ ├── analytics_service.py
│ │ │ ├── csv_service.py # CSV upload handling
│ │ │ ├── distance_service.py
│ │ │ └── optimization_service.py
│ │ ├── main.py # FastAPI app entry
│ │ └── seed.py # Database seeding
│ ├── requirements.txt # Python dependencies
│ └── database.db # SQLite database
├── frontend/
│ ├── src/
│ │ ├── components/ # React components
│ │ │ ├── analytics/
│ │ │ ├── common/
│ │ │ ├── dashboard/
│ │ │ ├── deliveries/
│ │ │ ├── fleet/
│ │ │ ├── optimization/
│ │ │ └── tracking/
│ │ ├── pages/ # Page components
│ │ │ ├── Analytics.tsx
│ │ │ ├── Dashboard.tsx
│ │ │ ├── Deliveries.tsx
│ │ │ ├── FleetManagement.tsx
│ │ │ ├── LiveTracking.tsx
│ │ │ └── RouteOptimization.tsx # With CSV upload & map
│ │ ├── services/ # API client services
│ │ │ ├── analytics.ts
│ │ │ ├── api.ts
│ │ │ ├── csvUpload.ts # CSV upload service
│ │ │ ├── deliveries.ts
│ │ │ ├── drivers.ts
│ │ │ ├── optimization.ts
│ │ │ ├── tracking.ts
│ │ │ └── vehicles.ts
│ │ ├── types/ # TypeScript types
│ │ ├── App.tsx # Main app component
│ │ └── main.tsx # Entry point
│ ├── package.json # Node dependencies
│ └── index.html # HTML template
└── README.md
git clone <repository-url>
cd QOD-ROD
cd backend
python -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate
pip install -r requirements.txt
cd ../frontend
npm install
cd backend
uvicorn app.main:app --reload --port 8000
The API will be available at http://localhost:8000
http://localhost:8000/docshttp://localhost:8000/healthcd frontend
npm run dev
The application will be available at http://localhost:5173 (or next available port)
http://localhost:5173)The application includes a default user profile:
GET /api/v1/deliveries - List all deliveriesPOST /api/v1/deliveries - Create new deliveryGET /api/v1/deliveries/{id} - Get delivery detailsPUT /api/v1/deliveries/{id}/status - Update delivery statusGET /api/v1/vehicles - List all vehiclesPOST /api/v1/vehicles - Add new vehicleGET /api/v1/vehicles/positions - Get vehicle positionsGET /api/v1/drivers - List all driversPOST /api/v1/drivers - Add new driverPOST /api/v1/optimization/optimize - Optimize routes for deliveriesPOST /api/v1/optimization/preview - Preview optimization without savingPOST /api/v1/optimization/upload-csv - Upload deliveries via CSV fileGET /api/v1/optimization/csv-template - Download CSV templatePOST /api/v1/optimization/optimize-csv - Optimize routes from CSV deliveriesGET /api/v1/routes - List all routesGET /api/v1/analytics/dashboard - Dashboard statisticsGET /api/v1/analytics/weekly-performance - Weekly delivery dataGET /api/v1/analytics/vehicle-utilization - Fleet utilization metricsGET /api/v1/analytics/trends - Delivery trendsGET /api/v1/tracking/vehicles - Real-time vehicle positionsThe application includes the following main views:
Edit backend/app/main.py to configure allowed origins:
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:5173", "http://localhost:5174"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
Edit frontend/src/services/api.ts to change the backend URL:
const api = axios.create({
baseURL: 'http://localhost:8000/api/v1',
headers: {
'Content-Type': 'application/json',
},
});
cd frontend
npm run build
The production build will be in the dist/ directory.
The backend can be deployed using any ASGI server:
uvicorn app.main:app --host 0.0.0.0 --port 8000
The platform supports bulk importing deliveries via CSV files for route optimization.
Required columns:
customer_name - Customer’s full nameaddress - Delivery addresslatitude - Latitude coordinatelongitude - Longitude coordinateweight_kg - Package weight in kilogramsOptional columns:
customer_phone - Contact phone numberpriority - Priority level (low, normal, high, urgent)time_window_start - Delivery window start time (HH:MM format)time_window_end - Delivery window end time (HH:MM format)customer_name,customer_phone,address,latitude,longitude,weight_kg,priority,time_window_start,time_window_end
John Doe,555-0100,123 Market St San Francisco CA,37.7849,-122.4094,2.5,normal,09:00,17:00
Jane Smith,555-0101,456 Mission St San Francisco CA,37.7855,-122.4057,3.0,high,10:00,16:00
POST /api/v1/optimization/upload-csv
GET /api/v1/optimization/csv-template
POST /api/v1/optimization/optimize-csv
The backend automatically seeds the database with sample data on startup if tables are empty.
This project is open source and available for personal and commercial use.
For issues or questions, please refer to the API documentation at /docs when the backend is running.
Built with React, FastAPI, and Google OR-Tools.