A centralized transport operations platform for logistics teams. Replaces spreadsheets and manual logbooks with a live system for vehicle registration, driver compliance, trip dispatching, maintenance tracking, fuel logs, expenses, and analytics.
Built for the Odoo Hackathon by Team Viraasat.
| Layer | Technology |
|---|---|
| Frontend | React + TypeScript + Vite, Tailwind CSS, Recharts, Lucide Icons |
| Backend | Node.js + Express + TypeScript |
| Database | PostgreSQL 16 (Docker) |
| ORM | Prisma |
| Auth | JWT in HTTP-only cookie, bcrypt password hashing |
| Realtime | Socket.IO |
| Validation | Zod (backend), React Hook Form (frontend) |
| Security | Helmet, CORS, express-rate-limit |
- Node.js ≥ 18
- Docker & Docker Compose
- npm
git clone https://github.com/Team-Viraasat/TransitOps_Odoo_Hackathon.git
cd TransitOps_Odoo_Hackathondocker compose up -dPostgreSQL 16 starts on port 5433 (avoids conflicts with local installs). Verify with:
docker compose ps # should show transitops-db-1 as healthycd api
cp .env.example .env
npm install
npx prisma migrate deploy
npx tsx prisma/seed.ts
npm run devAPI runs at http://localhost:4000. Health check:
curl http://localhost:4000/api/health
# → {"ok":true,"service":"transitops-api"}cd frontend
npm install
npm run devFrontend runs at http://localhost:5173.
Visit http://localhost:5173 and login with any demo account below.
All passwords: password123
| Role | Access | |
|---|---|---|
| Fleet Manager | fleet@transitops.local |
Vehicles, Maintenance |
| Dispatcher | dispatch@transitops.local |
Trips, Fuel, Expenses |
| Safety Officer | safety@transitops.local |
Drivers, Compliance |
| Financial Analyst | finance@transitops.local |
Analytics, CSV Export |
| Admin | admin@transitops.local |
Full access + Settings |
- Login as Dispatcher → see Dashboard KPIs and live vehicle status
- Vehicle Registry → show Available, On Trip, In Shop, Retired statuses
- Drivers → show expired license, suspended, on-trip states
- Create trip with cargo weight above vehicle capacity → dispatch is blocked
- Fix cargo weight and dispatch → vehicle and driver become On Trip
- Dashboard → KPIs update (fleet utilization changes)
- Complete trip with odometer/fuel → statuses restore to Available
- Create maintenance → vehicle becomes In Shop
- Trip Dispatcher → In Shop vehicle is hidden from selection
- Analytics → operational cost, fuel efficiency, ROI, CSV export
- Settings → role permission matrix
POST /api/auth/login— returns JWT in HTTP-only cookiePOST /api/auth/logout— clears cookieGET /api/auth/me— returns current user
GET /api/dashboard/kpis— active vehicles, fleet utilization, etc.GET /api/dashboard/recent-tripsGET /api/dashboard/vehicle-status-breakdown
GET /api/vehicles— paginated, filterable by?search=&type=&status=®ion=GET /api/vehicles/available-for-dispatch— only Available vehiclesGET /api/vehicles/:idPOST /api/vehiclesPATCH /api/vehicles/:idPATCH /api/vehicles/:id/retire
GET /api/drivers— paginated, filterable by?search=&status=&licenseCategory=GET /api/drivers/available-for-dispatch— Available + non-expired licenseGET /api/drivers/:idPOST /api/driversPATCH /api/drivers/:idPATCH /api/drivers/:id/status
GET /api/trips— filterable by?status=&vehicleId=&driverId=GET /api/trips/:idPOST /api/trips— create Draft with optional vehicle/driverPOST /api/trips/:id/dispatch— transactional: validates + updates statusesPOST /api/trips/:id/complete— restores resources, creates fuel logPOST /api/trips/:id/cancel— restores resources if dispatched
GET /api/maintenance— filterable by?vehicleId=&status=POST /api/maintenance— transactional: vehicle → In ShopPATCH /api/maintenance/:idPOST /api/maintenance/:id/close— transactional: vehicle → Available
GET /api/fuel-logs,POST /api/fuel-logsGET /api/expenses,POST /api/expenses
GET /api/analytics/summary— fuel efficiency, costs, revenue, profitGET /api/analytics/fuel-efficiency— per-trip km/LGET /api/analytics/fleet-utilization— vehicle status breakdownGET /api/analytics/operational-cost— fuel + maintenance + otherGET /api/analytics/vehicle-roi— per-vehicle ROI percentageGET /api/analytics/export.csv— live CSV download
GET /api/settings— depot name, currency, rolesPATCH /api/settings
After mutations, the backend emits events so the frontend can refetch:
dashboard:updated · vehicles:updated · drivers:updated · trips:updated · maintenance:updated · fuel:updated · expenses:updated · analytics:updated
| Rule | Enforcement |
|---|---|
| Dispatch is transactional | Vehicle + driver + trip updated atomically |
Vehicle must be Available to dispatch |
Backend rejects with VEHICLE_UNAVAILABLE |
Driver must be Available + valid license |
Backend checks expiry against server date |
| Cargo weight ≤ vehicle capacity | Backend rejects with CAPACITY_EXCEEDED |
| Complete trip restores resources | Vehicle→Available, driver→Available, odometer updated |
| Cancel dispatched trip restores resources | Same as completion |
Active maintenance → vehicle In Shop |
Transactional, blocks duplicate active maintenance |
Close maintenance → vehicle Available |
Unless vehicle is Retired |
| Retired vehicles are permanent | Cannot be dispatched or restored |
| Unique constraints | Registration numbers, license numbers, trip codes |
| RBAC per module | Each role has specific permissions; Admin has full access |
Fuel Efficiency = Total Distance / Total Fuel Consumed (km/L)
Fleet Utilization = Vehicles On Trip / Total Active Vehicles × 100
Operational Cost = Fuel Cost + Maintenance Cost
Vehicle ROI = (Revenue − Maintenance − Fuel) / Acquisition Cost × 100
TransitOps/
├── api/ # Express + TypeScript backend
│ ├── prisma/
│ │ ├── schema.prisma # 10 models, all indexes
│ │ ├── seed.ts # Demo data (30+ records)
│ │ └── migrations/ # PostgreSQL migration
│ └── src/
│ ├── config/env.ts # Zod-validated env
│ ├── db/prisma.ts # Singleton client
│ ├── middleware/ # auth, rbac, validate, error
│ ├── modules/ # auth, vehicles, drivers, trips,
│ │ # maintenance, fuel, expenses,
│ │ # analytics, dashboard, settings
│ ├── realtime/socket.ts # Socket.IO events
│ ├── utils/ # Shared helpers
│ └── server.ts # Entry point
├── frontend/ # React + Vite
│ └── src/
│ ├── app/components/ # UI, screens, layout
│ └── app/lib/ # API hooks, store, types
├── docker-compose.yml # PostgreSQL service
└── README.md