KADSEMA SENTINEL — Multi-hazard Early Warning & Emergency Operations Platform for Kaduna State
# KADSEMA SENTINEL
**Multi-hazard early-warning & emergency operations platform** for the Kaduna State
Emergency Management Agency (KADSEMA).
One connected internal product: EOC command dashboard · GIS risk map · incident
lifecycle management · early-warning console · mobile field app. Built React + Vite,
with an env-switchable data layer — runs fully offline for demos, or against a live
PostgreSQL/PostGIS backend for production.
---
## Quick start
```bash
git clone kadsema-sentinel
cd kadsema-sentinel
nvm use # Node 18+ (see .nvmrc)
npm install
cp .env.example .env
npm run dev #
localhost
```
Out of the box it runs in **local mode** — full working app, browser persistence, no
backend required. This is the Phase-0 demo build.
---
## Data modes
The entire app talks to one store interface (`window.SentinelStore`). You choose its
implementation with a single env var — **no view code changes between modes**.
| `VITE_DATA_MODE` | Store | Use for |
|---|---|---|
| `local` (default) | `src/lib/store.local.js` — localStorage | Demos, offline, UI work |
| `supabase` | `src/lib/store.supabase.js` — live DB + realtime | Phase-1 production |
### Going live (Supabase)
1. Create a project at supabase.com.
2. SQL Editor → run in order:
- `supabase/schema.sql` — tables, RLS, `log_incident` RPC, `sentinel_role()` helper
- `supabase/seed.sql` — 23 LGAs, gauges, triggers, demo incidents
- `supabase/functions/dispatch-alert/dispatch-alert.sql` — delivery tables + invoke trigger
3. Enable realtime: uncomment the final line of `supabase/schema.sql`.
4. In `.env`:
```
VITE_DATA_MODE=supabase
VITE_SUPABASE_URL=
your-project.supabase.co
VITE_SUPABASE_ANON_KEY=your-anon-key
```
5. `npm run dev` — the same UI is now a live multi-user client with role-based access
(HQ · Zonal · LGA · Community) enforced by Postgres row-level security.
Full runbook, GIS-boundary loading, and integration hooks (SMS/USSD, NiMet, NIHSA,
Kobo): see `docs/Deploymen …