A modern, feature-rich Flutter CRM application for startups and enterprises. Built with a scalable architecture, BottleCRM Mobile provides comprehensive customer relationship management capabilities with multi-tenant support, real-time synchronization, and intuitive user experience.
BottleCRM Mobile is designed to streamline your sales and customer management processes with:
- Multi-tenant Architecture: Organization-based data isolation and role management
- Offline-First Design: Local caching with smart synchronization
- Modern UI/UX: Material Design 3 with adaptive layouts
- Enterprise Security: OAuth 2.0, JWT tokens, and secure API communication
- Google OAuth 2.0: Seamless single sign-on integration
- JWT Authentication: Secure token-based API communication
- Multi-tenant Support: Organization-based data isolation
- Role-based Access: Granular permissions and user management
- Dashboard: Real-time metrics, KPIs, and activity feeds
- Contacts: Complete contact management with search and filtering
- Leads: Lead capture, qualification, and conversion tracking
- Opportunities: Sales pipeline management with stages
- Tasks: Task assignment, tracking, and deadline management
- Accounts: Customer account profiles and relationship history
- Cases: Customer support ticket management
- Events: Calendar integration and meeting scheduling
- Documents: File management with cloud storage
- Teams: Collaboration tools and team management
- Invoices: Billing and invoice generation
- Material Design 3: Modern, consistent UI patterns
- Responsive Design: Optimized for phones, tablets, and foldables
- Dark/Light Theme: System-aware theme switching
- Offline Support: Local data caching with smart sync
- Pull-to-Refresh: Intuitive data refresh patterns
- Infinite Scrolling: Smooth pagination for large datasets
- Flutter SDK: 3.8.1 or later
- Dart SDK: 3.0.0 or later
- Android Studio/VS Code: Latest stable version
- Git: For version control
- Android: API level 31+ (Android 12+)
- iOS: iOS 11.0+ (for iOS builds)
- Web: Modern browsers (Chrome, Firefox, Safari, Edge)
- Desktop: Windows, macOS, Linux (experimental)
- Android SDK: For Android development
- Xcode: For iOS development (macOS only)
- CocoaPods: iOS dependency management
Download the app directly from Google Play Store:
-
Clone the repository:
git clone https://github.com/your-username/bottlecrm_mobile_v2.git cd bottlecrm_mobile_v2
-
Install Flutter dependencies:
flutter pub get
-
Set up Firebase & Google Sign-In:
# Copy template and configure cp android/app/google-services.json.template android/app/google-services.json # Edit the file with your Firebase project configuration
-
Run the application:
flutter run
- Create a new Firebase project at Firebase Console
- Enable Google Sign-In authentication
- Download
google-services.json
for Android - Download
GoogleService-Info.plist
for iOS (if building for iOS) - Place files in their respective directories:
- Android:
android/app/google-services.json
- iOS:
ios/Runner/GoogleService-Info.plist
- Android:
- Navigate to Google Cloud Console
- Create OAuth 2.0 Client ID for Android:
# Get your SHA-1 fingerprint cd android ./gradlew signingReport
- Add the SHA-1 fingerprint to your OAuth client
- Configure OAuth consent screen
The app automatically switches between environments:
- Debug builds: Uses development API (ngrok URL)
- Release builds: Uses production API (bottlecrm.io)
You can modify URLs in lib/config/api_config.dart
# Run the app with hot reload
flutter run
# Run with specific device
flutter run -d <device-id>
# Run in debug mode with detailed logging
flutter run --debug --verbose
# Format code
dart format .
# Analyze code quality
flutter analyze --no-fatal-infos
# Run tests
flutter test
# Generate code coverage
flutter test --coverage
This project follows strict coding standards:
- Linting: Uses
flutter_lints
for consistent code style - Architecture: Singleton services with dependency injection
- Error Handling: Comprehensive try-catch with user-friendly messages
- Naming: Dart conventions (camelCase, PascalCase, snake_case)
- Documentation: Comprehensive inline documentation
# Connect to Android device over WiFi
adb connect <device-ip>:5555
# View logs
flutter logs
# Launch DevTools
flutter pub global activate devtools
flutter pub global run devtools
# Clean and prepare
flutter clean
flutter pub get
# Debug build (uses development API)
flutter build apk --debug
# Release build (uses production API)
flutter build apk --release
# App Bundle for Play Store
flutter build appbundle --release
# Install APK directly
flutter install build/app/outputs/flutter-apk/app-release.apk
# Build for iOS
flutter build ios --release
# Build for iOS Simulator
flutter build ios --debug --simulator
The app uses different API endpoints based on build type:
- Debug builds: Development server (ngrok tunnel)
- Release builds: Production API (
https://api.bottlecrm.io
)
Build configurations are managed in:
lib/config/api_config.dart
- API endpoint configurationandroid/app/build.gradle.kts
- Android build settingsios/Runner.xcodeproj
- iOS build settings
BottleCRM Mobile follows a robust, scalable architecture designed for enterprise applications:
- Singleton Services: All services use the singleton pattern for consistent state management
- Service-First Design: Business logic is encapsulated in service classes
- Repository Pattern: Data access abstraction with caching layers
- Multi-tenant Support: Organization-based data isolation at the API level
lib/
βββ app.dart # Main app configuration & routing
βββ main.dart # Application entry point
βββ config/
β βββ api_config.dart # Environment-aware API configuration
βββ models/
β βββ api_models.dart # Type-safe data models with JSON serialization
βββ services/ # Business logic & API communication
β βββ api_service.dart # HTTP client with auto-authentication
β βββ auth_service.dart # Google OAuth & organization management
β βββ contacts_service.dart
β βββ dashboard_service.dart
β βββ leads_service.dart
β βββ tasks_service.dart
βββ screens/ # UI screens organized by feature
βββ dashboard_screen.dart
βββ login_screen.dart
βββ company_selection_screen.dart
βββ ...
Login β Google OAuth β JWT Token β Organization Selection β Dashboard
class SomeService {
static final SomeService _instance = SomeService._internal();
factory SomeService() => _instance;
SomeService._internal();
// Service methods...
}
- Centralized HTTP client with automatic JWT token injection
- Organization header (
X-Organization-ID
) for multi-tenant requests - Automatic logout on 401 responses
- Comprehensive error handling with user-friendly messages
- Service-based state management with singleton pattern
- Local caching using SharedPreferences
- Reactive UI updates with StatefulWidget patterns
- Navigation state preserved with IndexedStack
- Authentication: Google OAuth β JWT storage β Organization selection
- API Requests: Service β ApiService β HTTP β Backend API
- Data Processing: JSON β Model classes β UI widgets
- Local Storage: Critical data cached in SharedPreferences
- Error Handling: Service level β UI feedback β User notification
The application uses environment-based API URLs configured in lib/config/api_config.dart
:
// Development (debug builds)
static const String _developmentUrl = 'https://b2ad5166b831.ngrok-free.app';
// Production (release builds)
static const String _productionUrl = 'https://api.bottlecrm.io';
Environment Detection: Automatic switching based on kDebugMode
flag
-
Firebase Console Setup:
- Create Firebase project
- Enable Google Sign-In authentication provider
- Configure OAuth consent screen
-
Get Android SHA-1 fingerprint:
cd android ./gradlew signingReport
-
Google Cloud Console:
- Create OAuth 2.0 Client ID for Android
- Add SHA-1 fingerprint to OAuth client
- Download
google-services.json
-
Firebase Configuration Files:
android/app/google-services.json # Android configuration ios/Runner/GoogleService-Info.plist # iOS configuration (if applicable)
1. User clicks "Sign in with Google"
2. Google OAuth flow β JWT token received
3. Token stored in SharedPreferences
4. User selects organization from available list
5. Organization ID added to all API requests via X-Organization-ID header
6. Dashboard and metadata loaded for selected organization
- Organization-based Data Isolation: All API requests include organization context
- Automatic Header Injection:
ApiService
addsX-Organization-ID
to requests - Organization Switching: Clear cached data when switching organizations
- Role-based Access: Different permissions based on user role in organization
- JWT Tokens: Stored securely in SharedPreferences
- Organization Data: Cached locally for offline access
- Metadata Caching: Lead statuses, sources, and other metadata cached per organization
- Auto-cleanup: Cached data cleared on logout and organization switch
Package | Version | Purpose |
---|---|---|
flutter |
SDK | Flutter framework |
cupertino_icons |
^1.0.8 | iOS-style icons |
http |
^1.1.0 | HTTP client for API requests |
google_sign_in |
^7.1.1 | Google OAuth authentication |
shared_preferences |
^2.2.2 | Local data persistence |
jwt_decoder |
^2.0.1 | JWT token parsing |
font_awesome_flutter |
^10.7.0 | FontAwesome icons |
intl |
^0.19.0 | Internationalization support |
package_info_plus |
^8.0.2 | App version and build info |
Package | Version | Purpose |
---|---|---|
flutter_test |
SDK | Testing framework |
flutter_lints |
^6.0.0 | Dart linting rules |
flutter_launcher_icons |
^0.14.4 | App icon generation |
- Authentication: Google Sign-In with JWT token management
- HTTP Communication: Robust API client with error handling
- Local Storage: Secure token and metadata caching
- UI Components: Material Design with FontAwesome icons
- Code Quality: Comprehensive linting and formatting
test/
βββ unit/ # Unit tests for services and models
βββ widget/ # Widget tests for UI components
βββ integration/ # End-to-end integration tests
# Run all tests
flutter test
# Run with coverage
flutter test --coverage
# Run specific test file
flutter test test/unit/auth_service_test.dart
- Unit Tests: All service methods and model classes
- Widget Tests: Critical UI components and interactions
- Integration Tests: End-to-end user flows
- Mocking: Use mockito for external dependencies
- Lazy Loading: Screens and data loaded on demand
- Image Optimization: Compressed assets and caching
- Memory Management: Proper disposal of controllers and streams
- Network Optimization: Request batching and intelligent caching
# Problem: Google Sign-In not working
# Solution: Check SHA-1 fingerprint configuration
cd android && ./gradlew signingReport
# Problem: google-services.json not found
# Solution: Ensure file is in correct location
ls android/app/google-services.json
# Problem: Build failures after dependency updates
# Solution: Clean and rebuild
flutter clean
flutter pub get
flutter run
# Problem: Android build issues
# Solution: Verify Android SDK and NDK versions
flutter doctor -v
# Problem: API requests failing in debug mode
# Solution: Check ngrok tunnel status and update URL in api_config.dart
# Problem: 401 Unauthorized errors
# Solution: Clear app data and re-authenticate
flutter clean
# Uninstall app from device and reinstall
- Hot Reload: Use
r
in terminal for hot reload during development - Hot Restart: Use
R
for hot restart when changing app state - DevTools: Use Flutter DevTools for debugging and performance analysis
- Logging: Check console output for detailed error information
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Follow coding standards: Use
dart format
andflutter analyze
- Write tests: Ensure adequate test coverage
- Commit changes: Use conventional commit messages
- Create Pull Request: Provide detailed description
- Follow Dart naming conventions
- Use meaningful variable and function names
- Add inline documentation for complex logic
- Implement proper error handling
- Write unit tests for new features
type(scope): description
feat(auth): add biometric authentication
fix(api): resolve null pointer exception
docs(readme): update installation instructions
MIT License
Copyright (c) 2024 BottleCRM
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
- π Issues: GitHub Issues for bug reports
- π¬ Discussions: GitHub Discussions for questions
- π₯ Firebase Setup: FIREBASE_SETUP.md for Firebase configuration
BottleCRM Mobile - Free CRM for startups and enterprises
Made with β€οΈ using Flutter