A comprehensive Next.js web application for managing university bus transportation operations. This system provides efficient transportation management for students and staff with role-based access control.
- Role-based Access Control: Separate roles for Administrators, Drivers, and Students
- Secure Authentication: JWT-based login with encrypted credentials
- Profile Management: User profile updates and settings
- Route Management: Create, update, and manage bus routes
- Stop Management: Add/remove stops, set stop-wise arrival times
- Schedule Management: Morning, noon, and evening trip schedules
- Special Schedules: Holiday and event-specific scheduling
- GPS Tracking: Real-time bus location tracking on interactive maps
- Live Map Visualization: Route polylines and stop markers using React-Leaflet
- ETA Calculation: Estimated arrival times for each stop
- Live Notifications: Alerts when buses approach stops
- Seat Reservation: Check availability and reserve seats
- Digital Bus Passes: QR code-based digital passes
- Booking Management: View and manage all bookings
- Dashboard: Comprehensive statistics and overview
- Bus Allocation: Assign buses to routes
- Driver Assignment: Manage driver assignments
- Maintenance Scheduling: Track repairs and service schedules
- Emergency Broadcasting: Send urgent notifications to all users
- Daily Trip Summaries: Overview of daily operations
- Bus Usage Statistics: Track bus utilization
- Driver Performance: Evaluate driver metrics
- Activity Logs: Complete audit trails
- Encrypted Authentication: Secure token-based auth
- Data Protection: Secure API communications
- Next.js 14 - React framework with App Router
- TailwindCSS - Utility-first CSS framework
- React Context - State management
- React-Leaflet - Map integration with OpenStreetMap
- React Icons - Icon library
- Axios - HTTP client
- Next.js API Routes - Server-side API endpoints
- Prisma - ORM for database
- PostgreSQL - Database (via Prisma)
- JWT - Authentication tokens
- bcryptjs - Password hashing
src/
├── app/ # Next.js App Router pages
│ ├── login/ # Login page
│ ├── register/ # Registration page
│ ├── dashboard/ # Dashboard
│ ├── buses/ # Bus management
│ ├── routes/ # Route management
│ ├── schedules/ # Schedule management
│ ├── trips/ # Trip management
│ ├── bookings/ # Booking management
│ ├── tracking/ # Live tracking map
│ └── notifications/ # Notifications
├── components/
│ ├── ui/ # Reusable UI components
│ ├── layout/ # Layout components
│ └── map/ # Map components
├── context/ # React Context providers
├── services/ # API service layer
└── lib/ # Utility libraries
- Node.js 18+
- PostgreSQL database
- npm or yarn
- Install dependencies:
npm install- Configure environment variables:
cp .env.example .env
# Edit .env with your database URL and JWT secret- Set up the database:
npx prisma generate
npx prisma db push- Run the development server:
npm run devPOST /api/auth/login- User loginPOST /api/auth/register- User registration
GET /api/users- List all users (Admin)POST /api/users- Create user (Admin)GET /api/users/[id]- Get user detailsPUT /api/users/[id]- Update userDELETE /api/users/[id]- Delete user
GET /api/buses- List all busesPOST /api/buses- Create bus (Admin)GET /api/buses/[id]- Get bus detailsPUT /api/buses/[id]- Update busDELETE /api/buses/[id]- Delete bus
GET /api/routes- List all routesPOST /api/routes- Create route (Admin)GET /api/routes/[id]- Get route detailsPUT /api/routes/[id]- Update routeDELETE /api/routes/[id]- Delete route
GET /api/schedules- List all schedulesPOST /api/schedules- Create schedule (Admin)GET /api/schedules/[id]- Get schedule details
GET /api/trips- List all tripsPOST /api/trips- Start a trip (Driver)PUT /api/trips/[id]- Update trip status
GET /api/bookings- List bookingsPOST /api/bookings- Create booking
GET /api/locations- Get bus locationsPOST /api/locations- Update bus location
GET /api/notifications- Get notificationsPOST /api/notifications- Send notification (Admin)PUT /api/notifications- Mark as read
GET /api/maintenance- List maintenance recordsPOST /api/maintenance- Create maintenance (Admin)PUT /api/maintenance- Update maintenance status
GET /api/buspass- List bus passesPOST /api/buspass- Create bus pass (Admin)PUT /api/buspass- Verify QR code
GET /api/feedback- List feedbackPOST /api/feedback- Submit feedback
GET /api/activity-logs- List activity logs (Admin)
GET /api/reports- Generate reports (Admin)
GET /api/dashboard- Get dashboard statistics (Admin)POST /api/dashboard- Send emergency broadcast (Admin)
- User: Authentication and user data (role: ADMIN, DRIVER, STUDENT)
- Bus: Bus information and status
- Route: Bus routes with stops
- Stop: Individual stops on routes
- Schedule: Route schedules (morning, noon, evening)
- Trip: Actual trip instances
- Booking: Seat reservations
- BusPass: Digital bus passes with QR codes
- Maintenance: Bus maintenance records
- Notification: User notifications
- Feedback: User feedback for trips
- ActivityLog: Audit trail for actions
- Full system access
- User management
- Route & schedule creation
- Bus allocation
- Driver assignment
- Maintenance scheduling
- View all reports and analytics
- View assigned routes
- Start/complete trips
- Update bus location (GPS)
- View notifications
- View routes and schedules
- Make bookings
- View digital bus pass
- Provide feedback
- Receive notifications
MIT License