A production-ready Flutter mobile application for comprehensive personal finance management. Built with Provider state management, JWT authentication, and seamless integration with Spring Boot REST API backend for real-time expense tracking, income management, and financial analytics.
Backend Repository: ExpenseTracker Spring Boot API
- JWT Token Authentication - Secure stateless authentication
- Email OTP Verification - Two-step registration process
- Password Reset Flow - Email-based OTP password recovery
- Secure Token Storage - Encrypted credential management with SharedPreferences
- Auto Token Refresh - Seamless session management
- CRUD Operations - Create, read, update, and delete expenses
- Category Organization - Organize expenses by customizable categories
- Date-Based Tracking - Track expenses with precise date filtering
- Detailed Descriptions - Add notes and descriptions to each expense
- Real-Time Updates - Instant UI updates using Provider state management
- Multiple Income Sources - Track income from various sources
- Income Categories - Categorize income (salary, freelance, investments, etc.)
- Historical Records - Complete income history with date filtering
- Income vs Expense Analysis - Compare earnings against spending
- All-Time Overview - Total income, expenses, and balance summary
- Monthly Reports - Current month income/expense breakdown
- Top 3 Categories - See your highest spending categories
- Yearly Analysis - Month-by-month trends for any selected year
- Category Breakdown - Detailed spending analysis by category with percentages
- Visual Charts - Interactive data visualization (ready for chart integration)
- Secure Logout - Clean token removal and session termination
- Flutter 3.x - Google's UI toolkit for cross-platform development
- Dart 3.x - Modern, type-safe programming language
- Provider 6.0+ - Lightweight, powerful state management solution
- ChangeNotifier - Reactive state updates across the app
- HTTP Package - RESTful API communication
- Spring Boot REST API - Production backend with JWT security
- MySQL Database - Persistent data storage
- SharedPreferences - Token and user data persistence
- Secure Storage - Encrypted credential storage
- ApiService - Centralized HTTP request handler
- AuthService - Authentication and user management
- ExpenseService - Expense CRUD operations
- IncomeService - Income management
- HomeService - Dashboard data aggregation
- StatisticsService - Analytics and reporting
Ensure you have the following installed:
- Flutter SDK - Version 3.0.0 or higher (Install Flutter)
- Dart SDK - Version 3.0.0 or higher (bundled with Flutter)
- Android Studio / VS Code - With Flutter and Dart plugins
- Git - For version control
- Backend API - ExpenseTracker Spring Boot Backend running on your server
git clone https://github.com/seshathri044/expense-tracker-frontend.git
cd expense-tracker-frontendflutter pub getEdit lib/config/app_config.dart and update the base URL:
class AppConfig {
// Update this to your backend URL
static const String baseUrl = 'http://YOUR_BACKEND_IP:8080/api';
// Or for production
static const String baseUrl = 'https://your-domain.com/api';
// ... rest of configuration
}Important:
- For Android emulator: Use
http://10.0.2.2:8080/api - For iOS simulator: Use
http://localhost:8080/api - For physical devices: Use your computer's local IP (e.g.,
http://192.168.1.100:8080/api)
# Check available devices
flutter devices
# Run on connected device
flutter run
# Run on specific device
flutter run -d <device-id>
# Run in debug mode with hot reload
flutter run --debug
# Run in release mode (optimized)
flutter run --release# Build release APK
flutter build apk --release
# Build split APKs by ABI (smaller file size)
flutter build apk --split-per-abi
# Output location: build/app/outputs/flutter-apk/flutter build appbundle --release
# Output location: build/app/outputs/bundle/release/# Build release IPA
flutter build ios --release
# Or build with Xcode
open ios/Runner.xcworkspace
# Then use Xcode to archive and exportlib/
βββ config/ # Configuration files
β βββ app_config.dart # API endpoints and app constants
β
βββ models/ # Data models
β βββ user_models.dart # User and AuthResponse models
β βββ expense_model.dart # Expense data model
β βββ income_model.dart # Income data model
β βββ stats_model.dart # Statistics and analytics models
β βββ api_response.dart # Generic API response wrapper
β
βββ providers/ # State management (Provider)
β βββ auth_provider.dart # Authentication state
β βββ expense_provider.dart # Expense state management
β βββ income_provider.dart # Income state management
β βββ stats_provider.dart # Statistics state
β
βββ screens/ # UI screens
β βββ auth/ # Authentication screens
β β βββ login_screen.dart
β β βββ register_screen.dart
β β βββ otp_verification_screen.dart
β β βββ forgot_password_screen.dart
β βββ home/ # Dashboard
β β βββ home_screen.dart
β βββ expense/ # Expense management
β β βββ expense_list_screen.dart
β β βββ add_expense_screen.dart
β β βββ edit_expense_screen.dart
β βββ income/ # Income management
β β βββ income_list_screen.dart
β β βββ add_income_screen.dart
β β βββ edit_income_screen.dart
β βββ statistics/ # Analytics & reports
β β βββ statistics_screen.dart
β β βββ year_report_screen.dart
β βββ profile/ # User profile
β β βββ profile_screen.dart
β βββ splash/ # App initialization
β βββ splash_screen.dart
β
βββ services/ # Backend API services
β βββ api_service.dart # Base HTTP client
β βββ storage_service.dart # Local storage wrapper
β βββ auth_service.dart # Authentication API calls
β βββ expense_service.dart # Expense API calls
β βββ income_service.dart # Income API calls
β βββ home_service.dart # Dashboard data API
β βββ statistics_service.dart # Analytics API calls
β
βββ widgets/ # Reusable widgets
β βββ common/ # Common UI components
β βββ charts/ # Chart widgets
β βββ forms/ # Form components
β
βββ utils/ # Utility functions
β βββ constants.dart # App-wide constants
β βββ validators.dart # Input validation
β βββ date_formatter.dart # Date utilities
β βββ currency_formatter.dart # Currency formatting
β
βββ main.dart # Application entry point
The app communicates with the Spring Boot backend through these main services:
POST /api/register - Register new user
POST /api/send-otp - Send email OTP
POST /api/verify-otp - Verify OTP and activate account
POST /api/login - User login
POST /api/send-reset-otp - Password reset OTP
POST /api/reset-password - Reset password with OTP
GET /api/profile - Get user profile
POST /api/logout - Logout user
GET /api/expense/all - Get all expenses
POST /api/expense - Create new expense
PUT /api/expense/:id - Update expense
DELETE /api/expense/:id - Delete expense
GET /api/income/all - Get all incomes
POST /api/income - Create new income
PUT /api/income/:id - Update income
DELETE /api/income/:id - Delete income
GET /api/stats - Get all-time statistics
- Tokens are extracted and stored after login/verification
- Username is decoded from JWT payload for display
- Tokens are automatically attached to authenticated requests
- Secure logout clears all stored credentials
// Example: Expense Provider usage
class ExpenseProvider extends ChangeNotifier {
List<Expense> _expenses = [];
Future<void> loadExpenses() async {
final response = await ExpenseService().getExpenses();
if (response.success) {
_expenses = response.data!;
notifyListeners(); // Triggers UI rebuild
}
}
}- All API calls wrapped in try-catch blocks
- User-friendly error messages
- Network error detection and reporting
- Response validation before data parsing
- Dates stored in ISO 8601 format (YYYY-MM-DD)
- Client-side date filtering for range queries
- Timezone-aware date comparisons
flutter testflutter test test/widget_test.dartflutter drive --target=test_driver/app.dartflutter test --coverage
genhtml coverage/lcov.info -o coverage/html
open coverage/html/index.html1. Cannot connect to backend
Error: SocketException: Failed to connect
Solution: Check your app_config.dart baseUrl matches your backend server
2. Token expired errors
Error: 401 Unauthorized
Solution: Logout and login again to refresh token
3. Date parsing errors
Error: FormatException: Invalid date format
Solution: Ensure backend returns dates in YYYY-MM-DD format
4. Flutter pub get fails
# Clean and reinstall dependencies
flutter clean
flutter pub get5. Build errors on iOS
# Clean iOS build
cd ios
pod deintegrate
pod install
cd ..
flutter clean
flutter build iosKey packages used in this project:
dependencies:
flutter:
sdk: flutter
# State Management
provider: ^6.1.1
# HTTP & API
http: ^1.1.0
# Local Storage
shared_preferences: ^2.2.2
# UI Components
flutter_svg: ^2.0.9
google_fonts: ^6.1.0
# Date & Time
intl: ^0.19.0
# Charts (when implemented)
fl_chart: ^0.65.0Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Commit your changes
git commit -m 'Add amazing feature' - Push to the branch
git push origin feature/amazing-feature
- Open a Pull Request
- Follow Flutter's official style guide
- Write meaningful commit messages
- Add comments for complex logic
- Update documentation for new features
- Test thoroughly before submitting PR
- β JWT tokens stored securely in SharedPreferences
- β Passwords never stored locally
- β HTTPS recommended for production
- β Token expiration handled gracefully
- β Input validation on all forms
β οΈ Consider adding biometric authenticationβ οΈ Implement certificate pinning for production
- Receipt photo upload and OCR
- Budget alerts and notifications
- Recurring expenses/income
- Multi-currency support
- Export data to CSV/PDF
- Biometric authentication
- Dark mode theme
- Offline mode with sync
- Data backup to cloud
- Expense categories customization
This project is licensed under the MIT License - see the LICENSE file for details.
Seshathri
- GitHub: @seshathri044
- Repository: expense-tracker-frontend
- Backend API: ExpenseTracker Spring Boot Backend
- Spring Boot 3.x
- Spring Security with JWT
- MySQL Database
- RESTful API
If you encounter any issues or have questions:
- Check the Troubleshooting section
- Review existing Issues
- Open a new issue with detailed information
- Contact: [Open an issue on GitHub]
- Flutter team for the amazing framework
- Provider package maintainers
- Spring Boot backend team
- All contributors and supporters
Built with β€οΈ using Flutter & Spring Boot
β Star this repo if you find it helpful!