Version: 2.0
Date: July 2025
Status: Production Ready
A privacy-focused, offline AI assistant that runs entirely on your device using the Gemma 2B language model. No data leaves your device - complete privacy guaranteed.
- π 100% Privacy: All AI processing happens locally on your device
- π± Offline Functionality: Works without internet connection after initial download
- π¬ Natural Conversations: Chat with AI using natural language
- π Document Analysis: Upload and query PDF, TXT, and DOCX files
- π€ Custom Agents: Create and switch between different AI personalities
- β¬οΈ Smart Downloads: Resume interrupted model downloads automatically
- π¨ Professional UX: Unified design system with smooth interactions
- β¨ Seamless Splash Experience: Native splash screens with consistent branding and smooth initialization
GenLite.Demo.1.mp4
- iOS 16.0+ or Android 8.0+
- ~4GB free storage space
- 4GB RAM recommended
- Internet connection for initial model download
- Flutter SDK (latest stable version)
- Git
-
Clone the repository
git clone https://github.com/brahim-guaali/gen_lite.git cd gen_lite -
Install dependencies
flutter pub get
-
Set up Hugging Face Token
Step 1: Create a Hugging Face Account
- Go to Hugging Face
- Sign up for a free account
- Verify your email address
Step 2: Generate Access Token
- Log in to your Hugging Face account
- Go to Settings > Access Tokens
- Click "New token"
- Give it a name (e.g., "GenLite App")
- Select "Read" permissions
- Click "Generate token"
- Copy the token (you won't see it again!)
Step 3: Create .env File
- In the project root directory, create a file named
.env - Add your Hugging Face token:
HUGGING_FACE_TOKEN=your_token_here
Example .env file:
HUGGING_FACE_TOKEN=hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxβ οΈ Important Notes:- Never commit your
.envfile to version control - The
.envfile is already in.gitignorefor security - Keep your token private and secure
- If you lose your token, you can generate a new one
-
Run the app
flutter run
If you get a 401 Unauthorized error:
- Verify your Hugging Face token is correct
- Ensure the token has "Read" permissions
- Check that the
.envfile is in the project root - Restart the app after adding the token
If the model download fails:
- Check your internet connection
- Verify you have enough storage space (~4GB)
- Try running
flutter cleanandflutter pub get - The download can be resumed if interrupted
- Splash Screen: Beautiful native splash with app branding
- Initialization: Seamless transition to Flutter initialization screen
- Welcome Screen: Learn about app features and privacy
- Terms Acceptance: Accept Gemma license terms
- Model Download: Download the ~4GB AI model (can be resumed if interrupted)
- Start Chatting: Begin using the AI assistant
- Native Splash: Immediate display of app branding on launch
- Consistent Design: Primary color (#6366F1) background across platforms
- iOS: Centered "GenLite" text in white
- Android: Clean primary color background
- Smooth Transition: Seamless flow from native splash to Flutter initialization
- Loading Feedback: Clear indication during app initialization
GenLite follows Clean Architecture principles with a focus on privacy and performance:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Presentation Layer β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Chat UI β β File UI β β Settings UI β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Business Logic Layer β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Chat BLoC β β File BLoC β β Agent BLoC β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Data Layer β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β LLM Service β βFile Service β βStorage Svc β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- BLoC Pattern: Predictable state management across all features
- Unified UI System: Consistent, reusable components
- Local-Only Processing: No cloud dependencies for AI inference
- Resume Downloads: HTTP Range requests for interrupted downloads
- Material 3: Modern, accessible design system
- Natural Conversations: Type naturally and get intelligent responses
- Streaming Responses: See AI responses as they're generated
- Conversation History: All chats saved locally on your device
- Quick Prompts: Suggested conversation starters
- Supported Formats: PDF, TXT, DOCX files
- Upload & Process: Drag and drop or select files
- AI Analysis: Ask questions about your documents
- Local Storage: Files processed and stored locally
- Pre-built Templates: Choose from various AI personalities
- Custom Creation: Create your own AI agents
- Easy Switching: Switch agents during conversations
- Persistent Settings: Agent preferences saved locally
- Settings Hub: Entry point for all app configuration and info
- Agents: Manage, create, and switch AI agents (opens Agent Management screen)
- Voice: Configure voice input/output, language, and TTS (opens Voice Settings screen)
- Permissions: Manage app permissions for microphone, speech, file access, and camera
- About: App info, version, licenses, and privacy (opens About screen)
- Download Management: Resume interrupted downloads
- Privacy Controls: All data stays on your device
- App Preferences: Customize your experience
Navigate to Settings from the bottom navigation bar. Tap an option to open its dedicated screen. Use the back button to return to the Settings hub.
lib/
βββ core/ # App constants, themes, utilities
βββ features/ # Feature modules (chat, files, settings)
βββ shared/ # Shared services and widgets
βββ services/ # Business logic services
βββ widgets/ # Unified UI components
class LLMService {
Future<void> initialize({String? modelPath})
Future<String> generateResponse(String prompt)
Future<void> addContext(String context)
}class EnhancedModelDownloader {
static Future<String> ensureGemmaModel({
bool allowResume = true,
void Function(ProgressInfo info)? onProgress,
})
}class FileProcessingService {
Future<String> extractText(String filePath, String fileType)
Future<void> processFile(File file)
}- Chat BLoC: Message handling and conversation management
- File BLoC: File upload, processing, and management
- Agent BLoC: AI agent creation and configuration
- Network Errors: Automatic retry with exponential backoff
- Download Errors: Resume functionality and skip options
- File Errors: Clear error messages and recovery
- AI Errors: Graceful degradation with retry mechanisms
- Local Processing: All AI inference happens on your device
- No Cloud Storage: Conversations and files never leave your device
- No Tracking: No analytics or user behavior tracking
- Secure Storage: Local data encrypted at rest
- Verified Source: Gemma model from Google's official repository
- Hash Verification: Model integrity checks
- Secure Download: HTTPS with token authentication
| Component | Response Time | Memory Usage | Storage |
|---|---|---|---|
| App Launch | < 2 seconds | ~50MB | ~4GB |
| AI Response | < 3 seconds | ~100MB | - |
| File Upload | < 5 seconds | ~20MB | Varies |
| Model Download | ~10-30 min | ~50MB | 4GB |
# Unit tests
flutter test
# Widget tests
flutter test test/widget_test.dart
# Integration tests
flutter test integration_test/- BLoC Testing: State management logic
- Service Testing: Business logic services
- Widget Testing: UI components and screens
- Integration Testing: End-to-end workflows
- Minimum Version: iOS 16.0
- Deployment Target: iOS 16.0+
- Architecture: ARM64
- Minimum SDK: API 26 (Android 8.0)
- Target SDK: API 34 (Android 14)
- Architecture: ARM64, x86_64
# iOS
flutter build ios --release
# Android
flutter build apk --release
flutter build appbundle --release- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes
- Add tests for new functionality
- Run tests:
flutter test - Commit changes:
git commit -m 'Add feature' - Push to branch:
git push origin feature-name - Submit a pull request
- Follow Clean Architecture principles
- Use BLoC pattern for state management
- Maintain unified UI design system
- Write comprehensive tests
- Ensure privacy-first design
This project is licensed under the MIT License.
- My Blog: Follow my journey in AI and mobile development
- Vibe Coding in Action: Building an AI App from Scratch: Learn how this app was built using Cursor and Gemma
- Google: Gemma 2B language model
- Hugging Face: Model hosting and API
- Flutter Team: Cross-platform framework
- Open Source Community: Various dependencies and tools
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: See DEVELOPMENT.md for technical details
Made with β€οΈ for privacy-conscious users
