v2.0.0 Β· A self-hostable web platform that helps communities share resources and coordinate during crises β including when the internet is gone.
Vision | Dual-State Architecture | Tech Stack | Quick Start | System Requirements | Project Structure | Offline-First Mesh | API | Roadmap | Telegram Bot | Contributing | License
Modern neighbourhoods have everything they need β the problem is that resources sit idle in individual households. NeighbourGood makes it easy to share tools, vehicles, equipment, food, and skills within a community, reducing waste and building real connections between neighbours.
But sharing goes beyond convenience. When a crisis hits β a flood, a power outage, a pandemic β the same network that shared a drill last Tuesday becomes a lifeline. NeighbourGood's dual-state architecture switches the platform from everyday comfort mode into emergency coordination mode with a single action.
The default mode focuses on community building and resource sharing:
- Resource Library β List and browse items available for borrowing (tools, vehicles, electronics, furniture)
- Skill Exchange β Offer and request skills (tutoring, repairs, cooking, languages)
- Calendar Booking β Reserve items with date/time slots
- Community Events β Organise and RSVP to local events (repair cafΓ©s, workshops, seed swaps, meetups)
- Trust & Reputation β Earn reputation points, collect trust badges (Reliable Borrower, Trusted Lender, Skilled Helper), review skills and lending experiences, public user profiles
- Community Feed β Updates, requests, offers in a neighbourhood timeline
Activated by an admin or community vote when an emergency occurs:
- Low-Bandwidth UI β Text-based, high-contrast, no heavy images
- Essential Resources Focus β Food stocks, water filters, generators, medical supplies
- Emergency Ticketing β Replace booking with Request / Offer / Emergency Ping
- Neighbourhood Leaders β Pre-defined coordinators who can triage and assign
- Offline-First β PWA with local caching, BLE mesh networking for internet-free crisis coordination
| Layer | Technology | Why |
|---|---|---|
| Backend | Python + FastAPI | Lightweight, async, easy to extend with AI later |
| Frontend | SvelteKit | Fast, small bundles, good PWA/offline support |
| Database | PostgreSQL (prod) / SQLite (dev) | PostgreSQL in Docker for production, SQLite for quick local dev |
| Deployment | Docker Compose | Single docker-compose up to run everything |
Docker Compose starts three containers: PostgreSQL database, Python/FastAPI backend, and SvelteKit frontend. Everything is wired together automatically.
Prerequisites: Docker 24+ and the Compose v2 plugin (docker compose β note: no hyphen).
# 1. Clone the repository
git clone https://github.com/neighbourgood/neighbourgood.git
cd neighbourgood
# 2. Create your config file from the template
cp .env.example .env
# 3. Generate a secret key β the app refuses to start without one
echo "NG_SECRET_KEY=$(openssl rand -hex 32)" >> .env
# 4. Build images and start all services (first run takes ~2β3 min)
docker compose up --buildOnce you see Application startup complete in the backend logs, the stack is ready:
| Service | URL | What it is |
|---|---|---|
| Web app | http://localhost:3800 | Main SvelteKit frontend β open this in your browser |
| API | http://localhost:8300 | FastAPI backend (JSON responses) |
| Interactive API docs | http://localhost:8300/docs | Swagger UI β explore and test every endpoint |
| Alternative API docs | http://localhost:8300/redoc | ReDoc-style reference |
First time? Navigate to http://localhost:3800, click Sign Up, create an account, then go through the onboarding flow to create or join a community.
Frontend User Onboarding
--
# Start in the background (detached mode)
docker compose up --build -d
# Stream logs while running in the background
docker compose logs -f
### Local Development
# Stop everything (data is preserved in the postgres volume)
docker compose down
# Stop and wipe ALL data (fresh start)
docker compose down -v
# Rebuild a single service after a code change
docker compose up --build backend# Apply Alembic migrations on a running stack
docker compose exec backend alembic upgrade headgit pull
docker compose up --build -dUse this when you want fast hot-reload and don't need a full Postgres instance. The backend defaults to SQLite.
Backend β runs on http://localhost:8300
cd backend
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
# NG_DEBUG=true allows the default secret key and uses SQLite
NG_DEBUG=true uvicorn app.main:app --reload --port 8300Frontend β runs on http://localhost:5173
cd frontend
npm install
npm run devThe Vite dev server automatically proxies /api/* requests to the backend at :8300, so you only need to open http://localhost:5173 in your browser.
| Service | URL |
|---|---|
| Web app (dev) | http://localhost:5173 |
| Backend API | http://localhost:8300 |
| API docs | http://localhost:8300/docs |
| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 1 vCPU | 2 vCPU |
| RAM | 512 MB | 1 GB |
| Disk | 5 GB | 20 GB |
| OS | Linux (any modern distro) | Ubuntu 22.04 LTS |
| Docker | 24+ | latest |
| Docker Compose | v2 plugin | latest |
| Open ports | 80, 443 (or 3800/8300 direct) | + 22 for SSH |
A $5β6/month VPS (e.g. Hetzner CX11, DigitalOcean Basic) is sufficient for a small community (< 200 users). PostgreSQL runs inside Docker β no separate DB server needed.
The smart matching engine and Telegram AI assistant support an optional LLM backend (Ollama or any OpenAI-compatible API). If you want to run AI locally:
| Resource | Minimum | Notes |
|---|---|---|
| CPU | 4+ cores | Inference is slow on < 4 cores |
| RAM | 8 GB | 16 GB recommended for 7B models |
| Disk | 10 GB extra | Per model (e.g. llama3.2:3b β 2 GB, mistral:7b β 4 GB) |
| GPU (optional) | CUDA / ROCm / Apple Silicon | Dramatically faster; not required |
Recommended model for low-resource hosts: llama3.2:3b via Ollama. See TELEGRAM_SETUP.md for configuration. Without a local LLM configured, all features remain available β AI re-ranking simply falls back to rule-based matching.
neighbourgood/
βββ backend/
β βββ app/
β β βββ main.py # FastAPI application entry point
β β βββ config.py # Settings and environment config
β β βββ database.py # SQLAlchemy database setup
β β βββ dependencies.py # Auth dependencies (get_current_user)
β β βββ models/ # SQLAlchemy models (User, Resource, Booking, Message, Community)
β β βββ routers/ # API route handlers
β β βββ schemas/ # Pydantic request/response schemas
β β βββ services/ # Business logic (auth, JWT, email notifications)
β βββ alembic/ # Database migrations
β βββ tests/ # Backend tests
β βββ requirements.txt
β βββ Dockerfile
βββ frontend/
β βββ src/
β β βββ routes/ # SvelteKit pages
β β βββ lib/ # Shared components, API client, stores
β β βββ app.css # Global styles (Blue/Red Sky themes)
β βββ static/ # Static assets and PWA manifest
β βββ package.json
β βββ Dockerfile
βββ docker-compose.yml # One-command deployment
βββ .env.example # Configuration template
βββ CHANGELOG.md
βββ README.md
When the internet goes down, NeighbourGood keeps working. In Red Sky mode the web app can connect to a nearby native BitChat node over Bluetooth Low Energy (BLE) and relay crisis data β emergency tickets, votes, pings β through the mesh without any internet connectivity at all.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β INTERNET DOWN β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββ
β NeighbourGood β β NeighbourGood β
β Web App (Chrome) β β Web App (Chrome) β
β β β β
β [Connect to Mesh] btn β β Receives mesh tickets β
β Status: β Connected β β with "via BLE mesh" badge β
ββββββββββββ¬βββββββββββββββ ββββββββββββββββ¬ββββββββββββββββββ
β Web Bluetooth (1 GATT connection) β Web Bluetooth
β β
ββββββββββββΌβββββββββββββββ ββββββββββββββββΌββββββββββββββββββ
β BitChat Native Node β β BitChat Native Node β
β (iOS / Android) β β (iOS / Android) β
β β β β
β Acts as BLE relay ββββββββββΊ Acts as BLE relay β
β Handles mesh routing β BLE β Handles mesh routing β
β Multi-hop, up to 7 hopsβ Mesh β Store-and-forward β
ββββββββββββ¬βββββββββββββββ ββββββββββββββββ¬ββββββββββββββββββ
β β
ββββββββββββββββββββ¬βββββββββββββββββββββ
β
ββββββββββββββββββββΌβββββββββββββββββββββ
β More BitChat nodes in the β
β neighbourhood β no limit on count β
β or distance (up to 7 hops / ~700m) β
βββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β INTERNET RETURNS β
β β
β NeighbourGood shows "Sync N messages" button β
β POST /mesh/sync β server deduplicates by message UUID β
β Emergency tickets and votes appear on the server β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Every NeighbourGood crisis action (create ticket, cast vote) is wrapped in a small JSON envelope and encoded as a standard BitChat broadcast message:
{
"ng": 1,
"type": "emergency_ticket",
"community_id": 42,
"sender_name": "Alice",
"ts": 1741910400000,
"id": "550e8400-e29b-41d4-a716-446655440000",
"data": {
"title": "Need drinking water β north block",
"ticket_type": "request",
"urgency": "critical"
}
}Native BitChat apps relay this message through the mesh without needing to understand its contents. Other NeighbourGood web clients receive it and display it immediately with a "via BLE mesh" badge.
Requirements: Chrome or Edge (desktop or Android). Web Bluetooth is not available in Firefox or Safari. A nearby device running the native BitChat app is required.
- Switch your community to Red Sky mode β the mesh panel only appears during crises.
- Open the Emergency (Triage) page in Chrome.
- Click "Connect to Mesh" β Chrome shows a device picker listing nearby BitChat nodes.
- Select a node β the status dot turns green and peer count appears.
- Create emergency tickets offline β the form button becomes "Broadcast via Mesh". Your ticket travels through the BLE mesh to other NeighbourGood users.
- When internet returns β click "Sync N messages" to push mesh-received data to the server. The server deduplicates by message UUID so re-syncing is safe.
| Decision | Rationale |
|---|---|
| Gateway model (1 BLE connection) | Web Bluetooth supports only 1β2 simultaneous connections; native apps do the multi-hop routing |
| Native fork unmodified | NG data is encoded as standard BitChat broadcast messages β no Swift/Kotlin changes needed |
| JSON in bitchat body | Simple, debuggable, and relay-transparent β native nodes forward without parsing |
| UUID deduplication on server | Safe to replay mesh sync multiple times; idempotent regardless of network partitions |
| Chrome/Edge only | Web Bluetooth standard; Firefox/Safari do not support it as of 2026 |
See API_ENDPOINTS.md for the full endpoint reference. Interactive docs at /docs when the backend is running.
- Project scaffold (FastAPI + SvelteKit + Docker)
-
/statusendpoint with dual-mode indicator - Blue Sky / Red Sky CSS theme system
- User registration and authentication (JWT)
- User profiles with neighbourhood assignment
- Basic resource listing (CRUD for items)
- Resource detail page
- SQLite database with Alembic migrations
- Resource categories (tools, vehicles, electronics, furniture, food, clothing)
- Image upload for resources
- Search and filter resources
- Calendar-based booking system
- Request/approve flow for borrowing
- User messaging (in-app)
- Email notifications
- Skill exchange listings (offer/request with 10 categories)
- Reputation/trust score system (computed from activity, 5 levels)
- Community feed / activity timeline (auto-generated from events)
- Community events β create, browse, RSVP; 9 categories, upcoming filter, max-attendee cap (v1.8.0)
- Neighbourhood groups (Hybrid: PLZ-based with custom names)
- Community merge function with auto-suggestions
- Onboarding flow (search/join/create community)
- Community-scoped resources (soft scoping with community_id)
- Instance identity and
/instance/infoendpoint (federation prep) - PostgreSQL production default (Docker Compose)
- Invite system for new members (code-based, with expiry/max uses)
- Rating and review system for transactions (1-5 stars, per-booking)
- Skill reviews & endorsements β community members can rate skill providers (v2.0.0)
- Trust badges β Reliable Borrower, Trusted Lender, Skilled Helper (v2.0.0)
- Public user profile page with trust summary, badges, and paginated reviews (v2.0.0)
- Instance metadata with admin accountability (name, region, contact)
-
/instance/infopublic endpoint for directory crawling - Instance directory (discover other NeighbourGood instances)
- Cross-instance Red Sky alerts
- User data export (portable backup)
- Instance migration tooling
- Admin toggle for crisis mode (per-community)
- Community vote mechanism for mode activation (60% threshold)
- Emergency ticketing system (Request / Offer / Emergency Ping)
- Neighbourhood leader roles and assignment
- Explore page with community map for unregistered users
- Low-bandwidth UI variant (text-only, image-free mode)
- Essential resource inventory tracking (quantity-based stock management)
- Priority-based ticket triage (triage dashboard for leaders/admins)
- Password strength validation (min 8 chars, uppercase + lowercase + digit)
- Email format validation (EmailStr)
- Security response headers (X-Content-Type-Options, X-Frame-Options, Referrer-Policy, Permissions-Policy, HSTS)
- Secret key validation (reject default key in production, require 32+ chars)
- File upload hardening (magic byte validation, extension sanitisation)
- Input length limits on all user-facing schemas
- Rate limiting on auth endpoints (login, register) β 5 req/min; general 60 req/min; uploads 10 req/min (v1.7.0)
- Account lockout after repeated failed login attempts β 5 failures in 15 min β 15-min lockout (v1.7.0)
- CSRF protection for state-changing operations β Origin + X-CSRF-Token validation (v1.7.0)
- Session invalidation on password change
- Audit logging for admin actions
- Field-level encryption for sensitive data (email, messages)
- Automated database backups with encryption at rest
- PII anonymisation for deleted accounts
- Content Security Policy tuning per route
- Dependency vulnerability scanning (CI integration)
- Full PWA with service worker caching (v0.9.9)
- Offline item browsing and request queuing (v1.1.0)
- Background sync when connectivity returns (v1.1.0)
- Data export and backup tools (v1.1.0)
- BLE mesh gateway for internet-free crisis coordination (v1.2.0)
- TLS certificate automation (Let's Encrypt)
- Container image scanning and hardening
- Network segmentation (backend β database)
- Secrets management (Vault / sealed secrets)
- Incident response runbook
- Smart matching with AI enhancement (v1.5.0) β rule-based skill/resource matching + optional Ollama/OpenAI re-ranking
- Mesh networking (BitChat BLE gateway) (v1.2.0) β offline crisis comms via Bluetooth mesh
- Decentralized data sync between instances (v1.4.0) β pull-based federation sync with public snapshot endpoint, incremental cursors, and federated resource/skill browsing
- Federation explorer UI (v1.9.0) β instance directory browser, federated resource/skill pages, cross-instance alert banners, enriched instance stats
- Enhanced BLE mesh networking (v1.9.5) β 10-phase overhaul: mesh dashboard, auto-sync, resource sharing, check-ins, multi-hop relay, E2E encryption, analytics
- Multi-language support (i18n) (v1.1.0) β 12 languages with RTL support
- Community events (v1.8.0) β create, browse and RSVP to local events (repair cafΓ©s, workshops, seed swaps, meetups); 9 categories, max-attendee cap, upcoming filter, full-text search
- Admin dashboard with analytics
- Outbound webhook system with HMAC-SHA256 signing (generic integrations)
- Telegram bot integration (personal notifications, community group alerts, bot commands) + AI natural language interface (v1.6.0)
- Signal integration
- Matrix integration
NeighbourGood includes a Telegram bot with an AI-powered natural language interface β members can search resources, find skills, and coordinate during crises directly from Telegram without opening the app.
See TELEGRAM_SETUP.md for the full setup guide, including:
- Creating and configuring your bot
- Linking personal accounts and community groups
- Setting up local AI with Ollama (model recommendations included)
- What the agent can and cannot do
- Slash command reference and notification event table
To customise the agent's behaviour, tone, or available intents, see TELEGRAM_AGENT.md.
This project is in its early stages. Contributions, ideas, and feedback are welcome.
See LICENSE for details.