FleetFlow is a full-stack fleet management system built with Django. It provides real-time visibility into vehicle operations, driver management, trip dispatching, expense tracking, and operational analytics β all through a polished, responsive web interface with HTMX-powered interactions.
- Real-time KPI cards: Total Fleet, Available, On Trip, In Maintenance
- Vehicle type & region filters with pending cargo tracking
- Recent activity feed with status-coded trip history
- Full vehicle lifecycle management (Available β On Trip β In Shop β Retired)
- Track name, license plate, type (Truck / Van / Bike), capacity, odometer, acquisition cost, and region
- Modal-based create/edit forms with inline validation
- Retire/reactivate vehicles with audit logging
- Draft β Dispatched β Completed / Cancelled lifecycle
- Create trips with vehicle, driver, origin, destination, cargo weight, and revenue
- Save-time validation: vehicle/driver availability, cargo capacity, license validity, vehicleβdriver category matching
- Edit draft trips; dispatch with instant toast error feedback
- Complete trips with odometer end reading
- HTMX-powered inline row updates without page reload
- Driver profiles with license tracking and expiry warnings (30-day alert)
- Vehicle category certification (Truck / Van / Bike / All)
- Safety score tracking and trip completion rate metrics
- Status management: Available, On Trip, Off Duty, Suspended
- Detail pages with trip history
- Log fuel, toll, and other expenses linked to vehicles and trips
- Vehicleβtrip mismatch validation (ensures expense vehicle matches trip vehicle)
- Three-tab interface:
- Expense Log β all expenses with category filter
- Completed Trips β recent completed trips summary
- Vehicle Costs β per-vehicle fuel and maintenance cost breakdown
- All metrics respect vehicle type and region filters
- Overview tab:
- 4 primary KPIs: Utilization, Revenue, Ops Cost, Net Profit
- 4 secondary metrics: Trips, KM Driven, Avg km/L, Vehicles
- Revenue vs. Cost stacked bar chart per vehicle
- Fleet composition breakdown by vehicle type
- Top 5 Revenue Generators and Most Profitable Vehicles tables
- Vehicle Performance tab:
- Per-vehicle table with distance, fuel, efficiency, revenue, costs, profit, and ROI
- Color-coded fuel efficiency and ROI indicators
- CSV export (restricted to Manager / Analyst roles)
| Role | Permissions |
|---|---|
| Fleet Manager | Full access: create, edit, dispatch, retire, manage drivers, export data |
| Dispatcher | Create/edit trips, log expenses, dispatch vehicles |
| Safety Officer | Manage drivers, log maintenance records |
| Financial Analyst | View analytics, export CSV reports |
- Server-side enforcement via
@role_requireddecorator - UI-level enforcement: action buttons hidden based on user role
- Log maintenance records (Oil Change, Tire Rotation, Brake Service, Engine Repair, Inspection, Other)
- Vehicles auto-transition to In Shop status when maintenance is logged
- Resolve maintenance records; vehicle returns to Available when all records resolved
- Filter by resolved/unresolved status
| Layer | Technology |
|---|---|
| Backend | Django 5.1, Python 3.12 |
| Database | PostgreSQL 16 |
| Frontend | HTMX 1.19, Tailwind CSS (CDN), native <dialog> modals |
| Serving | Gunicorn, WhiteNoise (static files) |
| Containerization | Docker, Docker Compose |
fleetflow/
βββ accounts/ # Custom User model, auth views, RBAC roles
βββ core/ # Dashboard, audit trail, decorators, management commands
βββ fleet/ # Vehicle & Maintenance models, views, forms
βββ drivers/ # Driver model, compliance tracking, status management
βββ operations/ # Trip model, dispatch/complete/cancel services
βββ finance/ # Expense model, fuel tracking, cost analysis
βββ analytics/ # Analytics dashboard, CSV export, data visualizations
βββ templates/ # Django templates (base, partials, modals)
β βββ base.html # Global layout, sidebar, modal system, tab/toast JS
β βββ core/ # Dashboard template
β βββ operations/ # Trip list, detail, form, row partials
β βββ fleet/ # Vehicle & maintenance templates
β βββ drivers/ # Driver templates
β βββ finance/ # Expense templates (tabbed)
β βββ analytics/ # Analytics dashboard (tabbed)
β βββ accounts/ # Login, register, password reset
βββ static/ # Static assets
βββ fleetflow/ # Django project settings, URLs, WSGI
βββ Dockerfile # Production container
βββ docker-compose.yml # Dev environment (PostgreSQL + Django)
βββ requirements.txt # Python dependencies
erDiagram
User ||--o{ Trip : creates
User {
string username
string role
string phone
}
Vehicle ||--o{ Trip : assigned_to
Vehicle ||--o{ Expense : incurs
Vehicle ||--o{ Maintenance : has
Vehicle {
string name
string license_plate
string vehicle_type
decimal capacity
decimal odometer
string region
string status
}
Driver ||--o{ Trip : drives
Driver {
string name
string license_number
date license_expiry
string vehicle_category
decimal safety_score
string status
}
Trip ||--o{ Expense : generates
Trip {
string origin
string destination
decimal cargo_weight
decimal revenue
string status
decimal odometer_start
decimal odometer_end
}
Expense {
string category
decimal cost
decimal liters
date date
}
Maintenance {
string service_type
decimal cost
date date
boolean is_resolved
}
- Python 3.10+
- PostgreSQL 14+ (or use Docker)
- pip or pipenv
# Clone the repository
git clone https://github.com/ayushkaneriya05/FleetFlow.git
cd FleetFlow
# Start PostgreSQL + Django
docker compose up --build
# In another terminal, run migrations and create a superuser
docker compose exec web python manage.py migrate
docker compose exec web python manage.py createsuperuserThe app will be available at http://localhost:8000
# Clone the repository
git clone https://github.com/ayushkaneriya05/FleetFlow.git
cd FleetFlow
# Create and activate virtual environment
python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS/Linux
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Set up PostgreSQL database
# Create a database named 'fleetflow' in PostgreSQL
# Configure environment variables (create .env file)
echo 'export DATABASE_URL="postgresql://postgres:postgres@localhost:5432/fleetflow"' > .env
# Run migrations
python manage.py migrate
# Create a superuser
python manage.py createsuperuser
# Start the development server
python manage.py runserverThe app will be available at http://localhost:8000
| Variable | Default | Description |
|---|---|---|
DATABASE_URL |
β | PostgreSQL connection string (takes priority) |
DB_NAME |
fleetflow |
Database name (fallback) |
DB_USER |
postgres |
Database user (fallback) |
DB_PASSWORD |
postgres |
Database password (fallback) |
DB_HOST |
localhost |
Database host (fallback) |
DB_PORT |
5432 |
Database port (fallback) |
DJANGO_SECRET_KEY |
dev key | Secret key (change in production!) |
DJANGO_DEBUG |
True |
Debug mode |
ALLOWED_HOSTS |
localhost,127.0.0.1 |
Comma-separated allowed hosts |
- Register/Login β Create an account with the Fleet Manager role
- Add Vehicles β Go to Vehicle Registry β Add Vehicle (name, plate, type, capacity, region)
- Add Drivers β Go to Driver Safety β Add Driver (name, license, category, expiry)
- Create a Trip β Go to Trip Dispatch β Create Trip (select vehicle, driver, route, cargo)
- Dispatch β Click the Dispatch button on a Draft trip (validates availability and capacity)
- Complete β Click Complete, enter odometer end reading
- Log Expenses β Go to Expenses & Fuel β Log Expense (link to vehicle and trip)
- View Analytics β Go to Analytics for revenue, costs, fleet utilization, and per-vehicle ROI
FleetFlow uses HTMX for a seamless single-page-like experience:
- Modal forms β All create/edit operations open in a native
<dialog>modal loaded via HTMX - Inline updates β Dispatch, cancel, and status changes update the table row in-place
- Toast notifications β Success/error messages appear as floating toasts via
HX-Triggerheaders - Tab navigation β Client-side tabs for multi-section pages (Finance, Analytics)
| Package | Version | Purpose |
|---|---|---|
Django |
β₯5.1 | Web framework |
psycopg2-binary |
β₯2.9 | PostgreSQL adapter |
django-htmx |
β₯1.19 | HTMX middleware and utilities |
django-widget-tweaks |
β₯1.5 | Template form rendering helpers |
whitenoise |
β₯6.7 | Static file serving in production |
gunicorn |
β₯23.0 | Production WSGI server |
WeasyPrint |
β₯62.0 | PDF report generation |
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Commit your changes:
git commit -m 'Add my feature' - Push to the branch:
git push origin feature/my-feature - Open a Pull Request
This project is open source and available under the MIT License.
Built with β€οΈ by Ayush Kaneriya