Fleet Operating System for Transitland - A comprehensive fleet management solution built with Next.js, Supabase, and PowerSync.
Transitland Fleet OS is designed to shift fleet operations from reactive firefighting to proactive, data-driven fleet orchestration. The system provides real-time visibility, offline-first capabilities, and role-based views for mechanics, operations managers, parts clerks, and drivers.
- Framework: Next.js 16+ (App Router with Turbopack)
- Language: TypeScript 5.9+
- Database: Supabase (PostgreSQL)
- Offline Sync: PowerSync
- PWA: next-pwa
- Styling: Tailwind CSS 4.x
- UI Components: HeadlessUI
- Forms: React Hook Form + Zod
- State Management: Zustand + React Query
-
Mechanic View (Wrench View)
- Work order queue
- Work order detail and management
- Offline-first CRUD operations
- Big button, high-contrast UI for shop floor use
-
Operations Manager View (Control Tower)
- Real-time fleet availability dashboard
- KPI cards (Fleet Availability %, Critical Issues, MTTR, Active Mechanics)
- Garage selector for filtering by location (All, North, South)
- Triage queue for unassigned critical work orders (P0/P1)
- Searchable fleet status table with vehicle management
- Work order assignment to mechanics
- Schedule planning for preventive maintenance and work order time slots
- Vehicle detail pages with status updates and work order management
- Comprehensive work order detail pages with parts tracking and hours management
-
Parts Clerk View (Warehouse View)
- Inventory grid with real-time stock tracking
- Low stock alerts
- Restock forms
- Auto-decrement on part usage
-
Driver View (Input Portal)
- Digital Vehicle Inspection Report (DVIR)
- Simplified issue reporting wizard
- Auto-work order creation for critical failures
- Offline-First Architecture: Full functionality without internet connection
- Real-time Updates: WebSocket-based real-time dashboard updates
- Priority Matrix: Auto-assignment of P0-P3 priorities based on issue type
- Winterization Protocol: Automatic checklist injection (Oct 1 - Nov 1)
- Vehicle State Machine: Enforced state transitions
- Inventory Management: Real-time stock tracking with auto-decrement
- User Authentication: Secure login/logout with role-based access control
- Work Order Management: Full CRUD operations with assignment, status tracking, and parts management
- Schedule Planning: Preventive maintenance scheduling and work order time slot management
- Vehicle Management: Individual vehicle detail pages with status updates and work order history
- MTTR Tracking: Mean Time To Repair calculation from closed work orders
- Demo Data: Comprehensive seed scripts for testing and demos
- Node.js 18+
- npm or yarn
- Supabase account
- PowerSync account (optional for offline sync)
- Clone the repository:
git clone <repository-url>
cd Transitland- Install dependencies:
npm install- Set up environment variables:
cp .env.example .env.localFill in your Supabase and PowerSync credentials. The .env.local file has been created with your Supabase credentials.
-
Run database migrations in Supabase:
Option A: Using Supabase Dashboard (Recommended)
- Go to your Supabase project dashboard: https://supabase.com/dashboard
- Navigate to SQL Editor
- Execute the migration files in order:
- Copy and paste the contents of
db/migrations/001_initial_schema.sqland run it - Copy and paste the contents of
db/migrations/002_analytics_tables.sqland run it - Copy and paste the contents of
db/migrations/003_functions_triggers.sqland run it - Important: For migration
009_setup_photo_storage.sql, follow the manual setup instructions indb/migrations/SUPABASE_SETUP_INSTRUCTIONS.md(requires creating a storage bucket and running SQL policies)
- Copy and paste the contents of
Option B: Using Supabase CLI
# Install Supabase CLI if not already installed npm install -g supabase # Link to your project supabase link --project-ref <your-project-ref> # Run migrations supabase db push
-
Set up test accounts (optional):
See
db/README_SEED_DATA.mdfor detailed instructions. Quick setup:- Create auth users in Supabase Dashboard (Authentication > Users > Add User):
mechanic@transitland.test/TestMechanic123!ops@transitland.test/TestOps123!clerk@transitland.test/TestClerk123!driver@transitland.test/TestDriver123!
- Run
db/migrations/004_seed_test_data.sqlto create user profiles
Or use the SQL-based approach:
- Run
db/migrations/005_create_auth_users.sqlto create auth users - Run
db/migrations/006_seed_users_after_auth.sqlto create user profiles
- Create auth users in Supabase Dashboard (Authentication > Users > Add User):
-
Set up demo data (optional, for full demo scenario):
See
db/README_DEMO_DATA.mdfor detailed instructions. This creates:- 2 garages (North: 175 buses, South: 125 buses)
- 300 buses with realistic data
- Inventory items and stock
- Work orders showing maintenance backlog
-- Run in Supabase SQL Editor: -- 1. db/migrations/007_seed_demo_data.sql -- 2. db/migrations/008_assign_users_to_demo_garages.sql (to assign test users to North Garage)
-
Start the development server:
npm run dev- Open http://localhost:3000 in your browser.
/app
/(auth) - Authentication routes
/(dashboard) - Protected routes
/mechanic - Mechanic view
/work-orders - Work order management
/ops - Operations manager view
/work-orders - Work order management and assignment
/vehicles - Vehicle detail and management
/schedule - Schedule planning
/clerk - Parts clerk view
/driver - Driver view
/components
/ui - Shared UI components
/features - Feature-specific components
/lib
/supabase - Supabase client configuration
/powersync - PowerSync integration
/services - Business logic services
/hooks - React hooks
/utils - Utility functions
/db
/migrations - Database migration files
README_SEED_DATA.md - Test account setup guide
README_DEMO_DATA.md - Demo data setup guide
/types - TypeScript type definitions
The database is organized into two layers:
garages- Location contextvehicles- Asset registryusers- Identity (extends Supabase auth)mechanics- Mechanic profilesdrivers- Driver profileswork_orders- Transactional corework_order_events- Audit loginventory_items- Global cataloginventory_stock- Local stock per garage
daily_garage_stats- Fleet health metricsmechanic_daily_logs- Efficiency trackingdriver_risk_scores- Driver impact scoringstockout_events- Supply chain trackingseasonal_campaigns- Winterization tracking
- P0 (Critical): Safety/Compliance issues (Brakes, Wheelchair Lift) - Same-day fix
- P1 (High): Service impacting (A/C, Heater, Engine) - 24h fix
- P2 (Medium): Performance/Efficiency - 3-5 days
- P3 (Deferrable): Cosmetic - Next scheduled service
- Start: October 1st
- Deadline: November 1st
- Automatic checklist injection for non-winterized vehicles
- Vehicles blocked from dispatch after deadline if not winterized
Valid transitions:
- AVAILABLE → IN_SERVICE, MAINTENANCE_DUE, IN_MAINTENANCE, OUT_OF_SERVICE
- IN_SERVICE → AVAILABLE, MAINTENANCE_DUE, OUT_OF_SERVICE
- MAINTENANCE_DUE → IN_MAINTENANCE, OUT_OF_SERVICE
- IN_MAINTENANCE → AVAILABLE, OUT_OF_SERVICE
- OUT_OF_SERVICE → IN_MAINTENANCE, AVAILABLE
main→ Productionstage→ Testing/Stagingdevelop→ Development
The following test accounts are available for development and testing:
| Role | Password | Dashboard | |
|---|---|---|---|
| Mechanic | mechanic@transitland.test |
TestMechanic123! |
/mechanic |
| Ops Manager | ops@transitland.test |
TestOps123! |
/ops |
| Parts Clerk | clerk@transitland.test |
TestClerk123! |
/clerk |
| Driver | driver@transitland.test |
TestDriver123! |
/driver |
All accounts have logout functionality accessible from their respective dashboards.
npm run testnpm run build
npm startThe application is configured for deployment on Vercel/Netlify with branch-based deployments:
mainbranch → Productionstagebranch → Stagingdevelopbranch → Development preview
[Your License Here]
For issues and questions, please contact the development team.