A comprehensive web application for Truck-Routing-System and management, built with Django backend and React frontend. This application helps businesses optimize delivery routes, manage customers, and visualize route planning on interactive maps.
Route Planning: Advanced algorithm for optimizing delivery routes Customer Management: Add, edit, delete, and bulk import customers via CSV Interactive Maps: Real-time route visualization using Leaflet maps Truck Management: Manage fleet vehicles and their capacities Dashboard Analytics: Comprehensive statistics and performance metrics User Authentication: Secure login/signup system with JWT tokens
Data Entry: Bulk customer import via CSV, individual customer management Routes Planning: Generate optimized routes based on customer locations View Routes: Interactive map visualization with route details Dashboard: Overview of key metrics and statistics
Python: 3.x Django: 5.2.3 Django REST Framework: For API endpoints JWT Authentication: Secure user authentication CORS: Cross-origin resource sharing
React: 19.1.0 Vite: 6.3.5 (Build tool) React Router DOM: 7.6.2 (Routing) Axios: 1.10.0 (HTTP client) Leaflet: 1.9.4 (Interactive maps) React Leaflet: 5.0.0 (React wrapper for Leaflet) React Hook Form: 7.57.0 (Form management) React Toastify: 11.0.5 (Notifications) Papa Parse: 5.5.3 (CSV parsing) React CountUp: 6.5.3 (Animated counters) React Icons: 5.5.0 (Icon library)
Before running this application, make sure you have the following installed:
Node.js: 18.x or higher Python: 3.8 or higher pip: Python package manager Git: Version control system
bash git clone cd VehicleRoutingWeb_v2final
bash python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
bash
pip install django==5.2.3 pip install djangorestframework pip install django-cors-headers pip install djangorestframework-simplejwt pip freeze > requirements.txt
bash python manage.py makemigrations python manage.py migrate
bash python manage.py createsuperuser
bash python manage.py runserver 0.0.0.0:8000
bash cd frontend
bash npm install
Create a .env file in the frontend directory with the following variables: env VITE_LOGIN_URL=http://localhost:8000/api VITE_GETCUST_URL=http://localhost:8000/api/customers/ VITE_ADDCUST_URL=http://localhost:8000/api/add-customer/ VITE_DELETECUST_URL=http://localhost:8000/api/delete-customer/ VITE_UPDATECUST_URL=http://localhost:8000/api/update-customer/ VITE_WAREHOUSE_URL=http://localhost:8000/api/warehouse/ VITE_ROUTEPLAN_URL=http://localhost:8000/api/route-plan/
bash npm run dev
VehicleRoutingWeb_v2final/ βββ frontend/ # React frontend application β βββ public/ # Static assets β βββ src/ β β βββ Components/ # React components β β β βββ Dashboard.jsx β β β βββ DataEntry.jsx β β β βββ LoginForm.jsx β β β βββ Map.jsx β β β βββ RoutesPlanning.jsx β β β βββ ViewRoutes.jsx β β βββ App.jsx # Main application component β β βββ Api.jsx # API configuration β βββ package.json # Frontend dependencies β βββ vite.config.js # Vite configuration βββ .venv/ # Python virtual environment βββ requirements.txt # Python dependencies βββ README.md # This file
The Django backend provides the following API endpoints:
POST /api/login/ - User login POST /api/signup/ - User registration POST /api/logout/ - User logout GET /api/customers/ - Get all customers POST /api/add-customer/ - Add new customer PUT /api/update-customer - Update customer DELETE /api/delete-customer - Delete customer POST /api/warehouse/ - Update warehouse location GET /api/route-plan/ - Get route planning data
Access the application at http://localhost:5173 Register a new account or login with existing credentials
Navigate to "Data Entry" section Add customers individually or bulk import via CSV Configure warehouse location and truck information
Go to "Routes Planning" section Generate optimized routes based on customer data View route statistics and analytics
Access "View Routes" for interactive map visualization Select different days and trucks to view specific routes Analyze route performance and metrics
csv Customer ID,Business Name,Latitude,Longitude,Google Maps Link CUST001,ABC Company,23.037227,72.560194,https://maps.google.com/...
csv Truck Id,Name,Number,Owner name TRUCK001,Truck A,TR001,John Doe
VITE_LOGIN_URL: Backend authentication endpoint VITE_GETCUST_URL: Customer data retrieval endpoint VITE_ADDCUST_URL: Add customer endpoint VITE_DELETECUST_URL: Delete customer endpoint VITE_UPDATECUST_URL: Update customer endpoint VITE_WAREHOUSE_URL: Warehouse management endpoint VITE_ROUTEPLAN_URL: Route planning endpoint
bash cd frontend npm run build
bash
pip install gunicorn pip install whitenoise
Note: Make sure both the Django backend and React frontend are running simultaneously for the application to work properly.