Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AmbuFlow — Ambulance Tracking & Emergency Response System

A full-stack web application that connects users to nearby ambulances and hospitals in real time. Built with HTML, CSS, JavaScript (frontend) and Node.js, Express, MongoDB (backend).


Features

Feature Description
Emergency Call One-click ambulance dispatch with 8-second confirmation timer
Real-Time Tracking Live ambulance location updates via GPS
Nearby Hospitals Search and display hospitals by name or area with call integration
Role-Based Dashboards Separate views for User, Hospital, and Driver
Driver Availability Drivers toggle ON/OFF duty status with live map
Google Auth Firebase-powered Google Sign-In
SOS Alert Emergency SOS page with direct call access
Dark Mode Persistent theme across sessions
PWA Support Service worker + manifest for installable experience
Feedback System In-app user feedback form

Tech Stack

Frontend

  • HTML5, CSS3, Vanilla JavaScript
  • Google Maps JavaScript API (Places, Geolocation)
  • Firebase Authentication (Google Sign-In)
  • Font Awesome icons

Backend

  • Node.js + Express.js
  • MongoDB + Mongoose
  • bcryptjs (password hashing)
  • jsonwebtoken (JWT auth)
  • dotenv (environment variable management)

Project Structure

AmbuFlow/
├── index.html              # Landing page (entry point)
├── login.html              # Login & signup
├── roles.html              # Role selection (User / Hospital / Driver)
├── nearby.html             # Find nearby hospitals
├── sos.html                # SOS emergency page
├── feedback.html           # User feedback
├── features.html           # Feature showcase
├── team.html               # Team page
├── contact.html            # Contact & support
├── about.html              # About page
├── driver.html             # Driver dashboard
├── hospital.html           # Hospital dashboard
├── manage.html             # Ambulance management
├── profile.html            # User profile
│
├── src/css/                # Scoped CSS per page
│   ├── navbar.css
│   ├── index.css
│   ├── login.css
│   ├── driver.css
│   ├── hospital.css
│   └── ...
│
├── images/                 # All project images and assets
│
├── script.js               # Shared frontend logic (dark mode, accordion, nav)
├── scripts.js              # Service worker registration
├── firebase.js             # Firebase Google Auth
│
└── backend/                # Node.js REST API
    ├── server.js           # Express server entry point
    ├── .env.example        # Environment variable template
    ├── Controllers/
    │   └── ambulanceController.js
    └── Models/
        ├── User.js
        └── Ambulance.js

Getting Started

Prerequisites


1. Clone the Repository

git clone https://github.com/YOUR_USERNAME/AmbuFlow.git
cd AmbuFlow

2. Set Up the Backend

cd backend
npm install

Create your environment file:

cp .env.example .env

Open backend/.env and fill in your values:

MONGODB_URI=mongodb+srv://<username>:<password>@cluster.mongodb.net/ambuflow
JWT_SECRET=your_long_random_secret_here
PORT=3000

Start the backend:

# Development (auto-restart on changes)
npm run dev

# Production
npm start

The API will be running at http://localhost:3000.


3. Configure Frontend API Keys

Before opening the frontend, replace the placeholder API keys:

Google Maps (user.html and driver.html):

<!-- Replace YOUR_GOOGLE_MAPS_API_KEY with your actual key -->
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_GOOGLE_MAPS_API_KEY&libraries=places">

Firebase (firebase.js):

const firebaseConfig = {
    apiKey: "YOUR_FIREBASE_API_KEY",
    authDomain: "YOUR_PROJECT_ID.firebaseapp.com",
    projectId: "YOUR_PROJECT_ID",
    // ... other fields from Firebase Console
};

Security note: Never commit real API keys to version control. For production, use a build tool to inject keys from environment variables.


4. Run the Frontend

Open index.html with a local server (required for service worker and Firebase to work):

# Using VS Code Live Server extension (recommended)
# Right-click index.html → Open with Live Server

# Or using Python
python -m http.server 8080

# Or using npx
npx serve .

Navigate to http://localhost:8080.


API Endpoints

Method Route Description Auth Required
GET / Health check No
POST /signup Register a new user No
POST /login Login, returns JWT No
GET /protected Protected route example Yes (Bearer JWT)
POST /ambulances/create Register a new ambulance No
GET /ambulances List all ambulances No
POST /ambulances/book Book an ambulance No

Environment Variables Reference

Variable Required Description
MONGODB_URI Yes MongoDB Atlas connection string
JWT_SECRET Yes Secret key for JWT signing (min 32 chars)
PORT No Server port (default: 3000)

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature
  3. Commit your changes: git commit -m "feat: add your feature"
  4. Push the branch: git push origin feature/your-feature
  5. Open a Pull Request

Please read Contributing.md and CODE_OF_CONDUCT.md before contributing.


License

MIT

About

MERN-based emergency response and ambulance management platform featuring real-time tracking, hospital coordination, and role-based dashboards.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages