Inspiration
In Lleida, the same street can mean different things to different people. A terrace that brings life to a square keeps the neighbours upstairs awake. A row of parked scooters is handy for a student and a wall for someone in a wheelchair.
We wanted to turn that into something people play together. Every broken bench or overflowing bin becomes a small civic dilemma, seen from more than one side, with a visible outcome and a reward for taking part. We called it Lo Barri ("the neighbourhood" in Lleida's dialect), because that's where coexistence actually happens.
What it does
Lo Barri is a civic social game for Lleida:
- Report situations in shared space. Snap a photo, drop a pin on the map, or record a voice note: a full container, a blocked pavement, noise, a broken streetlight, an accessibility barrier.
- See it through other people's eyes. For every report, AI generates how the problem and its possible solutions affect different citizen profiles: neighbours, young people, shop owners, older people and people with reduced mobility. The same decision has different consequences for each of them, and the app makes that visible.
- Decide and act. Support or reject your neighbours' reports, comment and debate, and follow the conversation in a community feed (explore, following, or your neighbourhood).
- Watch the city respond. City Hall staff post official updates that move a report from open to in progress to resolved, in public.
- Earn points for civic behaviour. Reporting, confirming reports, recycling, taking the bus, walking and shopping locally all earn points, with streaks, surprise bonuses and a daily challenge. Bus stops and local shops have signed QR codes, so those actions are verified.
- Compete as a neighbourhood. Rankings show which neighbourhoods and neighbours contribute most. Points become vouchers at local shops, so being a good neighbour also supports the local economy.
- Your monthly "civic wrap". A personal summary of your month, with an AI-generated civic archetype that describes how you take part in your city.
How we built it
- App: Flutter (Android and web), with an interactive map of Lleida and its points of interest (containers, shops, bus stops), a social feed, profiles and the gamification screens. Available in Catalan, Spanish and English.
- Backend: Python with FastAPI and async SQLAlchemy, documented with OpenAPI.
- Database: Tiger Data (TimescaleDB + PostGIS). Every points award is a row in a hypertable, and rankings read from a continuous aggregate of daily points, so leaderboards stay fast as activity grows. PostGIS handles the map queries by bounding box.
- Auth: Auth0, with roles and permissions for citizens, City Hall staff and shop staff (who validate vouchers).
- AI: Gemini generates the per-profile perspectives on each report and the monthly archetype, using structured output so the app always gets clean data. Voice notes are transcribed automatically, with language detection.
- Integrity: points are calculated only on the server, QR codes are HMAC-signed, and daily limits and per-place cooldowns stop people farming points.
- Deployment: the project is deployed on Cloudflare Workers with GitHub Actions.
Challenges we ran into
- Making AI add real value, not decoration. Generating "perspectives" is easy. Making them specific to this report, this location and these profiles, and fast and cheap enough to show on every post, took careful prompt design, structured outputs and caching.
- Fair gamification. A points system people can't cheat needed streaks with "freezes", verified QR actions, rate limits and server-side calculation, all in a single transaction.
- Parallel development. The map, the feed and the backend were built at the same time by different people. We wrote an integration contract first, and still had to untangle merge conflicts and database migrations under time pressure.
- Authentication across platforms. Getting Auth0 to work on web, on the Android emulator and on a deployed site, each with its own callback URLs and tokens, took more debugging than we expected.
Accomplishments that we're proud of
- It's a real, working product, not a mockup: every post, vote, comment, point, ranking and voucher is read from and stored in the database.
- The multi-perspective view turns a complaint into empathy: before you vote, you see who a decision helps and who it hurts.
- A complete civic loop: report → community reacts → City Hall responds → points → rewards at local shops.
- Using time-series database features (hypertables, continuous aggregates) for something they fit naturally: civic activity over time.
What we learned
- Coexistence problems are rarely "right versus wrong". They're trade-offs between groups, and showing those trade-offs changes how people react to them.
- Gamification only works if it's trustworthy. Verification and limits matter as much as the rewards.
- Agreeing on an API contract before writing code saved us during the hackathon.
- AI is most useful when it's tightly scoped, structured and has a fallback.
What's next for Lo Barri
- Pilot with La Paeria in one neighbourhood, connecting official updates to the City Hall's real incident workflow.
- Interactive dilemmas: short AI-generated scenarios (a new terrace licence, a pedestrianised street, festival noise) where users choose and see the impact on each profile and on neighbourhood indicators.
- More profiles and accessibility: families, tourists and visually impaired users, plus a fully accessible mode.
- More local partners for rewards, and real QR codes on bus stops and shops.
- Open data: anonymised dashboards so the city can see where coexistence problems concentrate and how quickly they're solved.
Built With
- ai
- auth0
- fastapi
- flutter
- gemini
- python
- sqlalchemy
- timescaledb