The Problem I Was Solving
Most fitness apps sync your health data to the cloud. I wanted an app where everything stays on-device — encrypted and private. No subscriptions, no cloud dependency.
So I built AI Gym Mentor in Flutter.
The Architecture
1. Encrypted Local Database with Drift + SQLCipher
The biggest technical challenge was implementing encrypted local storage. I used Drift (formerly Moor) as the ORM and SQLCipher for encryption on top of SQLite.
This means all workout logs, body measurements, and user data are AES-256 encrypted on-device.
2. Google Gemini AI Integration
I integrated the Gemini AI API to provide real-time coaching. After a workout, the app sends your session data to Gemini and returns personalized feedback, recovery suggestions, and progression advice.
The key was keeping the prompt context tight — sending only relevant recent session data rather than the full history.
3. Riverpod 3.0 State Management
The app uses Riverpod 3.0 with annotated generators for clean, scalable state management. This was essential given the complexity of syncing Wear OS data, chart state, and AI responses.
4. Full Tech Stack
- Flutter 3.22+ (iOS, Android, Web)
- Riverpod 3.0 (Annotated Generators)
- Drift + SQLCipher (encrypted local DB)
- Google Gemini AI
- GoRouter 17.2+
- Wear OS sync
- fl_chart for analytics (1RM, volume, body measurements)
- Lottie + Shimmer animations
- 1,000+ exercise database
- Multi-language: English, Hindi, Marathi
Why I Packaged It as a Template
After finishing the app, I realized it had taken months to build all these pieces together correctly. The SQLCipher setup alone took days. The Gemini integration required multiple iterations.
So I packaged the complete source code as a developer template — AI Gym Mentor — so other developers can build on top of it instead of starting from scratch.
What's Included
- Complete, buildable Flutter source code
- README with full setup guide
- Seeded exercise database (exercises.json)
- .env.example for Gemini API key setup
The template is available here: https://rahulsaroh.gumroad.com/l/sovgjy
Launch price: $29. Use code LAUNCH30 for 30% off (first 10 buyers).
Happy to Discuss
If you have questions about the SQLCipher + Drift setup, the Gemini integration pattern, or the Riverpod architecture — drop a comment below!
Top comments (0)