Skip to main content
Case Study · NeyborHuud

Engineering an AI-powered community operating system.

A hyperlocal platform where a Nigerian neighborhood gets safety, commerce, and trust as native primitives — with geography itself as the schema.

Administrative-boundary geofencingHybrid AI threat detectionTiered SOS escalationTrust ledger
01 — Problem

The neighborhood is invisible to apps built for the planet.

Facebook, WhatsApp and X are built for planetary reach. That scope generates a constant hum of noise that drowns out the one thing that governs daily life — what is happening on your street, right now. In urban Nigeria that gap isn't an inconvenience; it's a safety and economic problem.

Security

Neighborhood watch runs on tangled WhatsApp threads and physical sirens — no real-time escalation, no location streaming, no reliable way to reach the people who could actually help.

Trust

Buyers fear paying upfront; sellers fear pay-on-delivery. The electrician two doors down is invisible to the neighbor who needs one.

Network

Global apps assume LTE and a flagship phone, and fall over on the 2G/3G networks much of suburban and rural Nigeria runs on.

02 — Thesis

Geography is the schema.

Every post, alert, and listing is bound to physical coordinates and routed through Nigerian Wards and Local Government Areas. The neighborhood is not a filter applied to a social graph — it is the graph. Three pillars sit on that spatial foundation.

Sentinel AI

Real-time threat analysis and a self-terminating SOS escalation ladder.

HuudCoin & Escrow

A hyperlocal marketplace protected by community-backed Social Witness Escrow.

TrustOS

A reputation ledger turning physical validation into a portable numeric score.

03 — Architecture

Location resolution is first-class. Safety-critical work never touches the request path.

        Mobile PWA (Next.js 16 · React 19 · Capacitor)
                 │  HTTPS / WSS
                 ▼
        API Gateway  ──  JWT · Redis sliding-window limits
                 │
   ┌─────────────┼──────────────┐
   ▼             ▼              ▼
 Identity      Safety &      Marketplace
 & TrustOS     Emergency     & Escrow
   │             │              │
   ▼             ▼              ▼
 MongoDB       MongoDB        Redis
 Better Auth   + Geo tags     + BullMQ
LayerTechnologyWhy it's there
ClientNext.js 16 · Service WorkersOffline location-log queues; Web Push without an app store
GeoHaversine matching + MongoDB tagsNearest-LGA boundary resolution and location.lga-tagged content queries
AsyncRedis + BullMQSOS escalation, emergency fan-out, trip monitoring — off the event loop
AIGoogle Gemini 2.0 FlashContextual threat scoring and search-intent parsing
IdentityBetter Auth + MongoDBSession and credential management
04 — Deep Dive

Sentinel AI: hybrid threat detection.

The naive build sends every post to an LLM and trusts the answer — slow, costly, and dangerously non-deterministic for a Level 10 emergency. Sentinel runs a three-stage cascade that only escalates to the model when it must. The geospatial clustering behind this pipeline gets its own dedicated case study.

Stage 1

Keyword prefilter

A curated security-keyword list — armed men, gunmen, car snatching, ambush, kidnap, ransom — does a cheap first pass. No match, no cost.

Stage 2

Cultural dictionary

The detail a generic build misses. Nigerian threat and scam language isn't in any English toxicity model, so Sentinel ships a hand-built cultural dictionary encoding local vernacular with severity and category — 419 and yahoo boy as high-severity scam signals, pidgin insults tagged by type.

Stage 3

Gemini scoring

Only content clearing the earlier stages reaches Gemini 2.0 Flash, which returns a contextual threat score from 0–10 — informed by keyword matches and same-LGA temporal clustering: are several people nearby reporting the same thing within the last 30 minutes?

Score ≥ 8

Red-zone. “Armed men on our street” fans out to the entire LGA immediately.

Score 3–7

Alert. Logged, surfaced to the community, watched for escalation.

Score < 3

Normal. “Water is finished” is a Level 2 utility note, not an emergency.

05 — Deep Dive

A panic-button ladder that stops itself.

The worst design is a single blast that reaches no one or spams everyone. NeyborHuud models the alarm as a time-based escalation ladder on a BullMQ worker, entirely off the request path. The cadence is configuration, not code.

t = 0s

Level 1. Notify priority-1 guardians via WebSocket, push and SMS simultaneously.

t = 30s

Level 2. Still unacknowledged? Widen to priority-2 guardians.

t = 60s

Level 3. Keep widening the ring of contacts.

t = 90s

Final. Page every remaining accepted, non-expired guardian not yet notified.

✓ ACK

Self-terminate. Before every level fires, the worker re-checks status and acknowledgments. One guardian ack short-circuits the whole ladder — no duplicate pages, no alarm that keeps screaming after help is coming.

In parallel, a Haversine distance check against connected users' live locations broadcasts to opted-in neighbors within 500 metres while the client streams a GPS trail into an append-only tracking log. Running this on durable background workers — not inline in the HTTP handler — is what lets the alarm survive a dropped connection or a slow phone.

06 — Deep Dive

A three-tab feed, ranked by LGA membership.

A broken streetlight in your LGA outranks a viral video from across the country. Rather than one flat timeline, the feed splits into three tabs, each a different content query over the same resolved location.lga field set on every post.

Home
your_huud

Local-first, blended with content from LGAs you follow.

Nearby
street_radar

Content scoped tightly to your resolved home LGA.

Extended
following_places

Content from LGAs you explicitly follow, beyond home.

07 — Deep Dive

TrustOS: a materialized ledger.

Trust is earned physically and spent digitally. Reputation is a 0–1,000 numeric score backed by an append-only event log. Every trust-affecting action writes an event with a fixed point value and updates a materialized score on the user record, so reads stay O(1).

EventΔ ScoreEffect
ID verified+200Largest single trust milestone
Constructive action+smallHelpful comment, completed job
Base (new user)300Trusted enough to join, not to abuse
Abuse penalty−300False reports, misconduct

High-trust actions like tipping are gated behind score thresholds, and Tier-3 members can vouch for a newcomer within a 500m radius — enforced with its own Haversine distance check — granting temporary trusted access.

08 — Principle

Why these choices hold together.

Core idea

Push the intelligence to the edges of a deterministic core.

The LLM scores but doesn't decide. Guardians escalate but the ladder stops itself. Geography ranks the feed but a threat score can override it. Trust is fluid but backed by an immutable ledger.

Constrained AI

Gemini is one input to a deterministic safety pipeline — never the pipeline itself.

Durable work

Safety-critical escalation lives on BullMQ workers, resilient to dropped connections.

Geo primitives

Haversine distance and LGA boundary matching power geofencing, feed ranking, fan-out, and vouching alike.

Immutable trust

An append-only ledger with a materialized read model keeps reputation fast and auditable.

That's what makes it an operating system rather than a bag of features: a small set of hard primitives — spatial boundaries, durable background work, a trust ledger, and a constrained AI layer — that every one of the 35 modules is composed from.

09 — By the numbers
35
Backend modules
0–1,000
Trust range · base 300
0–10
Threat scale · red ≥ 8
0/30/60/90s
SOS escalation cadence
3
Core datastores
500m
Vouch & SOS radius
Building something like this? Let's talk.