You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Smart Transport Operations Platform for fleet, driver, trip, maintenance, fuel, safety, and finance operations.
TransitOps is a role-aware Next.js application built for transport teams that need one place to manage vehicle availability, driver compliance, trip dispatch, maintenance workflows, cost visibility, and operational reports.
Screenshots
The project screenshots are stored in public/img. In the running Next.js app they are served from /img/...; in this README they are referenced with repository-relative paths so they render in GitHub and local Markdown viewers.
Home
Login
Driver Management
Trip Management
Fuel and Expense
Notifications
Core Features
Credential authentication with Auth.js / NextAuth and Prisma-backed user records.
Role-based dashboards for Fleet Manager, Driver, Safety Officer, and Financial Analyst.
Fleet registry with vehicle search, filters, pagination, detail pages, create/edit/delete flows, and status controls.
Driver management with linked user accounts, licensing data, safety score tracking, offboarding, and compliance review.
Trip management with map-assisted source/destination selection, OSRM route distance calculation, trip lifecycle controls, pings, and route visualization.
Maintenance workflow that automatically moves active maintenance vehicles into IN_SHOP and restores availability when work is closed.
Fuel and expense logging for fuel, tolls, and other vehicle costs.
Finance dashboard with acquisition cost, fuel cost, maintenance cost, operating cost, estimated revenue, ROI, fuel efficiency, and exportable CSV/PDF reports.
Notifications center with unread filtering, date filters, and mark-as-read behavior.
Admin panel for fleet managers to view users, update roles, delete users, and review platform stats.
Seed data for demo users, fleet records, trips, costs, maintenance logs, and notifications.
Tech Stack
Layer
Technology
Framework
Next.js 16 App Router
Language
TypeScript
UI
React 19, Tailwind CSS 4, lucide-react, Recharts
Authentication
Auth.js / NextAuth v5 credentials provider
ORM
Prisma 5
Database
PostgreSQL
Validation
Zod
Password hashing
bcryptjs
Mapping and routing
Leaflet loaded on client screens, OpenStreetMap tiles, Nominatim, OSRM
stateDiagram-v2
[*] --> ACTIVE
ACTIVE --> CLOSED: Fleet Manager closes work order
CLOSED --> [*]
Loading
Dispatch Side Effects
sequenceDiagram
actor Manager as Fleet Manager
participant UI as Trip UI
participant API as /api/trips/[id]
participant DB as PostgreSQL via Prisma
participant Notify as Notifications
Manager->>UI: Dispatch draft trip
UI->>API: PATCH status=DISPATCHED
API->>DB: Validate trip transition
API->>DB: Check driver AVAILABLE and license valid
API->>DB: Check vehicle AVAILABLE
API->>DB: Update trip, driver, vehicle in transaction
API->>Notify: Create driver notification
API-->>UI: Updated dispatched trip
Apply migrations locally and regenerate Prisma client.
npx prisma db seed
Seed demo data.
npx prisma studio
Open Prisma Studio for database inspection.
Architecture Plan
Current State
TransitOps is implemented as a monolithic Next.js application with colocated UI routes and API route handlers. Business logic is split between route handlers and shared library modules. PostgreSQL is the source of truth, Prisma enforces schema-level relationships, and Zod handles request validation.
Recommended Near-Term Improvements
Add authentication checks to read endpoints currently marked public in this README, such as vehicle detail, driver detail, maintenance reads, fuel-log reads, costs, and public profile reads if those should not be externally visible.
Consolidate repeated auth/role/error handling by moving more endpoints to the createApiRoute helper.
Add route-handler tests for business rules: dispatch blocking, maintenance status restoration, trip completion odometer validation, and driver offboarding.
Store route geometry from OSRM in Trip.routePolyline during trip creation so trip detail pages can render persisted planned routes.
Add a scheduled notification job for license expiry and maintenance due alerts.
Add audit logs for role changes, trip transitions, vehicle status changes, and driver safety score changes.
Future Architecture Direction
flowchart LR
UI["Next.js Web App"] --> API["Next.js API Layer"]
API --> Services["Domain Service Layer"]
Services --> DB["PostgreSQL"]
Services --> Jobs["Background Jobs\nLicense expiry, maintenance due, anomaly scans"]
Services --> Audit["Audit Log"]
Jobs --> Notify["Notification Service"]
API --> Maps["Map/Routing Adapter\nNominatim + OSRM"]
Services --> Reports["Report Builder\nCSV + PDF"]
Loading
The next clean architecture step is to move business workflows into explicit domain services and keep route handlers thin. This makes the lifecycle rules testable outside HTTP and prepares the project for background jobs, audit trails, and richer analytics.
Security Notes
Passwords are hashed with bcrypt before storage.
Auth sessions use JWT strategy and include role metadata.
Middleware protects primary app routes.
Admin UI and admin APIs are restricted to FLEET_MANAGER.
Several read endpoints currently do not call auth(); review the endpoint catalog before production deployment and lock down reads according to product requirements.
License
Private project. Add a license before public distribution.
About
Smart Transport Operations Platform for fleet, driver, trip, maintenance, fuel, safety, and finance operations.