Skip to content

Repository files navigation

Ambulance Booking System

The Ambulance Booking System is a comprehensive web application designed to streamline ambulance booking and emergency response coordination. It features a dual-frontend architecture to cater to different user needs and a robust backend for real-time operations.

It allows patients and drivers to interact in real-time through a secure, intuitive, and responsive platform, ensuring faster medical assistance during emergencies.

The system connects seamlessly with the backend via REST APIs and Socket.io, providing real-time driver tracking, instant booking updates, and live trip status monitoring.

Know More


Overview

  • Unified Interface:
  • Ambulance Booking App: A comprehensive Next.js application for both Users and Drivers.
  • Clients: Book ambulances, track drivers, and view booking history.
  • Drivers: Log in, view assigned trips, and update trip statuses.
  • Real-time tracking & communication: Powered by Socket.io & Google Maps API.
  • Responsive design: Optimized for both web and mobile users.

Key Features

Authentication System

Client Authentication

  • Secure login and registration.
  • JWT-based session management.

Driver Authentication

  • Secure login with hashed passwords (bcrypt).
  • JWT-based authentication & route protection.

Booking Management

  • Clients can book ambulances with pickup & destination details.
  • System finds the nearest available driver.
  • Real-time trip updates: Requested → Accepted → In Progress → Completed → Cancelled.
  • Booking history stored for both clients and drivers.

Real-time Communication

  • Powered by Socket.io.
  • Real-time updates for:
    • Trip status changes.
    • Driver location updates.
    • Notifications for acceptance, arrival, or cancellations.

Admin Capabilities (Optional)

  • View all bookings and statuses.
  • Manage driver accounts.
  • Monitor system analytics.


Tech Stack

Frontend

TechnologyPurpose
Next.jsCore frontend framework
AxiosAPI communication
Socket.io ClientReal-time updates
Google Maps APILocation tracking and map integration
Tailwind CSSStyling and responsive layout management

Backend

TechnologyPurpose
Node.jsJavaScript runtime for backend
ExpressWeb framework for building REST APIs
express-validatorValidate incoming request data
jsonwebtoken (JWT)Authentication and route protection
corsEnable cross-origin requests
bcryptSecure password hashing
MongoDB & MongooseNoSQL database and ODM
Socket.ioReal-time bidirectional communication

API Documentation

Socket.io Events

  • booking request → Triggered by client to request an ambulance.
  • booking accept → Sent by driver upon accepting a booking.
  • location update → Continuously transmits driver’s live location.
  • trip status emits → Booking progress and completion updates.

Full Setup & Installation Guide

Prerequisites


Clone the Repository

git clone https://github.com/praggCode/AMB_One.git
cd AMB_One

Backend Setup

Navigate to the backend directory and install dependencies:

cd backend
npm install

Create a .env file in the backend directory with the following variables (example):

PORT=4000DB_CONNECT=your_mongodb_connection_stringJWT_SECRET=your_jwt_secret

Run the backend server:

npm run dev

Frontend Setup

Navigate to the frontend directory:

cd ../frontend
npm install

Run the development server:

npm run dev

Testing Guide

To verify the system’s functionality:

  • Test client login/signup.
  • Test driver login/signup.
  • Create and manage ambulance bookings.
  • Monitor real-time booking status and driver tracking.
  • Validate responsiveness across devices.
  • Test Socket.io event flow (booking request → accept → complete).

Backend Integration

  • Frontend communicates with backend via /api/... routes.
  • Uses Socket.io for instant updates between drivers and clients.
  • Implements JWT-based authentication for secure requests.

Future Enhancements

  • Advanced route optimization for drivers.
  • Online Payment Integration (Razorpay / Stripe).
  • Hospital Dashboard for centralized booking management.
  • Voice Alerts for driver notifications.
  • Mobile App version (React Native / Flutter).

About

Ambulance Booking Application

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages