Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

University Bus Scheduling Management System

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.

Features

User Management

  • 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 & Schedule Management

  • 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

Real-Time Features

  • 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

Booking & Pass Management

  • Seat Reservation: Check availability and reserve seats
  • Digital Bus Passes: QR code-based digital passes
  • Booking Management: View and manage all bookings

Administrative Control

  • 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

Reporting & Analytics

  • Daily Trip Summaries: Overview of daily operations
  • Bus Usage Statistics: Track bus utilization
  • Driver Performance: Evaluate driver metrics

Security & Compliance

  • Activity Logs: Complete audit trails
  • Encrypted Authentication: Secure token-based auth
  • Data Protection: Secure API communications

Tech Stack

Frontend

  • 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

Backend

  • Next.js API Routes - Server-side API endpoints
  • Prisma - ORM for database
  • PostgreSQL - Database (via Prisma)
  • JWT - Authentication tokens
  • bcryptjs - Password hashing

Project Structure

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

Getting Started

Prerequisites

  • Node.js 18+
  • PostgreSQL database
  • npm or yarn

Installation

  1. Install dependencies:
npm install
  1. Configure environment variables:
cp .env.example .env
# Edit .env with your database URL and JWT secret
  1. Set up the database:
npx prisma generate
npx prisma db push
  1. Run the development server:
npm run dev
  1. Open http://localhost:3000

API Endpoints

Authentication

  • POST /api/auth/login - User login
  • POST /api/auth/register - User registration

Users

  • GET /api/users - List all users (Admin)
  • POST /api/users - Create user (Admin)
  • GET /api/users/[id] - Get user details
  • PUT /api/users/[id] - Update user
  • DELETE /api/users/[id] - Delete user

Buses

  • GET /api/buses - List all buses
  • POST /api/buses - Create bus (Admin)
  • GET /api/buses/[id] - Get bus details
  • PUT /api/buses/[id] - Update bus
  • DELETE /api/buses/[id] - Delete bus

Routes

  • GET /api/routes - List all routes
  • POST /api/routes - Create route (Admin)
  • GET /api/routes/[id] - Get route details
  • PUT /api/routes/[id] - Update route
  • DELETE /api/routes/[id] - Delete route

Schedules

  • GET /api/schedules - List all schedules
  • POST /api/schedules - Create schedule (Admin)
  • GET /api/schedules/[id] - Get schedule details

Trips

  • GET /api/trips - List all trips
  • POST /api/trips - Start a trip (Driver)
  • PUT /api/trips/[id] - Update trip status

Bookings

  • GET /api/bookings - List bookings
  • POST /api/bookings - Create booking

Locations

  • GET /api/locations - Get bus locations
  • POST /api/locations - Update bus location

Notifications

  • GET /api/notifications - Get notifications
  • POST /api/notifications - Send notification (Admin)
  • PUT /api/notifications - Mark as read

Maintenance

  • GET /api/maintenance - List maintenance records
  • POST /api/maintenance - Create maintenance (Admin)
  • PUT /api/maintenance - Update maintenance status

Bus Pass

  • GET /api/buspass - List bus passes
  • POST /api/buspass - Create bus pass (Admin)
  • PUT /api/buspass - Verify QR code

Feedback

  • GET /api/feedback - List feedback
  • POST /api/feedback - Submit feedback

Activity Logs

  • GET /api/activity-logs - List activity logs (Admin)

Reports

  • GET /api/reports - Generate reports (Admin)

Dashboard

  • GET /api/dashboard - Get dashboard statistics (Admin)
  • POST /api/dashboard - Send emergency broadcast (Admin)

Database Schema

Models

  • 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

User Roles

Administrator

  • Full system access
  • User management
  • Route & schedule creation
  • Bus allocation
  • Driver assignment
  • Maintenance scheduling
  • View all reports and analytics

Driver

  • View assigned routes
  • Start/complete trips
  • Update bus location (GPS)
  • View notifications

Student

  • View routes and schedules
  • Make bookings
  • View digital bus pass
  • Provide feedback
  • Receive notifications

License

MIT License

About

A Next.js-based university bus management system for scheduling, tracking, booking, and route administration with real-time GPS features.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages