Live Demo: https://planpilot.ddns.net
Inspiration
Getting planning permission in the UK is a black box. Homeowners, developers, and architects spend thousands of pounds on applications with no idea whether they'll be approved. Local approval rates, flood risk, conservation zones, Article 4 directions, and market conditions all play a role, but this data is scattered across dozens of government sources and nearly impossible to interpret together.
We wanted to answer one question: "If I enter a postcode, can AI tell me whether my planning application will be approved, and why?"
What it does
PlanPilot AI is a UK planning intelligence platform. Enter a postcode and your project details, and instantly get:
- ML Approval Prediction — an XGBoost model trained on 36,000+ real planning decisions from the IBEX API predicts your probability of approval
- Viability Score — a composite 0–100 score weighing constraints, market data, and project complexity
- Constraint Mapping — flood zone, conservation area, green belt, and Article 4 direction checks via PostGIS spatial queries
- Market Intelligence — average price/m², 24-month trends, comparable sales, and EPC ratings from Land Registry and DLUHC data
- AI Strategic Report — Google Gemini 2.0 Flash generates a bespoke planning strategy report tailored to your site
- Document Upload + OCR — upload a planning PDF or image and Gemini extracts the postcode, project params, and constraints to auto-fill the form
- Comparison Mode — compare up to 3 postcodes side-by-side
- Interactive Map — Leaflet map with nearby planning applications and constraint overlays
How we built it
The stack is a Next.js 16 + FastAPI full-stack app deployed on a Vultr VPS behind Nginx with SSL:
- Frontend: Next.js 16, React 19, Tailwind CSS, Framer Motion, Leaflet maps, Supabase Auth (Google OAuth)
- Backend: FastAPI with asyncpg, JWT auth via Supabase, XGBoost ML model served in-process
- Database: Supabase PostgreSQL with PostGIS — we ingested 7 UK government datasets (flood zones, conservation areas, green belt boundaries, Article 4 directions, Land Registry price paid, EPC ratings, and 36K+ planning decisions)
- ML Pipeline: XGBoost classifier with 10 auto-fetched features per postcode (flood zone, conservation, green belt, approval rates, decision times, price/m², price trends, EPC ratings). Post-hoc heuristic adjustments personalise the prediction to the user's application type, property type, storeys, and floor area
- AI Layer: Google Gemini 2.0 Flash for strategic report generation and document OCR
Challenges we faced
- Data ingestion — loading large government shapefiles (flood zones, green belt) into PostGIS required ogr2ogr and careful coordinate system transformation. Some datasets had inconsistent schemas that needed custom parsing scripts
- PKCE auth behind a reverse proxy — Supabase OAuth uses PKCE flow with large JWT cookies. Nginx's default proxy buffer size (4–8KB) was too small, causing silent 502 errors on the auth callback. Debugging this took hours (i genuinely died) the route handler worked perfectly but Nginx couldn't forward the response. The fix was increasing
proxy_buffer_sizeand reading cookies directly from the request/response objects instead of Next.js'scookies()API - ML feature engineering — turning raw geospatial data into meaningful features required spatial joins across 7 datasets, handling missing data gracefully, and ensuring the model generalises across different UK regions
- Production deployment — configuring Next.js behind Nginx with SSL, proper forwarded headers, CORS, and Supabase redirect URLs all needed careful coordination
What we learned
- PostGIS spatial queries are incredibly powerful for cross-referencing location data
- PKCE OAuth flows and large cookies don't play well with default Nginx configs
- XGBoost can make surprisingly accurate predictions on planning outcomes when given the right features
- Gemini 2.0 Flash is excellent for both structured report generation and document OCR in a single API
What's next
- Training on a larger dataset of planning decisions across all UK councils
- Adding appeal outcome predictions
- Real-time planning application monitoring and alerts
- Integration with local council planning portals
Built With
- fastapi
- framer-motion
- google-gemini-2.0-flash
- leaflet.js
- next.js
- nginx
- postgis
- postgresql
- python
- react
- scikit-learn
- supabase
- tailwind-css
- typescript
- vultr
- xgboost
Log in or sign up for Devpost to join the conversation.