A Node.js + Express REST API and real-time WebSocket server for the Fire Eyes Dashboard.
This backend manages users, fire/gas alerts, and provides instant updates to all connected clients.
The Fire Eyes backend powers a real-time fire and gas safety dashboard.
It handles user/device registration, alert creation, status updates, and broadcasts all changes instantly via Socket.IO.
👉 Looking for the frontend? Check out the dashboard here:
🔗 Fire Eyes Dashboard (Frontend)
- User registration and management
- Device-based user lookup
- Fire and gas leak alert creation
- Alert status updates (active, acknowledged, resolved)
- Real-time alert push via WebSockets (Socket.IO)
- MongoDB integration with Mongoose
- CORS support for frontend integration
- Node.js
- Express.js
- MongoDB + Mongoose
- Socket.IO
- dotenv
-
Clone the repository:
git clone https://github.com/md8-habibullah/fire-eyes-backend.git cd fire-eyes-backend -
Install dependencies:
npm install
-
Set up environment variables:
Create a
.envfile in the root directory with:MONGO_URI=your_mongodb_connection_string MONGO_DB=fire-eyes
-
Start the server:
npm run dev
The backend will run on http://localhost:5000 by default.
fire-eyes-backend/
├── controllers/ # Business logic for users and alerts
│ ├── alertController.js
│ └── userController.js
├── models/ # Mongoose schemas
│ ├── Alert.js
│ └── User.js
├── routes/ # Express route handlers
│ ├── alerts.js
│ └── users.js
├── config.js # MongoDB connection
├── index.js # Main server entry (Express + Socket.IO)
├── .env
├── package.json
└── README.md
POST /api/users/register— Register a new user/deviceGET /api/users— List all usersPUT /api/users/:id— Update user infoDELETE /api/users/:id— Delete a user
POST /api/alerts— Create a new alert (fire/gas)GET /api/alerts/active— Get all active/acknowledged alertsPATCH /api/alerts/:alertId— Update alert statusGET /api/alerts/user/:deviceId— Get all alerts for a device
- WebSocket (Socket.IO) events:
new_alert— Sent to all clients when a new alert is createdalert_updated— Sent to all clients when an alert status changes
Example .env:
MONGO_URI=your_mongodb_connection_string
MONGO_DB=fire-eyesPull requests and suggestions are welcome!
Please open an issue or PR for improvements.
- Fire & Gas animated icons:
Freepik - Flaticon
Made with ❤️ for fire and gas safety.