SchoolRide is a modern, real-time school ride-sharing and booking platform. It connects parents looking for safe transportation for their school-going children with verified drivers. The system supports role-based dashboards, real-time map tracking, push notifications, and detailed trip routing.
graph TD
classDef client fill:#38bdf8,stroke:#0369a1,stroke-width:2px,color:#fff;
classDef server fill:#10b981,stroke:#047857,stroke-width:2px,color:#fff;
classDef db fill:#f59e0b,stroke:#b45309,stroke-width:2px,color:#fff;
subgraph Client ["Client (React + Vite)"]
A["Parent/Driver Dashboard"]:::client
B["Redux Toolkit (State Management)"]:::client
C["React Leaflet (Real-time Map)"]:::client
end
subgraph Server ["Server (Express.js)"]
D["Express Router & API Endpoints"]:::server
E["Socket.io Server (WebSocket)"]:::server
F["Security Middlewares (Helmet, Rate Limiting)"]:::server
G["Background Services (Cron, Nodemailer)"]:::server
end
subgraph Database ["Database & Services"]
H["MongoDB (Mongoose ODM)"]:::db
I["Firebase Cloud Messaging (FCM)"]:::db
end
A --> B
A --> C
B <--> D
C <--> E
D --> F
F --> H
E --> H
D --> I
G --> H
- Parent Dashboard: Search for available school routes, request bookings, track active rides in real time, view children's trip status, and update profile options.
- Driver Dashboard: Manage vehicles, register seats limits, start/end school trips, navigate routes via Leaflet maps, accept/reject parent bookings, and broadcast real-time locations.
- Admin Dashboard: Monitor all active bookings, routes, user statuses, and resolve system issues.
- Interactive maps using React Leaflet.
- Real-time driver location tracking broadcasted to parents using Socket.io.
- Interactive starting/destination point mapping for routes.
- Secure authentication using JSON Web Tokens (JWT) and bcryptjs hashing.
- HTTP security headers powered by Helmet.
- API request throttling using Express Rate Limiter.
- Data sanitization and structured schemas verified through Joi Validation.
- Push Notifications via Firebase Cloud Messaging (FCM) for immediate updates.
- Email updates (Verification OTPs, Welcoming, Password Resets) via Nodemailer using HTML email templates.
- Core Framework: React 19 (Vite)
- State Management: Redux Toolkit & React-Redux
- Styling: Tailwind CSS v4 (using
@tailwindcss/vitecompiler) - Routing: React Router DOM v7
- Maps & Tracking: Leaflet & React-Leaflet
- Forms: React Hook Form
- HTTP Client: Axios
- Runtime Environment: Node.js (v20+)
- Server Framework: Express 5.x
- Database: MongoDB with Mongoose ODM
- WebSockets: Socket.io
- Authentication: JWT (jsonwebtoken) & bcryptjs
- Validation: Joi
- Security: Helmet & Express Rate Limit
- Testing: Native Node.js test runner (
node:test)
-
Clone the Repository
git clone https://github.com/your-username/SchoolRide.git cd SchoolRide -
Configure Environment Variables
-
Client Configuration Create a
.envfile in theClient/folder:VITE_API_BASE_URL=/api
-
Server Configuration Create a
.envfile in theServer/folder:PORT=5000 MONGODB_URL=mongodb://127.0.0.1:27017/schoolride JWT_SECRET=your_super_secret_jwt_key_at_least_256_bits NODE_ENV=development # Optional Email Configuration (smtp-relay) SMTP_USER=your_smtp_user SMTP_PASS=your_smtp_password SENDER_EMAIL=noreply@schoolride.com # Optional Firebase Configuration (for Push Notifications) FIREBASE_PROJECT_ID=your_firebase_project_id FIREBASE_CLIENT_EMAIL=your_firebase_client_email FIREBASE_PRIVATE_KEY=your_firebase_private_key
-
-
Install Dependencies
-
For the Server:
cd Server npm install -
For the Client:
cd ../Client npm install
-
To run both services simultaneously, run the dev script inside each directory:
-
Start the Backend Server (Server)
cd Server npm run devThis launches the backend using
nodemonon http://localhost:5000 (API docs available at http://localhost:5000/api-docs). -
Start the Frontend App (Client)
cd Client npm run devThis launches the Vite development server on http://localhost:5173 (automatically proxies
/apicalls to the backend).
The Server contains comprehensive unit tests for controllers and models using the native Node.js test runner (node:test).
- To run the tests:
cd Server npm test
The test suite includes a virtual testing tool (tests/virtual.test.js) that simulates client-side fetch requests to verify active API routes and map controllers.
API documentation is generated dynamically via Swagger. Once the backend server is running, visit: 👉 http://localhost:5000/api-docs
Key API routes:
POST /api/auth/register- Create user accounts (role: parent/driver)POST /api/auth/login- Authenticate and establish session cookiesPOST /api/vehicle- Create vehicle listings (seats availability, license details)GET /api/routes- Retrieve routes mappingPOST /api/trips- Create and schedule active tripsPOST /api/location- Broadcast driver coordinate coordinates