LafaekStreet

Empowering Timor-Leste Citizens Through AI and Blockchain-Powered Civic Engagement
System Architecture

Live URLs
| Application | URL | Hosting |
|---|---|---|
| Public Dashboard | www.lafaekstreet.com | Vercel |
| Government Portal | gov.lafaekstreet.com | Vercel |
| Backend API | api.lafaekstreet.com | AWS Lightsail |
| Admin Panel | localhost:3002 | Local only |
Overview
LafaekStreet is a civic engagement platform for Timor-Leste that lets citizens report road infrastructure issues using their mobile phones. Reports are validated by AI, recorded on blockchain, and tracked by government agencies until fixed.
The Problem
- No centralized system for citizens to report road hazards
- Manual inspection is slow and expensive
- No transparency or accountability for reported issues
- Remote areas have poor internet connectivity
The Solution
- Mobile-First (Flutter) — Citizens report issues using an offline-first mobile app. GPS captures the location, the camera captures evidence, and reports sync automatically when internet is available. Supports Tetum, Portuguese, and English.
- AI Validation (Amazon Bedrock) — Amazon Nova 2 Lite checks if uploaded images are actually infrastructure problems — selfies and irrelevant photos are auto-rejected. Valid images get damage classification, severity scoring, and vector embeddings for duplicate detection.
- Blockchain Transparency (Hedera) — Every report is recorded on Hedera Consensus Service. Citizens can verify their report on HashScan Explorer. Reports cannot be deleted or altered by anyone. Transaction cost: ~$0.0001 per report.
- Enterprise Security (AWS) — Blockchain signing keys are stored in AWS KMS hardware (FIPS 140-2 Level 2) — private keys never leave the HSM. Images stored on S3. Backend hosted on Lightsail.
How It Works
Citizens open the app, take a photo, submit. AI validates, blockchain records, government gets notified.
Government agencies log into gov.lafaekstreet.com, review reports, update status, assign work. Citizens get notified of progress.
Public visits www.lafaekstreet.com to view all reports on a map, see statistics, ask RuaLafaek AI chat questions, and verify reports on blockchain.
Project Structure
| Module | Description | Tech | README |
|---|---|---|---|
| Mobile App | Citizen reporting app (offline-first, GPS, camera) | Flutter / Dart | README |
| Backend API | Core API for mobile app (AI, blockchain, auth) | FastAPI / Python | README |
| Public Dashboard | Open data visualization + RuaLafaek AI chat | Next.js 14 | README |
| Government Portal | Agency dashboard for managing reports | Next.js 14 | README |
| Admin Panel | Super-admin system management (local only) | Next.js 15 | README |
| Database | Shared PostgreSQL schema (PostGIS + pgvector) | PostgreSQL 15+ | README |
Key Value Propositions
AI-Powered Integrity (Amazon Bedrock)
Every report is filtered by AI to ensure only genuine infrastructure issues are recorded. Irrelevant images (selfies, food, memes) are auto-rejected before they hit the database. Valid images get full damage analysis, severity scoring, and 1024-dimensional vector embeddings for duplicate detection. The public dashboard includes RuaLafaek, an AI chat assistant powered by Nova 2 Lite + LangChain that answers natural language questions about infrastructure data.
Hardware-Backed Trust (AWS KMS + Hedera)
AWS KMS stores signing keys in FIPS 140-2 Level 2 hardware — private keys never leave the HSM. These signatures anchor every report to the Hedera blockchain, creating an immutable public audit trail. Citizens can verify any report on HashScan Explorer.
Offline-First for Timor-Leste
The mobile app works without internet. Reports are saved locally in Hive and auto-synced when connectivity is restored. GPS, camera, and map tiles all work offline. Essential for rural and remote communities.
Architecture Overview
All 4 applications share one PostgreSQL database (Aiven) and one Valkey cache. The FastAPI backend is the only writer for citizen data. Next.js apps access the database directly via Prisma for read-heavy operations.
For detailed diagrams, see System Diagrams | Architecture (.drawio)
Documentation Index
Core
| Document | Description |
|---|---|
| System Diagrams | 17 Mermaid diagrams covering all system flows |
| User Roles & Permissions | Complete access matrix across all applications |
| Logo Description | Cultural symbolism and design rationale |
Mobile App
| Document | Description |
|---|---|
| App README | Architecture, features, offline-first design |
| Report Creation Flow | Online/offline report submission + AI pipeline |
| App Deployment | Build & deploy for Android/iOS |
Backend API
| Document | Description |
|---|---|
| Backend README | FastAPI architecture, 36 endpoints, integrations |
| Deployment Guide | AWS Lightsail setup, Nginx, SSL, scripts |
| Deploy Step-by-Step | First-time deploy + update procedures |
| Manual AI Backfill | Backfill AI analysis for existing reports |
AWS KMS + Blockchain
| Document | Description |
|---|---|
| KMS Overview | Why AWS KMS for blockchain signing |
| KMS Quick Start | 5-minute setup guide |
| KMS Architecture | Signing flow diagrams, security layers |
| KMS Implementation | Technical details, code, IAM permissions |
| Hedera Integration | HCS topics, transaction costs, live verification |
Dashboard & AI
| Document | Description |
|---|---|
| Dashboard README | Public dashboard features, tech stack |
| AI Chat Implementation | RuaLafaek: LangChain + Nova 2 Lite pipeline |
Database
| Document | Description |
|---|---|
| Database Schema | 15 tables, PostGIS, pgvector, triggers |
| User Roles | Role definitions + access matrix |
| DB User: Gov Portal | Least-privilege permissions for gov portal |
| DB User: Public Dashboard | Read-only access with RLS |
| DB User: API | Full CRUD permissions for FastAPI |
Admin & Gov Portal
| Document | Description |
|---|---|
| Admin README | Local-only admin panel features |
| Gov Portal README | Government agency portal features |
Technology Stack
| Layer | Technology | Purpose |
|---|---|---|
| Mobile | Flutter / Dart + Google Sign-In | Cross-platform app with OAuth |
| Backend | FastAPI (Python) + hiero-sdk-python | REST API + Hedera integration |
| Dashboard | Next.js 14 + React + TypeScript | Public dashboard + AI chat |
| Gov Portal | Next.js 14 + Prisma + hCaptcha | Government agency management |
| Admin | Next.js 15 + Prisma | System administration (local) |
| AI Chat | LangChain + Amazon Nova 2 Lite | RuaLafaek conversational AI |
| AI Analysis | Amazon Bedrock Nova 2 Lite | Image validation & damage analysis |
| Embeddings | Amazon Nova 2 Multimodal (1024-dim) | Semantic search & duplicate detection |
| Blockchain | Hedera Network (HCS) | Immutable records |
| Security | AWS KMS (SECP256K1) + hCaptcha | Hardware signing + bot protection |
| Storage | Amazon S3 | Image storage |
| Database | PostgreSQL 15+ + PostGIS + pgvector | Geospatial + AI embeddings |
| Cache | Valkey (Redis-compatible) | Sessions & caching |
| Maps | OpenStreetMap | Free mapping (mobile + dashboard) |
| Hosting | AWS Lightsail + Vercel + Aiven | Cloud infrastructure |
Getting Started
Each module has its own setup instructions:
- Database — Database README
- Backend — Backend README
- Mobile App — App README
- Public Dashboard — Dashboard README
- Government Portal — Gov Portal README
- Admin Panel — Admin README
Port Allocation (Local Development)
| App | Port | URL (Production) |
|---|---|---|
| Public Dashboard | 3000 | www.lafaekstreet.com |
| Government Portal | 3001 | gov.lafaekstreet.com |
| Admin Panel | 3002 | localhost only |
| Backend API | 8000 | api.lafaekstreet.com |
Built for Timor-Leste