Skip to content

LafaekStreet - Citizen Mobile App ​

FlutterDartAWSHederaHive

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

Report road infrastructure issues β€’ AI-powered validation β€’ Blockchain transparency β€’ Works offline


πŸ“± About ​

LafaekStreet is a mobile application that enables citizens of Timor-Leste to report and track road infrastructure issues. Built with Flutter for cross-platform support (iOS & Android), the app combines offline-first architecture, AI-powered image analysis, and blockchain transparency to create a reliable civic engagement platform.

Key Features ​

  • πŸ“Έ Photo-based Reporting - Document issues with camera integration
  • πŸ“ GPS Location Tracking - Automatic high-accuracy location capture
  • 🌐 Offline-First - Create reports without internet, auto-sync when online
  • πŸ€– AI Validation - Amazon Bedrock validates image relevance and assesses damage severity
  • πŸ›‘οΈ Smart Rejection - Auto-rejects irrelevant images (selfies, food, etc.) before processing
  • ⛓️ Blockchain Verified - Immutable records on Hedera network
  • πŸ—ΊοΈ OpenStreetMap - Free, accessible mapping with tile caching
  • πŸ” Google Sign-In - Fast, passwordless authentication
  • 🌍 Multi-Language - Tetum, Portuguese, and English support

πŸ—οΈ Architecture ​

Technology Stack ​

LayerTechnologyPurpose
FrameworkFlutter/DartCross-platform mobile development
State ManagementProviderReactive UI updates
Local DatabaseHiveOffline report storage
Secure Storageflutter_secure_storageJWT token encryption
Mapsflutter_map + OpenStreetMapFree mapping with offline caching
Locationgeolocator + geocodingGPS and reverse geocoding
Cameraimage_pickerPhoto capture
NetworkingdioAPI communication
BackendFastAPI (Python)REST API server

System Architecture ​


πŸ” Authentication Flow ​


πŸš€ Getting Started ​

Prerequisites ​

  • Flutter SDK 3.27.1 or higher
  • Dart 3.0 or higher
  • Android Studio / Xcode (for mobile development)
  • Git

Installation ​

  1. Clone the repository

    bash
    git clone https://github.com/ajitonelsonn/lafaekstreet.git
    cd lafaekstreet/lafaekstreet_app
  2. Install dependencies

    bash
    flutter pub get
  3. Configure environment

    Create .env file in the project root:

    bash
    API_BASE_URL=https://api.lafaekstreet.com
    GOOGLE_CLIENT_ID=your-google-client-id
  4. Run the app

    bash
    # Development mode
    flutter run
    
    # Release mode
    flutter run --release

Platform-Specific Setup ​

Android ​

  1. Update android/app/build.gradle:

    gradle
    android {
        compileSdkVersion 34
        minSdkVersion 21
        targetSdkVersion 34
    }
  2. Add permissions in android/app/src/main/AndroidManifest.xml:

    xml
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.CAMERA"/>

iOS ​

  1. Update ios/Runner/Info.plist:

    xml
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>We need your location to mark where the issue is</string>
    <key>NSCameraUsageDescription</key>
    <string>We need camera access to take photos of issues</string>
  2. Set minimum iOS version in ios/Podfile:

    ruby
    platform :ios, '12.0'

πŸ“± Report Lifecycle ​


πŸ“– How It Works ​

Report Creation Flow ​

  1. Authentication - Login with Google or email/password
  2. Issue Selection - Choose issue type (pothole, flooding, etc.)
  3. Photo Capture - Take 1 photo of the problem
  4. Location - GPS automatically captures coordinates
  5. Details - Add title, description, and severity
  6. Submit - Report sent to backend or saved offline

Online Mode ​

When internet is available:

  • Report uploaded immediately to backend
  • AI validates image relevance first β€” irrelevant images (selfies, food, etc.) auto-reject the report
  • If relevant: AI analyzes damage severity via Amazon Bedrock
  • Blockchain record created on Hedera (skipped if report rejected)
  • Address resolved via OpenStreetMap
  • Instant confirmation with report number

Offline Mode ​

When internet is unavailable:

  • Report saved to local Hive database
  • GPS coordinates captured (works offline)
  • Images stored locally
  • Auto-syncs when connectivity restored
  • Address added during sync

Automatic Synchronization ​

The app monitors connectivity and automatically:

  1. Detects when internet is restored
  2. Validates authentication token
  3. Uploads pending reports sequentially
  4. Performs reverse geocoding for addresses
  5. Uploads images to AWS S3
  6. Deletes synced reports from device

🎨 Features ​

Core Functionality ​

Home ScreenProfile Screen

Report Management ​

Report Details

  • Create reports with photos and location
  • View all your submitted reports
  • Track report status (Pending β†’ In Progress β†’ Fixed)
  • Edit/delete pending reports
  • View AI analysis results
  • Verify reports on blockchain

Offline Support ​

  • Create reports without internet
  • Local storage with Hive database
  • Automatic sync when online
  • Stuck report recovery (5-minute timeout)
  • Storage usage monitoring (100MB limit)

Map Integration ​

  • Interactive OpenStreetMap
  • Tile caching for offline viewing
  • Report markers with status colors
  • Current location tracking
  • Address search and reverse geocoding

AI-Powered Features ​

  • Image relevance validation β€” auto-rejects irrelevant photos (selfies, food, memes, etc.)
  • Automatic damage image analysis
  • Damage severity assessment
  • Issue type classification
  • Confidence scoring
  • Duplicate detection

Blockchain Transparency ​

  • Immutable report records
  • Cryptographic proof of submission
  • Public verification via transaction ID
  • Tamper-proof audit trail

User Interface ​

LoginSignup

Home Screen ​

  • Beautiful gradient header
  • Community impact statistics
  • Interactive map with cached tiles
  • Recent reports feed
  • Prominent "Report Issue" button

Profile Screen ​

  • User information
  • Report statistics
  • Offline reports access
  • Settings and preferences
  • Logout option

Create Report Screen ​

Step 1Step 2Step 3Step 4

  • Step-by-step wizard
  • Issue type selection with images
  • Camera integration
  • Location confirmation
  • Review before submit

Offline Reports Screen ​

Offline Reports

  • List of pending reports
  • Status badges (Pending/Syncing/Failed)
  • Edit and delete options
  • Manual sync trigger
  • Storage usage indicator

πŸ”” Notification System ​


πŸ” Security ​

Authentication ​

  • JWT token-based authentication
  • Google OAuth 2.0 integration
  • Secure token storage (encrypted)
  • Local token validation
  • Automatic token refresh

Data Protection ​

  • HTTPS/TLS 1.3 for all API calls
  • Encrypted local storage (Hive)
  • Secure image storage (app-private directory)
  • No sensitive data in logs
  • Token cleared on logout

Privacy ​

  • Users see only their own reports
  • Email verification required
  • Location data used only for reports
  • Images stored securely
  • GDPR-compliant data handling

Security Architecture ​


πŸ“Š Technical Details ​

Dependencies ​

yaml
dependencies:
  # Core
  flutter:
    sdk: flutter

  # State Management
  provider: ^6.1.0

  # Networking
  dio: ^5.4.0
  connectivity_plus: ^5.0.2

  # Maps & Location
  flutter_map: ^6.1.0
  flutter_map_cache: ^2.0.0
  latlong2: ^0.9.0
  geolocator: ^11.0.0
  geocoding: ^2.2.0

  # Storage
  hive: ^2.2.3
  hive_flutter: ^1.1.0
  flutter_secure_storage: ^9.0.0
  shared_preferences: ^2.2.2
  path_provider: ^2.1.2

  # Media
  image_picker: ^1.0.7
  cached_network_image: ^3.3.1
  image: ^4.1.7

  # UI
  intl: ^0.19.0

  # Authentication
  google_sign_in: ^6.2.1

Project Structure ​

lib/
β”œβ”€β”€ main.dart                    # App entry point
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ theme/                   # App theme & colors
β”‚   β”œβ”€β”€ constants/               # Constants & configs
β”‚   └── utils/                   # Utility functions
β”œβ”€β”€ models/                      # Data models
β”‚   β”œβ”€β”€ report.dart
β”‚   β”œβ”€β”€ user.dart
β”‚   └── offline_report.dart
β”œβ”€β”€ providers/                   # State management
β”‚   β”œβ”€β”€ auth_provider.dart
β”‚   β”œβ”€β”€ report_provider.dart
β”‚   β”œβ”€β”€ sync_provider.dart
β”‚   └── notification_provider.dart
β”œβ”€β”€ services/                    # Business logic
β”‚   β”œβ”€β”€ api_service.dart
β”‚   β”œβ”€β”€ auth_service.dart
β”‚   β”œβ”€β”€ report_service.dart
β”‚   β”œβ”€β”€ offline_service.dart
β”‚   β”œβ”€β”€ sync_service.dart
β”‚   β”œβ”€β”€ location_service.dart
β”‚   β”œβ”€β”€ connectivity_monitor.dart
β”‚   └── auth_validator.dart
β”œβ”€β”€ screens/                     # UI screens
β”‚   β”œβ”€β”€ auth/
β”‚   β”œβ”€β”€ home/
β”‚   β”œβ”€β”€ report/
β”‚   β”œβ”€β”€ profile/
β”‚   β”œβ”€β”€ offline/
β”‚   └── notifications/
└── widgets/                     # Reusable widgets
    β”œβ”€β”€ common/
    β”œβ”€β”€ cards/
    └── offline/

Database Schema (Hive) ​

dart
@HiveType(typeId: 0)
class OfflineReport extends HiveObject {
  @HiveField(0) String id;              // UUID
  @HiveField(1) String userId;
  @HiveField(2) String title;
  @HiveField(3) String description;
  @HiveField(4) String issueType;
  @HiveField(5) String severity;
  @HiveField(6) double latitude;
  @HiveField(7) double longitude;
  @HiveField(8) double accuracy;
  @HiveField(9) String? address;
  @HiveField(10) List<String> imagePaths;
  @HiveField(11) String syncStatus;     // pending/syncing/failed/synced
  @HiveField(12) DateTime createdAt;
  @HiveField(13) DateTime? lastSyncAttempt;
  @HiveField(14) int syncAttemptCount;
  @HiveField(15) String? lastSyncError;
  @HiveField(16) int totalSizeBytes;
}

πŸ§ͺ Testing ​

Run Tests ​

bash
# Unit tests
flutter test

# Integration tests
flutter test integration_test/

# Property-based tests
flutter test test/property/

Test Coverage ​

bash
# Generate coverage report
flutter test --coverage
genhtml coverage/lcov.info -o coverage/html
open coverage/html/index.html

Debug Tools ​

bash
# Run with debug logs
flutter run --verbose

# Inspect Hive database
flutter run --debug
# Then use the debug button in Offline Reports screen

# Check offline reports
./debug_offline_reports.sh

πŸ“š Documentation ​


πŸ”§ Configuration ​

Environment Variables ​

Create .env file:

bash
# API Configuration
API_BASE_URL=https://api.lafaekstreet.com
API_TIMEOUT=30000

# Google OAuth
GOOGLE_CLIENT_ID=your-client-id-here

# Feature Flags
ENABLE_OFFLINE_MODE=true
ENABLE_MAP_CACHING=true
ENABLE_DEBUG_TOOLS=false

# Storage
MAX_OFFLINE_STORAGE_MB=100
MAX_IMAGE_SIZE_MB=10
IMAGE_QUALITY=85

Build Configuration ​

bash
# Development
flutter build apk --debug

# Production
flutter build apk --release --obfuscate --split-debug-info=build/debug-info

# iOS
flutter build ios --release

πŸ™ Acknowledgments ​

  • Hedera Network - Blockchain infrastructure
  • Amazon Web Services - Cloud services (S3, KMS, Bedrock)
  • OpenStreetMap - Free mapping data
  • Flutter Team - Amazing framework
  • Timor-Leste Citizens - For inspiring this project

Built with ❀️ for Timor-Leste

Where citizens' voices meet blockchain's permanence, AI's intelligence, and government's responsibility.

Built for Timor-Leste