An enterprise-grade, full-stack logistics and transport operations management platform engineered for end-to-end fleet visibility, automated dispatch orchestration, driver compliance management, and financial operational intelligence.
- Overview
- System Architecture
- Key Features
- Role-Based Access Control (RBAC)
- Technology Stack
- Project Screenshots
- Project Structure
- Prerequisites
- Installation & Quickstart
- Environment Configuration
- Authentication Setup (Clerk)
- Database Setup (Supabase & PostgreSQL)
- Available Scripts
- Security & Resilience Design
- Roadmap & Future Improvements
- Author & Acknowledgments
- License
TransitOps is designed to solve real-world challenges in transport operations: fragmented vehicle tracking, scheduling conflicts, unmonitored maintenance downtime, regulatory compliance oversights, and unpredictable operational costs.
The platform bridges real-time fleet operations with database-enforced business constraints. Critical rulesโsuch as preventing cargo weight overloads, blocking expired driver licenses during dispatch, automatically updating vehicle availability states, and generating fuel logs on trip completionโare enforced at the PostgreSQL layer via triggers and Row Level Security (RLS), guaranteeing data integrity across all access paths.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ React 19 Frontend (Vite) โ
โ โ
โ [Dashboard] [Vehicles] [Drivers] [Trips] [Dispatch] โ
โ [Maintenance] [Expenses] [Reports & Analytics] [Settings] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโ
โผ โผ
useSupabase() Hook Theme & UI Context
(Clerk Session + JWT) (Dark / Light Modes)
โ
โผ
Central Service Layer
(src/services/database.js)
(src/services/fleetService.js)
- Generic CRUD operations
- Local storage resilience fallback
โ
โผ (Authenticated PostgREST Client)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Supabase PostgreSQL 15+ โ
โ โ
โ โข Row Level Security (RLS) policies per Role โ
โ โข Helper Functions: current_user_id(), current_user_role() โ
โ โข Triggers: โ
โ - handle_trip_status_changes() โ
โ - handle_maintenance_status_changes() โ
โ โข Tables: profiles, vehicles, drivers, trips, โ
โ maintenance_logs, fuel_logs, expenses โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- Asset Registry: Track registration numbers, vehicle types (Truck, Van, Mini, Bus), maximum load capacities, odometer readings, and acquisition costs.
- Automated Status Lifecycle: Dynamic states (
Available,On Trip,In Shop,Retired) driven by dispatch and maintenance events. - Search & Filtering: Real-time filtering by status, vehicle type, and operational region.
- Compliance Registry: Manage CDL license numbers, categories (A, B, C), expiration dates, and contact details.
- Safety Scoring: Track operator safety performance (0โ100 index).
- Automated Dispatch Lock: PostgreSQL triggers reject dispatch attempts for suspended drivers or operators with expired licenses.
-
Trip Lifecycle Machine: Seamless state progression (
Draft$\rightarrow$ Dispatched$\rightarrow$ Completed$\rightarrow$ Cancelled). - Load Validation: Automated check ensuring cargo weight never exceeds assigned vehicle capacity.
- Trip Completion Settlement: Automatically updates vehicle odometer and records fuel logs on trip completion.
- Incident Tracking: Register repair tickets with issue descriptions, estimated expenses, and start/end dates.
- Fleet Safeguard: Automatically transitions assigned vehicles to
In Shopmode upon active repair logging, restoring them toAvailableonly after ticket closure.
- Expense Categorization: Track expenses across
Fuel,Tolls,Maintenance,Permit, andOther. - Cost Allocation: Associate expenditures with specific fleet units for vehicle-level ROI analysis.
- Date Range Auditing: Filter and inspect expenditures over rolling 30, 60, and 90-day operational windows.
- Interactive KPI Matrix: Fleet utilization rate, active vs. in-shop units, dispatched routes, and driver duty counts.
- Financial Visualization: Dynamic monthly revenue charts powered by Recharts.
- Cost Breakdown: Top expenditure vehicles and operational cost distributions.
- Live Event Stream: Simulated vehicle telemetry ticker providing real-time fleet activity feeds.
- Data Export: One-click export of consolidated operations data to CSV format.
- Split-Screen Authentication: Dynamic login interface featuring an auto-playing transport visual backdrop and Clerk authentication.
- Dual-Theme Support: Dark and Light modes with system persistence.
- Animated Sharingan Loader: Custom SVG loading indicator for smooth state transitions.
TransitOps implements granular Role-Based Access Control enforced at both the UI layer (gated sidebar and views) and the database layer (PostgreSQL Row Level Security):
| Role | UI Capabilities | Database Privileges (RLS) |
|---|---|---|
| Fleet Manager | Full access to all modules, assets, work orders, and analytics | Full CRUD on vehicles, drivers, trips, maintenance_logs, fuel_logs, expenses |
| Driver / Dispatcher | Vehicle registry, trip execution, active dispatch management | INSERT & UPDATE on trips (cannot delete or modify asset core specs) |
| Safety Officer | Driver compliance tracking, license expiry auditing, maintenance review | UPDATE on drivers (safety scores & compliance), SELECT on operational records |
| Financial Analyst | Expense tracking, fuel logs audit, reports, and ROI analytics | Full CRUD on expenses and fuel_logs, SELECT on fleet telemetry |
- Framework: React 19
- Build Tool: Vite 8
- Styling: Tailwind CSS v4
- Routing: React Router DOM v7
- Icons: Lucide React
- Charts: Recharts
- Notifications: Sonner
- State & Utilities: Zustand,
clsx,tailwind-merge
- Authentication: Clerk React SDK (
@clerk/react) with custom JWT Supabase template - Database: Supabase (PostgreSQL 15+)
- Security: PostgreSQL Row Level Security (RLS) &
SECURITY DEFINERprocedures - API Communication:
@supabase/supabase-js
Tip: Screenshots can be placed in
docs/screenshots/.
+------------------------------------------+------------------------------------------+
| | [TransitOps] |
| | Smart Transport Operations Platform โ
| | |
| [Truck Visual Feed] | [Select Operating Role] |
| Seamless looping transport | [Fleet Manager] [Dispatcher] |
| fleet operations view | [Safety Officer] [Financial Analyst|
| | |
| | [Clerk Auth Portal] |
+------------------------------------------+------------------------------------------+
(Screenshot placeholder: docs/screenshots/login.png)
+-------------------------------------------------------------------------------------+
| [TransitOps] [Total Fleet: 24] [Available: 16] [On Trip: 5] [In Shop: 3] |
| |
| [Filter: All Types] [Status: All] [Region: Global] [Fleet Util: 76%]|
| |
| +-------------------------+ +-------------------------+ +-------------------------+ |
| | Heavy Duty Semi #TX-982 | | Express Delivery Van | | Intercity Coach Bus | |
| | Capacity: 15.0 Tons | | Capacity: 2.5 Tons | | Capacity: 12.0 Tons | |
| | Status: AVAILABLE | | Status: ON TRIP | | Status: IN SHOP | |
| +-------------------------+ +-------------------------+ +-------------------------+ |
+-------------------------------------------------------------------------------------+
(Screenshot placeholder: docs/screenshots/dashboard.png)
(Screenshot placeholder: docs/screenshots/dispatch.png)
(Screenshot placeholder: docs/screenshots/analytics.png)
transitops/
โโโ .agents/ # AI development skills and references
โโโ docs/ # Architecture documentation and guides
โ โโโ clerk.md # Clerk auth integration guide
โโโ logs/ # Session modification logs
โโโ public/ # Static public assets
โ โโโ favicon.svg # Application SVG brand icon
โ โโโ truck_img.png # Transport asset imagery
โ โโโ truck_video.mp4 # Authentication backdrop video
โโโ src/
โ โโโ auth/
โ โ โโโ AGENTS.md # Auth module architecture specification
โ โ โโโ supabase.js # Clerk-authenticated Supabase client factory
โ โโโ components/
โ โ โโโ SharinganLoader.jsx # Custom animated SVG loading indicator
โ โ โโโ Truck3DScene.jsx # Video backdrop container with gradient masks
โ โ โโโ UserProfileSection.jsx# Operator profile management & webcam capture
โ โโโ config/
โ โ โโโ env.js # Environment configuration & zero-config fallbacks
โ โโโ context/
โ โ โโโ ThemeContext.jsx # Dark/Light theme provider and toggle
โ โโโ lib/
โ โ โโโ utils.ts # Classname merging utility
โ โโโ pages/
โ โ โโโ AnalyticsView.jsx # Financial metrics, revenue charts & telemetry
โ โ โโโ DashboardView.jsx # Fleet-wide KPI matrix and asset cards
โ โ โโโ DispatchView.jsx # Trip creation, assignment & completion
โ โ โโโ DriversView.jsx # Driver profiles, license expiry & safety scores
โ โ โโโ ExpensesView.jsx # Operational expenditure logging & auditing
โ โ โโโ MaintenanceView.jsx # Vehicle work orders and repair scheduling
โ โ โโโ SettingsView.jsx # Speed limit thresholds & alert preferences
โ โ โโโ TripsView.jsx # Global trip manifest & status tracking
โ โ โโโ VehiclesView.jsx # Vehicle inventory CRUD and specifications
โ โโโ services/
โ โ โโโ AGENTS.md # Services layer specification
โ โ โโโ database.js # Generic CRUD helper with local resilience fallback
โ โ โโโ fleetService.js # Typed domain-specific fleet operations API
โ โโโ App.css
โ โโโ App.jsx # Main layout shell, sidebar routing & auth gateway
โ โโโ index.css # Tailwind CSS v4 directives & theme styles
โ โโโ main.jsx # Application entry point with ClerkProvider
โโโ .env.example # Environment variable template
โโโ .gitignore # Git exclusion rules
โโโ AGENTS.md # Project governance and agent instructions
โโโ eslint.config.js # ESLint flat configuration (React 19 + Vite)
โโโ index.html # HTML entry template
โโโ package.json # Dependencies and script definitions
โโโ README.md # Project documentation
โโโ supabase_schema_and_guide.md # Production database DDL, triggers & RLS guide
โโโ supabase_schema.txt # [Archived] Initial prototype DDL (for history)
โโโ vite.config.js # Vite build and path alias configuration
Ensure you have the following installed on your machine:
- Node.js:
v18.0.0or later (LTS recommended) - npm:
v9.0.0or later - A free Clerk account for authentication
- A free Supabase account for PostgreSQL database hosting
git clone https://github.com/Darshan-38/transitops.git
cd transitopsnpm installTransitOps includes safe fallback defaults in src/config/env.js allowing the application to run immediately out-of-the-box without requiring a .env file.
To connect your own Clerk application and Supabase database, copy .env.example to .env:
cp .env.example .envOpen .env in your editor and provide your custom Clerk and Supabase credentials (see Environment Configuration).
Execute the production SQL script from supabase_schema_and_guide.md in your Supabase SQL Editor (see Database Setup).
npm run devOpen http://localhost:5173 in your browser.
The application requires the following environment variables defined in .env:
# Clerk Authentication Publishable Key (from Clerk Dashboard -> API Keys)
VITE_CLERK_PUBLISHABLE_KEY=pk_test_xxxxxxxxxxxxxxxxxxxxxxxx
# Supabase Project URL (from Supabase Project Settings -> API)
VITE_SUPABASE_URL=https://xxxxxxxxxxxxxxxx.supabase.co
# Supabase Public/Anon API Key (from Supabase Project Settings -> API)
VITE_SUPABASE_PUBLISHABLE_KEY=eyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Clerk JWT Template configured for Supabase (Default: supabase)
VITE_CLERK_JWT_TEMPLATE=supabaseTransitOps uses Clerk for user authentication and session management.
- Create an Application in the Clerk Dashboard.
- Enable Email / Password and optionally Google OAuth under User & Authentication.
- Go to API Keys and copy your Publishable Key into
VITE_CLERK_PUBLISHABLE_KEY. - Navigate to JWT Templates
$\rightarrow$ Click New template$\rightarrow$ Choose Supabase. - Name the template
supabase(matchingVITE_CLERK_JWT_TEMPLATE). - In the template settings, set the Signing Key to your Supabase project's JWT Secret (found in Supabase under Project Settings
$\rightarrow$ API$\rightarrow$ JWT Secret). - Save the template. The client will automatically sign Supabase requests with the user's Clerk session token.
The database schema and business triggers are documented in supabase_schema_and_guide.md.
- Open your Supabase project and navigate to SQL Editor.
- Open
supabase_schema_and_guide.mdand copy the SQL statements from Section 1 (Database Schema Setup Script). - Paste the SQL into the Supabase SQL Editor and click Run.
public.profiles: Maps Clerk users (user_...) to roles (Fleet Manager,Driver,Safety Officer,Financial Analyst).public.vehicles: Fleet assets with load limits, odometer tracking, and status checks.public.drivers: Operator records with license categories, expiry dates, and safety ratings.public.trips: Dispatch manifests linking vehicles and drivers with cargo and distance metrics.public.maintenance_logs: Service tickets with automatic vehicle status synchronization.public.fuel_logs: Fuel consumption and refueling expenditure records.public.expenses: General fleet operating expenditures.- Triggers:
handle_trip_status_changes: Validates cargo capacity, license validity, and manages vehicle/driver availability automatically.handle_maintenance_status_changes: Automatically sets vehicle status toIn Shopwhen maintenance is opened, and returns it toAvailableon closure.
- Row Level Security (RLS): Enforces role-based read and write permissions across all tables.
| Command | Purpose |
|---|---|
npm run dev |
Starts the Vite development server at http://localhost:5173 |
npm run build |
Compiles and bundles production-ready assets into dist/ |
npm run preview |
Starts a local web server to preview the production build |
npm run lint |
Runs ESLint across all JavaScript/JSX source files |
- Zero Secret Exposure: Only public publishable keys are bundled into frontend assets. Supabase
service_roleand private backend keys are never stored in client code. - Database-Level Protection: All queries are evaluated against PostgreSQL Row Level Security (RLS) policies tied to the verified JWT session.
- Local Fallback Resilience:
src/services/database.jsprovides automatic localStorage persistence fallback, enabling offline functionality and uninterrupted demo presentation during network interruptions. - Strict Input Validation: Client forms enforce input boundary checks (e.g., non-negative distances, valid date windows) before requests reach the database.
- Live Telemetry & GPS Tracking: Integrate Leaflet / Mapbox with simulated OBD-II GPS tracking.
- Automated Alerting: Push notifications and SMS alerts via Twilio for license expirations and maintenance due dates.
- AI Route Optimization: Predictive route planning based on cargo weight and historical fuel consumption.
- Multi-Tenant Fleet Support: Tenant organization switching for multi-fleet transport operators.
- Mobile Native Companion: React Native companion app for drivers to update trip milestones and scan bills of lading.
Darshan Rathod
- GitHub: @Darshan-38
- LinkedIn: linkedin.com/in/rathod-darshan-6459bb2b8
Developed as a modern transport operations solution demonstrating modular React architecture, full-stack database enforcement, and enterprise-grade authentication.
This project is licensed under the MIT License.