"Where every convoy moves with intelligence, not intuition"
A comprehensive military convoy management and optimization system designed for the Indian Army. SARATHI (Sanskrit: "charioteer") provides AI-powered route planning, risk zone avoidance, real-time tracking, and intelligent convoy coordination.
- Overview
- Key Features
- Tech Stack
- Quick Start
- Installation
- Configuration
- Usage Guide
- Contributing
- Team
SmartConvoy AI (SARATHI) solves critical challenges in military convoy operations:
- Problem: Inefficient routes, fuel waste, security risks, lack of real-time coordination
- Solution: AI-powered optimization with safety-first routing, risk zone detection, and intelligent merge suggestions
- Impact: 10-30% distance savings, significant fuel cost reduction, enhanced safety through risk avoidance
- Military-Specific: Built for Indian Army convoy operations
- Risk-Aware: Dynamic risk zone detection with automatic safe route alternatives
- AI-Powered: Google Gemini chat assistant for tactical support
- Cost-Transparent: Shows exact savings (₹, liters, km) per convoy
- Full-Stack: Production-ready system, not just a prototype
- Pre-loaded Data: 32 strategic checkpoints across India
- OSRM Integration: Open Source Routing Machine for optimized routes
- Geocoding: Automatic place name to coordinate conversion (Nominatim)
- Multi-Route Analysis: Primary and alternative route comparison
- Distance & Duration: Accurate ETA predictions with baseline comparisons
- Dynamic Risk Detection: Real-time analysis of routes against risk zones
- Safe Alternatives: Automatically suggests safer routes when risks detected
- Visual Comparison: Side-by-side display of original vs safe routes
- Risk Zones Database: Pre-loaded risk areas with severity levels (low/medium/high)
- Geometric Algorithms: Point-to-line segment distance calculations for precision
- Google Gemini Integration: Advanced AI for convoy operations support
- Military Context: Tactical language and professional military terminology
- Real-Time Assistance: Route planning, risk assessment, status updates
- Floating Interface: Always accessible from any page
- Create Convoys: Multi-vehicle convoy creation with priorities
- Add Vehicles: Add to existing convoys without recreation
- Priority Levels: Critical, High, Medium, Low
- Status Tracking: Real-time convoy and vehicle status
- User Isolation: Each user sees only their convoys (JWT-based)
- Merge Analysis: Analyzes two convoys for consolidation potential
- Smart Calculations:
- Destination proximity detection (configurable radius)
- Available capacity analysis (by vehicle type and load)
- Route detour time estimation
- Fuel savings calculation (₹ and liters)
- Multiple Scenarios: Suggests best merge options
- Real-Time Metrics:
- Total distance saved (km)
- Fuel saved (liters)
- Cost saved (₹)
- Conflicts prevented
- Successful merges
- Average efficiency improvement (%)
- Baseline Comparison: Optimized routes vs direct routes
- Cost Model: 0.35 L/km fuel consumption, ₹150/L diesel price
- 32 Pre-loaded Checkpoints across India:
- Military bases (Delhi Cantonment, Bangalore Command, etc.)
- Border posts (Jammu, Guwahati, Jaisalmer, etc.)
- Rest stops (Chandigarh, Patna, Coimbatore, etc.)
- Strategic locations (Leh, Port Blair, Tezpur Air Base, etc.)
- Vehicle Types: Truck, Van, Jeep, Ambulance, Tanker
- Load Types: Medical, Supplies, Ammunition, Fuel, Personnel
- Validation: Load weight cannot exceed capacity
- Status Tracking: Per-vehicle status updates
- Driver Information: Name, registration, load details
- Leaflet.js Integration: High-performance map rendering
- Multiple Layers:
- Convoy markers (color-coded by priority)
- Checkpoint markers (categorized by type)
- Risk zone circles (red warnings)
- Route polylines (blue/green for original/safe)
- Interactive Controls: Zoom, pan, click for details
Backend: FastAPI, Python, PostgreSQL, JWT Frontend: React, Vite, Leaflet.js APIs: OSRM (routing), Nominatim (geocoding)
- Python 3.8+
- Node.js 16+
- PostgreSQL 12+
- Git
# 1. Clone repository
git clone https://github.com/yourusername/smart-convoy-final.git
cd smart-convoy-final
# 2. Backend setup
cd backend
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
# 3. Database setup
psql -U postgres
CREATE DATABASE convoy_db;
\q
psql -U postgres -d convoy_db -f database_schema.sql
# 4. Configure environment
cp .env.example .env
# Edit .env with your database credentials and JWT secret
# 5. Start backend
uvicorn main:app --reload --host 0.0.0.0 --port 8000
# 6. Frontend setup (new terminal)
cd ../convoy-frontend
npm install
npm run devAccess the application:
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- API Docs: http://localhost:8000/docs
git clone https://github.com/yourusername/smart-convoy-final.git
cd smart-convoy-finalcd backend
python -m venv .venv
# Activate virtual environment
# macOS/Linux:
source .venv/bin/activate
# Windows:
.venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtOption 1: PostgreSQL (Recommended)
# Create database
psql -U postgres
CREATE DATABASE convoy_db;
\q
# Run schema
psql -U postgres -d convoy_db -f database_schema.sqlOption 2: Detailed Setup
See POSTGRES_SETUP_GUIDE.md for comprehensive instructions including:
- User creation
- Permission management
- Troubleshooting
- Data verification
The schema automatically loads:
- 32 strategic checkpoints across India
- Service registry entries for demo users
cd convoy-frontend
npm installCreate .env file in backend/ directory:
# Database Configuration
DATABASE_HOST=localhost
DATABASE_PORT=5432
DATABASE_NAME=convoy_db
DATABASE_USER=postgres
DATABASE_PASSWORD=your_password_here
# JWT Authentication
SECRET_KEY=your-super-secret-jwt-key-minimum-32-characters
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=720 # 12 hours
# Server Configuration
HOST=0.0.0.0
PORT=8000
# Google Gemini API (for chat assistant)
GEMINI_API_KEY=your-gemini-api-key-here
# OSRM Server (Optional - uses public server by default)
OSRM_SERVER=http://router.project-osrm.orgGenerate Secure JWT Secret:
python -c "import secrets; print(secrets.token_urlsafe(32))"The frontend automatically connects to http://localhost:8000. To change:
-
Update API base URLs in:
convoy-frontend/src/pages/CreateConvoy.jsxconvoy-frontend/src/pages/Dashboard.jsxconvoy-frontend/src/pages/ConvoyHistory.jsxconvoy-frontend/src/pages/ViewRoute.jsxconvoy-frontend/src/components/ChatAssistant.jsx
-
Or set environment variable:
# In convoy-frontend/.env
VITE_API_BASE_URL=http://your-backend-url:8000Login with Service Number:
- Navigate to http://localhost:5173
- Click "Login"
- Enter service number (e.g.,
SN001) and password - JWT token stored in localStorage (12-hour expiration)
Demo Users (pre-loaded):
- Service:
SN001, Password:password123 - Service:
SN002, Password:password123
The dashboard is your command center:
Analytics Card (top):
- Total distance saved
- Fuel saved (liters)
- Cost saved (₹)
- Conflicts prevented
- Successful merges
- Average efficiency improvement
Interactive Map (center):
- 32 checkpoints (color-coded by type)
- Active convoy markers
- Click checkpoints for details (capacity, status, type)
- Click convoys for quick info
Merge Suggestion Panel (overlay):
- Click "Suggest Merge"
- Select Convoy A and Convoy B
- View analysis results (fuel savings, detour time, capacity)
AI Chat Assistant (bottom-right):
- Floating chat button
- Ask about convoy status, routes, risks
- Military-focused responses
Step-by-Step:
-
Click "New Convoy" or navigate to
/create-convoy -
Enter Convoy Details:
- Convoy Name: "Medical Supply Alpha"
- Priority: Critical/High/Medium/Low
- Source: "New Delhi, India" (or lat,lon)
- Destination: "Mumbai, India" (or lat,lon)
-
Add Vehicles (minimum 1):
- Vehicle Type: truck, van, jeep, ambulance, tanker
- Registration: DL-01-AB-1234
- Driver Name: Raj Kumar
- Load Type: medical, supplies, ammunition, fuel, personnel
- Load Weight: 500 kg
- Capacity: 1000 kg (must be ≥ load weight)
-
Submit:
- Backend geocodes locations (1 sec rate limit)
- Creates convoy and vehicles
- Generates optimized route
- Redirects to convoy history
Tips:
- Use place names (autocomplete coming soon)
- Load cannot exceed capacity (validated)
- Add multiple vehicles before submitting
- Critical priority convoys highlighted in red
Access: Click convoy name in history or navigate to /route/:convoyId
What You'll See:
Map Visualization:
- Blue polyline: Original optimized route
- Green polyline: Safe alternative route (if risks detected)
- Red markers: Risk zone centers (with radius circles)
- Green marker: Start point
- Red marker: End point
- Interactive: zoom, pan, click
Route Metrics:
- Distance (km)
- Estimated Duration (minutes)
- Departure Time
- Estimated Arrival Time
- Risk Status: "Safe" or "Risks Detected - Alternative Suggested"
Vehicle List:
- All vehicles in convoy
- Driver, registration, load details
- Current status per vehicle
Risk Zones (if detected):
- Zone name
- Risk level (low/medium/high)
- Distance from route
- Coordinates
No need to recreate convoys!
- Go to "Convoy History"
- Find your convoy
- Click "Add Vehicle" button
- Fill in vehicle details (same as create convoy)
- Submit
Use Cases:
- Additional supplies needed
- Replacement vehicle
- Convoy expansion
How It Works:
- From dashboard, click "Suggest Merge"
- Select two convoys from dropdowns
- Click "Analyze Merge"
Analysis Includes:
- Destination Proximity: Are destinations close? (5 km default)
- Capacity Available: Can convoy A absorb convoy B's vehicles?
- Detour Time: How much extra time to pick up convoy B?
- Fuel Savings: ₹ and liters saved by combining
Merge Scenarios:
- Best case: Same destination, spare capacity, minimal detour
- Partial merge: Some vehicles can be absorbed
- Not recommended: Incompatible routes or full capacity
SmartConvoy AI (SARATHI) is developed by:
- Sreeya Chand - Backend Development, Architecture
- Samyukthaa M - Backend Development, AI Integration
- Prapti - Database Development and Design
- Aniksha Anithan - Frontend Development, UI/UX, Analytics
Team Delusion
This project is licensed under the MIT License.
MIT License
Copyright (c) 2025 Team Delusion
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
- OpenStreetMap - Map data and Nominatim geocoding
- OSRM (Open Source Routing Machine) - Route optimization engine
- Leaflet.js - Open-source interactive maps
- Google Gemini - AI chat assistant capabilities
- FastAPI - Modern Python web framework
- React - UI component library
- PostgreSQL - Robust relational database
- Indian Army logistics operations
- Military convoy management challenges
- Need for cost-effective, safe route optimization
Please include:
- Environment (OS, Python version, Node version)
- Steps to reproduce
- Expected vs actual behavior
- Screenshots (if applicable)
- Relevant logs
We're always improving! Submit feature requests via GitHub Issues with:
- Use case description
- Expected functionality
- Alternative solutions considered
- Mockups/diagrams (if applicable)