An offline-first, peer-to-peer emergency communication system built to communicate in disaster-prone areas where there is no connectivity to the internet.
In areas hit with natural disasters tend to have no internet connectivity. Using this system, any number of devices (rescue teams or civilians) can communicate with each other as long as they are connected to the same network via WiFi/hotspot/ethernet LAN.
It uses js-libp2p to establish peer-to-peer connections. Creates a Chat Room abstraction, allowing multiple users to communicate in the chat room. Requires a known service tag (--same_string) and room name to connect to peers.
- 🌐 P2P Networking — Direct device-to-device communication using libp2p
- 📡 Auto Discovery — Automatic peer discovery via mDNS on local networks
- 💬 Chat Rooms — Join topic-based chat rooms with GossipSub pub/sub
- 🔌 REST API — HTTP endpoints for frontend integration
- ⌨️ CLI Interface — Send messages directly from terminal
- 📝 Message Logging — All messages saved to logs
EmergencyNet/
├── backend-js/ # Node.js P2P backend
│ ├── src/
│ │ ├── index.js # Main entry point
│ │ └── p2p/ # libp2p modules
│ └── package.json
├── frontend/ # React UI
│ └── src/
└── README.md
cd backend-js
npm install
node src/index.js --port 9000 --same_string mynetwork --room emergency --nick Rescue1 --enable-httpcd frontend
npm install
npm run devnode src/index.js --port 9001 --same_string mynetwork --room emergency --nick Rescue2Important: All devices must be connected to the same WiFi/LAN network, and
--same_stringmust match for peer discovery to work.
| Option | Description | Default |
|---|---|---|
--port <port> |
TCP port for P2P connections | 9000 |
--nick <name> |
Your display name in chat | ABHI |
--room <name> |
Chat room to join | chat-room |
--same_string <string> |
Network identifier for peer discovery | disasternet |
--enable-http |
Enable REST API on port 3001 | false |
Uses mDNS (Multicast DNS) to discover peers in the same LAN network.
Multicast DNS (mDNS) is a computer networking protocol that resolves hostnames to IP addresses within small networks that do not include a local name server. It is a zero-configuration service.
- 🚨 Disaster Relief — Coordinate rescue teams when cell towers are down
- 🏕️ Remote Camps — Communicate across a campsite with no WiFi
- 🏢 Local Events — Offline messaging at conferences or festivals
- 🔒 Private Networks — Secure, local-only communication
- Backend: Node.js, libp2p, Express
- Frontend: React, TypeScript, Vite, Tailwind CSS
- P2P: GossipSub, mDNS
MIT
Created by Aryan
