Skip to content

LafaekStreet

LafaekStreet Logo

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

FlutterDartFastAPIPostgreSQLAWSHederaHiveValkey


System Architecture

LafaekStreet Architecture


Live URLs

ApplicationURLHosting
Public Dashboardwww.lafaekstreet.comVercel
Government Portalgov.lafaekstreet.comVercel
Backend APIapi.lafaekstreet.comAWS Lightsail
Admin Panellocalhost:3002Local 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

  1. 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.
  2. 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.
  3. 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.
  4. 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

ModuleDescriptionTechREADME
Mobile AppCitizen reporting app (offline-first, GPS, camera)Flutter / DartREADME
Backend APICore API for mobile app (AI, blockchain, auth)FastAPI / PythonREADME
Public DashboardOpen data visualization + RuaLafaek AI chatNext.js 14README
Government PortalAgency dashboard for managing reportsNext.js 14README
Admin PanelSuper-admin system management (local only)Next.js 15README
DatabaseShared 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

DocumentDescription
System Diagrams17 Mermaid diagrams covering all system flows
User Roles & PermissionsComplete access matrix across all applications
Logo DescriptionCultural symbolism and design rationale

Mobile App

DocumentDescription
App READMEArchitecture, features, offline-first design
Report Creation FlowOnline/offline report submission + AI pipeline
App DeploymentBuild & deploy for Android/iOS

Backend API

DocumentDescription
Backend READMEFastAPI architecture, 36 endpoints, integrations
Deployment GuideAWS Lightsail setup, Nginx, SSL, scripts
Deploy Step-by-StepFirst-time deploy + update procedures
Manual AI BackfillBackfill AI analysis for existing reports

AWS KMS + Blockchain

DocumentDescription
KMS OverviewWhy AWS KMS for blockchain signing
KMS Quick Start5-minute setup guide
KMS ArchitectureSigning flow diagrams, security layers
KMS ImplementationTechnical details, code, IAM permissions
Hedera IntegrationHCS topics, transaction costs, live verification

Dashboard & AI

DocumentDescription
Dashboard READMEPublic dashboard features, tech stack
AI Chat ImplementationRuaLafaek: LangChain + Nova 2 Lite pipeline

Database

DocumentDescription
Database Schema15 tables, PostGIS, pgvector, triggers
User RolesRole definitions + access matrix
DB User: Gov PortalLeast-privilege permissions for gov portal
DB User: Public DashboardRead-only access with RLS
DB User: APIFull CRUD permissions for FastAPI

Admin & Gov Portal

DocumentDescription
Admin READMELocal-only admin panel features
Gov Portal READMEGovernment agency portal features

Technology Stack

LayerTechnologyPurpose
MobileFlutter / Dart + Google Sign-InCross-platform app with OAuth
BackendFastAPI (Python) + hiero-sdk-pythonREST API + Hedera integration
DashboardNext.js 14 + React + TypeScriptPublic dashboard + AI chat
Gov PortalNext.js 14 + Prisma + hCaptchaGovernment agency management
AdminNext.js 15 + PrismaSystem administration (local)
AI ChatLangChain + Amazon Nova 2 LiteRuaLafaek conversational AI
AI AnalysisAmazon Bedrock Nova 2 LiteImage validation & damage analysis
EmbeddingsAmazon Nova 2 Multimodal (1024-dim)Semantic search & duplicate detection
BlockchainHedera Network (HCS)Immutable records
SecurityAWS KMS (SECP256K1) + hCaptchaHardware signing + bot protection
StorageAmazon S3Image storage
DatabasePostgreSQL 15+ + PostGIS + pgvectorGeospatial + AI embeddings
CacheValkey (Redis-compatible)Sessions & caching
MapsOpenStreetMapFree mapping (mobile + dashboard)
HostingAWS Lightsail + Vercel + AivenCloud infrastructure

Getting Started

Each module has its own setup instructions:

  1. DatabaseDatabase README
  2. BackendBackend README
  3. Mobile AppApp README
  4. Public DashboardDashboard README
  5. Government PortalGov Portal README
  6. Admin PanelAdmin README

Port Allocation (Local Development)

AppPortURL (Production)
Public Dashboard3000www.lafaekstreet.com
Government Portal3001gov.lafaekstreet.com
Admin Panel3002localhost only
Backend API8000api.lafaekstreet.com

Built for Timor-Leste

Built for Timor-Leste