DhawTN — A real-time crowdsourced power outage platform for Tunisia built with Next.js, PostGIS, Supabase, Redis, WebSockets and PWA offline capabilities.
# ⚡ DhawTN
> **Community-powered real-time electricity outage tracker for Tunisia.**
DhawTN is an open-source Progressive Web App (PWA) that enables Tunisian citizens to report, monitor, and receive real-time notifications about electricity outages across the country.
Instead of relying solely on official communication, DhawTN aggregates community reports, applies a spatial consensus algorithm, and displays verified outages on an interactive map.
## 📷 Preview
## 🌍 Why DhawTN?
Power outages affect thousands of homes and businesses every year in Tunisia.
Unfortunately, there is no public real-time outage map.
**DhawTN aims to solve this by:**
- ⚡ Crowdsourcing outage reports
- 🗺️ Visualizing outages on a live interactive map
- 📍 Detecting affected neighborhoods automatically
- 🔔 Notifying users when power is restored
- 📱 Working even during poor network conditions (PWA + Offline Mode)
---
## ✨ Features
- 🗺️ Live outage map
- 📍 Automatic GPS location
- ⚡ One-click outage reporting
- 🤝 Community consensus validation
- 🔴 Live outage status
- 🟢 Power restoration detection
- 🔔 Push Notifications
- 🌐 Progressive Web App (Installable)
- 📶 Offline support
- 🌙 Mobile-first dark interface
- 🚀 Real-time updates
- 🔒 Anonymous reporting
---
## 🏗 Tech Stack
### Frontend
- Next.js 15
- TypeScript
- TailwindCSS
- Leaflet
- React Leaflet
- GSAP
- React Query
### Backend
- Supabase
- PostgreSQL
- PostGIS
- Redis (Upstash)
- Edge Functions
### GIS
- OpenStreetMap
- GADM Administrative Boundaries
- Turf.js
### Deployment
- Vercel
- Netlify
---
## 🧠 How it Works
```text
Citizen reports outage
│
▼
Location is verified
│
▼
Spatial Consensus Engine
(PostGIS + Turf)
│
▼
Outage Confirmed
│
▼
Live Map Updated
│
▼
Push Notification
```
---
## 📍 Outage Consensus
To reduce spam and false reports, DhawTN validates reports using a consensus algorithm.
A zone becomes **Confirmed Outage** when:
- at least **3 different users**
- report a power outage
- within ** …