LafaekStreet Mobile App - Deployment Guide
Guide for building and deploying the Flutter mobile app to connect with production API.
🌐 API Configuration
Production API
- Domain:
api.lafaekstreet.com - Base URL:
https://api.lafaekstreet.com - Full API URL:
https://api.lafaekstreet.com/api/v1
Development API (Depend your IP)
- Local Backend:
http://10.237.178.32:8000 - Full API URL:
http://10.237.178.32:8000/api/v1
📋 Environment Files
Available Environments
.env.development- Local development- Uses local backend IP
- Debug mode enabled
- Detailed logging
.env.production- Production builds- Uses
https://api.lafaekstreet.com - Debug mode disabled
- Optimized for release
- Uses
.env- Active configuration- Copy from
.env.developmentor.env.production - This file is used by the app
- Copy from
🚀 Quick Start
For Development
cd lafaekstreet_app
# Use development environment
cp .env.development .env
# Run app
flutter runFor Production Build
cd lafaekstreet_app
# Use production environment
cp .env.production .env
# Build for Android
flutter build apk --release
# Or build App Bundle (for Play Store)
flutter build appbundle --release
# Build for iOS
flutter build ios --release🔧 Configuration Details
API Configuration
The app uses EnvConfig class to load environment variables:
// lib/core/config/env_config.dart
class EnvConfig {
static String get apiBaseUrl => dotenv.env['API_BASE_URL'] ?? 'http://localhost:8000';
static String get apiVersion => dotenv.env['API_VERSION'] ?? 'v1';
static String get apiUrl => '$apiBaseUrl/api/$apiVersion';
}API Service
All API calls go through ApiService:
// lib/services/api_service.dart
class ApiService {
String get baseUrl => EnvConfig.apiUrl;
// Example: GET request
Future<dynamic> get(String endpoint) async {
final response = await http.get(
Uri.parse('$baseUrl$endpoint'),
headers: await _getHeaders(),
);
return _handleResponse(response);
}
}📱 Building for Production
Prerequisites
Backend Deployed
- Lightsail instance running
- SSL certificate installed
- API accessible at
https://api.lafaekstreet.com
DNS Configured
api.lafaekstreet.compoints to Lightsail IP- DNS propagated globally
Test API
bashcurl https://api.lafaekstreet.com/health
Android Build
1. Switch to Production Environment
cd lafaekstreet_app
cp .env.production .env2. Update Version
Edit pubspec.yaml:
version: 1.0.0+1 # Increment for each release3. Build APK
# Build APK (for direct installation)
flutter build apk --release
# Output: build/app/outputs/flutter-apk/app-release.apk4. Build App Bundle (Recommended for Play Store)
# Build App Bundle
flutter build appbundle --release
# Output: build/app/outputs/bundle/release/app-release.aab5. Test APK
# Install on connected device
flutter install --release
# Or manually install
adb install build/app/outputs/flutter-apk/app-release.apkiOS Build
1. Switch to Production Environment
cd lafaekstreet_app
cp .env.production .env2. Update Version
Edit pubspec.yaml:
version: 1.0.0+1 # Increment for each release3. Build iOS
# Build iOS
flutter build ios --release
# Open in Xcode for signing and distribution
open ios/Runner.xcworkspace4. Archive and Upload
- In Xcode: Product → Archive
- Distribute App → App Store Connect
- Upload to TestFlight or App Store
🐛 Troubleshooting
Issue 1: API Connection Failed
Symptoms: App can't connect to API
Solutions:
Check API URL in
.env:bashcat .env | grep API_BASE_URL # Should be: API_BASE_URL=https://api.lafaekstreet.comTest API from browser:
https://api.lafaekstreet.com/healthCheck device internet connection
Verify SSL certificate:
bashcurl -v https://api.lafaekstreet.com/health
Issue 2: Wrong Environment
Symptoms: App connects to wrong API
Solutions:
# Check current .env
cat .env | grep API_BASE_URL
# Switch to production
cp .env.production .env
# Rebuild app
flutter clean
flutter build apk --releaseIssue 3: SSL Certificate Error
Symptoms: Certificate verification failed
Solutions:
- Ensure using HTTPS in production
- Check certificate validity:bash
openssl s_client -connect api.lafaekstreet.com:443 - Update device date/time
Issue 4: CORS Error
Symptoms: "CORS policy blocked"
Solutions:
- Check backend CORS configuration
- Ensure backend allows your domain
- Mobile apps typically don't have CORS issues (browser-only)
📦 Distribution
Android
Google Play Store
Build App Bundle:
bashflutter build appbundle --releaseUpload to Play Console:
- Go to Play Console
- Create new release
- Upload
app-release.aab - Fill in release notes
- Submit for review
Direct Distribution (APK)
Build APK:
bashflutter build apk --releaseShare APK file:
- Upload to website
- Share via email/messaging
- Users must enable "Install from Unknown Sources"
iOS
App Store
- Build and archive in Xcode
- Upload to App Store Connect
- Submit for review
TestFlight
- Upload to App Store Connect
- Add internal/external testers
- Distribute beta builds
🔄 Update Process
For New Backend Changes
Backend Updated → No app changes needed (if API compatible)
API Changes → Update app code:
bash# Update API service # Test with new endpoints # Rebuild app flutter build apk --release
For App Updates
- Update version in
pubspec.yaml - Update code
- Test thoroughly
- Build release
- Distribute
📱 App Store Metadata
App Name
LafaekStreet
Description
Civic engagement platform for Timor-Leste. Report road issues, track progress, and improve your community.
Keywords
civic, engagement, road, report, timor-leste, community
Category
Utilities / Productivity
Screenshots
- Prepare 5-8 screenshots per device size
- Show key features: report creation, map view, notifications
🎉 Success!
Production API: https://api.lafaekstreet.com
Build Commands:
# Android
cp .env.production .env && flutter build apk --release
# iOS
cp .env.production .env && flutter build ios --release📞 Support
Check Configuration
cat .env | grep API_BASE_URLTest API
curl https://api.lafaekstreet.com/healthView Logs
flutter logsHappy Building! 🚀
