A full-stack web application for managing hospital appointments, token generation, and emergency alerts with QR code validation.
- Frontend: React.js with Vite, TailwindCSS, Zustand
- Backend: Node.js + Express.js
- Database: MongoDB
- Authentication: JWT with bcrypt
- Real-time: Socket.io
- QR Codes: qrcode library
- User registration and login (email/password)
- Browse hospitals and departments
- Book appointments with available time slots
- View token with QR code
- Real-time appointment status updates
- Emergency alert system (3 levels: Risky, Very Risky, Critical)
- View all booked appointments
- Validate QR tokens for check-ins
- Mark appointments as completed
- Real-time emergency alert notifications
- Manage hospital and department data
- Node.js (v16 or higher)
- MongoDB
-
Navigate to the backend directory:
cd backend -
Install dependencies:
npm install
-
Create a
.envfile based on.env.example:MONGODB_URI=mongodb://localhost:27017/queuezero PORT=3000 FRONTEND_URL=http://localhost:5173 JWT_SECRET=your_jwt_secret_key_here
-
Start MongoDB service
-
(Optional) Seed the database with sample data:
npm run seed
-
Navigate to the frontend directory:
cd frontend -
Install dependencies:
npm install
-
Create a
.envfile based on.env.example(no environment variables needed) -
Start the development server:
npm run dev
You can add sample data by making POST requests to the API endpoints or by creating a seed script.
Example hospitals and departments can be added via the admin interface or API calls.
POST /api/auth/signup- Create user accountGET /api/auth/me- Get current user info
GET /api/hospitals- Get all hospitalsPOST /api/hospitals- Create hospital (admin)GET /api/departments- Get all departmentsGET /api/departments/hospital/:hospitalId- Get departments by hospital
POST /api/appointments- Book appointmentGET /api/appointments/user- Get user's appointmentsPOST /api/appointments/validate-token- Validate QR tokenPUT /api/appointments/:id/complete- Mark appointment completeGET /api/appointments- Get all appointments (admin)
POST /api/emergency- Create emergency alertGET /api/emergency- Get all emergency alerts (admin)PUT /api/emergency/:id/resolve- Resolve emergency alert
- User Registration: Sign up with email/password
- Browse & Book: Select hospital, department, and available time slot
- Token Generation: Receive unique token with QR code
- Admin Validation: Admin scans QR code to validate check-in
- Emergency Alerts: Users can send emergency alerts that appear in real-time on admin dashboard
- Appointment Completion: Admin marks appointments as completed
queuezero/
├── backend/
│ ├── src/
│ │ ├── controllers/
│ │ ├── models/
│ │ ├── routes/
│ │ ├── middlewares/
│ │ └── index.js
│ ├── package.json
│ └── .env.example
├── frontend/
│ ├── src/
│ │ ├── components/
│ │ ├── pages/
│ │ ├── store/
│ │ ├── lib/
│ │ └── App.jsx
│ ├── package.json
│ └── .env.example
└── README.md
- Frontend: React, React Router, TailwindCSS, Axios, Zustand, Socket.io Client, QRCode React
- Backend: Node.js, Express.js, MongoDB, Mongoose, Socket.io, JWT, bcrypt
- Authentication: JWT with bcrypt password hashing
- Real-time Communication: Socket.io
- QR Code Generation: qrcode library
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.