Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EmergencyNet

An offline-first, peer-to-peer emergency communication system built to communicate in disaster-prone areas where there is no connectivity to the internet.

EmergencyNet UI

What's the need for this?

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.

How does this work?

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.

Features

  • 🌐 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

Project Structure

EmergencyNet/
├── backend-js/          # Node.js P2P backend
│   ├── src/
│   │   ├── index.js     # Main entry point
│   │   └── p2p/         # libp2p modules
│   └── package.json
├── frontend/            # React UI
│   └── src/
└── README.md

Quick Start

1. Start the Backend

cd backend-js
npm install
node src/index.js --port 9000 --same_string mynetwork --room emergency --nick Rescue1 --enable-http

2. Start the Frontend

cd frontend
npm install
npm run dev

3. Start additional nodes on other devices

node src/index.js --port 9001 --same_string mynetwork --room emergency --nick Rescue2

Important: All devices must be connected to the same WiFi/LAN network, and --same_string must match for peer discovery to work.

CLI Options

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

How Peer Discovery Works

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.

Use Cases

  • 🚨 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

Tech Stack

  • Backend: Node.js, libp2p, Express
  • Frontend: React, TypeScript, Vite, Tailwind CSS
  • P2P: GossipSub, mDNS

License

MIT


Created by Aryan

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages