Civic intelligence template · v1.0

Town Warden

A live, cloneable civic-intelligence template for UK towns. Built with Python, FastAPI, PostgreSQL, WebSockets, public data sources and a static JavaScript dashboard. Default example town: Blackpool.

Python FastAPI PostgreSQL SQLite fallback WebSockets JavaScript Leaflet Netlify Render Civic tech Public data

Town Warden is an experimental civic-tech template. It is not an official council, police, NHS or emergency service, and does not provide operational or emergency-live data.

Project snapshot

At a glance

TypeCivic intelligence town-template
Default townBlackpool, UK
FrontendStatic HTML / CSS / JavaScript
BackendPython FastAPI
RealtimeWebSockets
StoragePostgreSQL production, SQLite local fallback
HostingNetlify + Render
Street ManagerLive, Blackpool-filtered
TestingBackend tests passing
Statusv1.0 cloneable town-template / serious beta
Overview

An early civic nervous system for one town

Town Warden v1.0 is a live, full-stack civic-intelligence dashboard and a cloneable town-template for UK towns. It monitors public data sources, converts them into structured civic events, deduplicates repeated records, monitors source health, runs rule-based agents, and surfaces source-aware insights on a public dashboard. The default example town is Blackpool, but the project is now configurable through town-config files so other towns can be set up from the same codebase.

The aim was to explore whether a town-focused digital system could act like an early civic nervous system: not replacing official services, but organising scattered public signals into something easier to understand — and to make that pattern reusable beyond a single town.

The solution

What Town Warden actually does

Source-aware ingestion, normalisation, and a public-friendly read of the result.

Public data ingestion

Connectors pull from Police.uk, Open-Meteo and Street Manager on a regular cadence.

Street Manager live

Real street works webhooks are received, normalised, deduplicated and filtered to the Blackpool pilot area.

Civic event normalisation

Source-specific records are converted into a single structured civic event shape.

Deduplication guard

Repeated records cannot be saved or processed twice, so signals do not get inflated.

Source health monitoring

Each connector is tracked for freshness, errors and coverage.

Analytics, history and civic risk

Endpoints for analytics, event history, map data and civic-risk scoring are implemented.

Rule-based agent insights

Lightweight agents produce readable insight cards from the latest civic events.

System health

A system-health view summarises source status and overall service condition.

Public dashboard

Source-aware wording for residents, with cautious framing on coverage gaps.

Developer dashboard

Diagnostics and source detail kept separate from the public UX.

Protected /dev routes

Production developer routes guarded by an x-admin-token header, with the token kept server-side only.

Interactive risk map

A Blackpool risk and signal map plotting recent events and risk overlays.

Town-config driven

Town setup is driven by configuration files, so the codebase can be cloned and re-targeted to other UK towns.

Architecture

How the system fits together

A single direction of flow from public sources to the public dashboard.

  1. 1Public data sourcesPolice.uk, Open-Meteo, Street Manager (live, Blackpool-filtered)
  2. 2ConnectorsPer-source modules that fetch and shape raw data
  3. 3FastAPI backendNormalises events, runs deduplication, exposes the API
  4. 4PostgreSQL production storePostgreSQL on Render in production, with SQLite fallback for local development
  5. 5Rule-based agentsProduce insight cards from recent events
  6. 6API + WebSocket layerREST endpoints plus a live update channel
  7. 7Public + developer dashboardsPublic read for residents, separate diagnostics view
Interface

What residents and developers see

Two surfaces, one backend, deliberately different in tone.

Public status page

A readable status view for residents covering town health, active sources, signals, risk zones and insights.

Interactive Blackpool map

Leaflet-based map with risk overlays and recent civic signals plotted spatially.

Source-aware insight cards

Agent insights that name their source and acknowledge coverage limits.

Developer diagnostics

A separate dashboard for connection status, source coverage caveats and raw signals.

Public dashboard overview
Public dashboard overview
Blackpool risk and signal map
Blackpool risk and signal map
Agent Insights cards
Agent Insights cards
Developer diagnostics
Developer diagnostics dashboard
Backend API docs
Backend API docs
Technical implementation

Stack and shape of the build

Backend

Python FastAPI app

  • REST endpoints for source health, history, analytics, map data, civic risk, system health, insights and agent logs
  • WebSocket endpoint for live updates to the dashboard
  • PostgreSQL in production via DATABASE_URL
  • SQLite fallback for local development
  • Connector modules per public data source (Police.uk, Open-Meteo, Street Manager)
  • Agent modules for rule-based civic signal processing
  • Protected admin / dev routes via x-admin-token
  • Tests for core backend behaviour, currently passing
  • Town-config driven setup so the same codebase can be re-targeted to other UK towns
  • Render deployment with production environment variables
Frontend

Static HTML, CSS, JavaScript

  • No build step — deployed as static assets to Netlify
  • Automatic local / live backend switching
  • Public and developer dashboards as separate surfaces
  • Leaflet map for spatial risk and signal display
  • Lightweight, mobile-friendly layout
Security and responsible design

Built carefully, not just quickly

Public-facing language and developer tooling are deliberately kept apart.

  • Developer dashboard kept entirely separate from the public dashboard
  • Backend /dev routes protected in production with an x-admin-token header
  • Admin token kept server-side only — never exposed to the browser
  • No secrets in frontend JavaScript
  • Public-safe wording, with no official-sounding claims
  • Insights are framed as source-limited signals, not official conclusions
  • Dashboard includes an experimental / not-official disclaimer
What I learned

First serious backend-led project, end to end

Through Town Warden, I built and shipped my first serious backend-led project end to end — from prototype to a v1.0 cloneable town-template. I worked with FastAPI, REST endpoints, WebSockets, public APIs, PostgreSQL on Render with a SQLite fallback for local work, backend tests, town-config driven setup, Netlify, Render and GitHub release workflows.

The biggest learning was not just making data appear on a screen, but making it trustworthy: deduplicating repeated records, tracking source health, separating developer tools from public UX, protecting /dev routes, and writing insights that are cautious about source coverage.

Challenges

Honest limits of v1.0

What the system cannot yet claim, and where the rough edges still are.

Public data is incomplete and delayed

Source feeds can be delayed, patchy, or formatted unexpectedly — Town Warden makes those gaps visible rather than hiding them.

Police.uk is not live ops data

It is public source intelligence, not emergency-live operational data.

Open-Meteo rate limits

Active and useful, but it can rate-limit and needs graceful handling.

Street Manager relevance filtering

Filtering live street works to the Blackpool pilot area requires careful geography rules to avoid noise from neighbouring authorities.

GIS boundaries still need refinement

Risk mapping and pilot-area boundaries are usable but rough, and need better boundary data to firm up.

Not official operational data

Town Warden is an experimental civic-tech template. It does not replace council, police, NHS or emergency advice, and should not be treated as operational data.

Federation is documented, not implemented

The Town Warden Network / cross-town federation is a documented direction, not a shipped feature in v1.0.

Roadmap

Where it goes from here

Short-term

Polish v1.0

  • Polish the case study and screenshots
  • Refine GIS boundaries for the pilot area
  • Improve mobile UX
Medium-term

Harden the platform

  • Stronger monitoring and observability
  • Fuller authentication and admin UI
  • More town configurations on the same codebase
Long-term

Town Warden Network

  • Town Warden Network / federation
  • Trusted town-node federation
  • Public-safe cross-town summaries
  • Regional pattern agents
How I describe this project

CV / interview summary

A short pitch and the supporting points behind it.

Town Warden is a live full-stack civic-tech dashboard and a cloneable UK town-template that ingests public data, normalises civic events, deduplicates repeated records, monitors source health, generates rule-based agent insights, and runs on a FastAPI / PostgreSQL backend with a static Netlify frontend.

  • Built and deployed a live FastAPI backend with WebSocket updates for a real-time civic-intelligence dashboard.
  • Integrated public data sources including Police.uk, Open-Meteo and a live Street Manager webhook feed filtered to the Blackpool pilot area.
  • Implemented deduplication logic to prevent repeated public records from being saved or processed multiple times.
  • Added source health, analytics, history, map data, civic-risk scoring, system health and rule-based agent insight generation.
  • Ran the production backend on PostgreSQL via DATABASE_URL, with a SQLite fallback for local development.
  • Wrote backend tests for core behaviour, currently passing in the v1.0 release.
  • Made the project town-config driven and shipped v1.0-town-template as a cloneable UK town-template.
  • Deployed the frontend on Netlify and the backend on Render with Git/GitHub for version control and deployment workflow.
  • Separated the public dashboard from developer diagnostics and protected production /dev routes with an x-admin-token.
  • Designed a public-facing interface with cautious, source-aware language and an interactive Blackpool map.
Take a look

See Town Warden in action

Town Warden v1.0 is live and cloneable for other UK towns. It is honest about what it is — an experimental civic-tech template, not an official council, police, NHS or emergency service.